/* ============================================
   ADMIN PANEL - Jonas Transport Consulting
   ============================================ */

:root {
  --admin-bg: #070b14;
  --admin-surface: #0d1321;
  --admin-card: #131a2b;
  --admin-card-hover: #1a2340;
  --admin-border: rgba(255, 255, 255, 0.06);
  --admin-border-light: rgba(255, 255, 255, 0.1);
  --admin-accent: #3ecdc6;
  --admin-accent-light: #5eded8;
  --admin-accent-dark: #2fb8b1;
  --admin-orange: #f97316;
  --admin-red: #ef4444;
  --admin-green: #22c55e;
  --admin-text: #f1f5f9;
  --admin-text-secondary: #94a3b8;
  --admin-text-muted: #64748b;
  --admin-sidebar-width: 280px;
  --admin-radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 17px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.65;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* --- Login Page --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-bg);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(62, 205, 198, 0.06) 0%, transparent 70%);
  border-radius: 50%;
}

.login-box {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  position: relative;
  z-index: 1;
}

.login-box__logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-box__logo img {
  height: 60px;
  margin: 0 auto 16px;
}

.login-box__logo h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--admin-text);
}

.login-box__logo p {
  font-size: 0.85rem;
  color: var(--admin-text-muted);
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--admin-text-secondary);
  margin-bottom: 8px;
}

.login-form input {
  width: 100%;
  padding: 14px 16px;
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
}

.login-form input:focus {
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(62, 205, 198, 0.1);
}

.login-form input::placeholder { color: var(--admin-text-muted); }

.login-error {
  display: none;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: var(--admin-red);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.login-error.visible { display: block; }

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--admin-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: all 0.3s;
}

.btn-login:hover {
  background: var(--admin-accent-light);
  box-shadow: 0 4px 20px rgba(62, 205, 198, 0.3);
}

/* --- Dashboard Layout --- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--admin-sidebar-width);
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-border);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar__logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--admin-border);
  margin-bottom: 16px;
}

.sidebar__logo img {
  height: 45px;
}

.sidebar__nav { flex: 1; padding: 8px 12px; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--admin-text-secondary);
  transition: all 0.2s;
  margin-bottom: 4px;
}

.sidebar__link i { width: 22px; text-align: center; font-size: 1.1rem; }

.sidebar__link:hover {
  background: rgba(62, 205, 198, 0.05);
  color: var(--admin-text);
}

.sidebar__link.active {
  background: rgba(62, 205, 198, 0.1);
  color: var(--admin-accent);
}

.sidebar__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--admin-border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.sidebar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(62, 205, 198, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-accent);
  font-weight: 700;
  font-size: 0.85rem;
}

.sidebar__user-info { font-size: 0.85rem; }
.sidebar__user-info span { display: block; color: var(--admin-text-muted); font-size: 0.75rem; }

.btn-logout {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--admin-text-muted);
  border: 1px solid var(--admin-border);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-logout:hover {
  border-color: var(--admin-red);
  color: var(--admin-red);
  background: rgba(239, 68, 68, 0.05);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--admin-sidebar-width);
  padding: 24px;
  min-height: 100vh;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.main-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
}

.main-header p {
  color: var(--admin-text-muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

.mobile-menu-btn {
  display: none;
  padding: 8px;
  font-size: 1.3rem;
  color: var(--admin-text-secondary);
}

/* --- Stats Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 28px;
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  transition: all 0.3s;
}

.stat-card:hover {
  border-color: rgba(62, 205, 198, 0.15);
}

.stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-card__icon.teal { background: rgba(62, 205, 198, 0.1); color: var(--admin-accent); }
.stat-card__icon.orange { background: rgba(249, 115, 22, 0.1); color: var(--admin-orange); }
.stat-card__icon.green { background: rgba(34, 197, 94, 0.1); color: var(--admin-green); }
.stat-card__icon.red { background: rgba(239, 68, 68, 0.1); color: var(--admin-red); }

.stat-card__value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--admin-text);
}

.stat-card__label {
  font-size: 0.88rem;
  color: var(--admin-text-muted);
  margin-top: 6px;
}

/* --- Chart Area --- */
.chart-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card {
  padding: 28px;
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
}

.chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-card__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding-top: 20px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar__fill {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(180deg, var(--admin-accent), rgba(62, 205, 198, 0.3));
  border-radius: 6px 6px 0 0;
  transition: height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-height: 4px;
}

.chart-bar__label {
  font-size: 0.7rem;
  color: var(--admin-text-muted);
}

/* Page list in chart section */
.page-list { list-style: none; }

.page-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.95rem;
}

.page-list__item:last-child { border-bottom: none; }

.page-list__name { color: var(--admin-text-secondary); }
.page-list__count { font-weight: 600; color: var(--admin-text); }

/* --- Data Table --- */
.table-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  overflow: hidden;
  width: 100%;
}

.table-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
}

.table-card__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--admin-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  transition: all 0.3s;
}

.btn-add:hover {
  background: var(--admin-accent-light);
  box-shadow: 0 4px 16px rgba(62, 205, 198, 0.3);
}

.search-input {
  padding: 10px 16px;
  padding-left: 36px;
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  font-size: 0.88rem;
  outline: none;
  width: 260px;
  transition: border-color 0.3s;
}

.search-input:focus { border-color: var(--admin-accent); }
.search-input::placeholder { color: var(--admin-text-muted); }

.search-wrapper {
  position: relative;
}

.search-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-muted);
  font-size: 0.85rem;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--admin-text-muted);
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody td {
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--admin-text-secondary);
  border-bottom: 1px solid var(--admin-border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody tr:hover { background: rgba(62, 205, 198, 0.02); }
tbody tr:last-child td { border-bottom: none; }

/* Column width distribution */
table th:first-child,
table td:first-child { width: 140px; }           /* Unternehmen - etwas schmaler */
table th:nth-child(5),
table td:nth-child(5) { width: 80px; }            /* Dokumente */
table th:nth-child(6),
table td:nth-child(6) { width: 90px; }            /* Status */
table th:last-child,
table td:last-child { width: 120px; }             /* Aktionen */

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge--active { background: rgba(34, 197, 94, 0.1); color: var(--admin-green); }
.badge--inactive { background: rgba(239, 68, 68, 0.1); color: var(--admin-red); }

.row-actions {
  display: flex;
  gap: 4px;
}

.row-actions button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--admin-text-muted);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.row-actions .btn-edit:hover { color: var(--admin-accent); background: rgba(62, 205, 198, 0.08); border-color: rgba(62, 205, 198, 0.15); }
.row-actions .btn-docs:hover { color: var(--admin-orange); background: rgba(249, 115, 22, 0.08); border-color: rgba(249, 115, 22, 0.15); }
.row-actions .btn-delete:hover { color: var(--admin-red); background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.15); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--admin-text-muted);
}

.empty-state i { font-size: 2.5rem; margin-bottom: 12px; display: block; opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 32px;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
}

.modal__close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-text-muted);
  transition: all 0.2s;
}

.modal__close:hover { background: rgba(255, 255, 255, 0.05); color: var(--admin-text); }

.modal .form-group {
  margin-bottom: 20px;
}

.modal .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--admin-text-secondary);
  margin-bottom: 8px;
}

.modal .form-group input,
.modal .form-group textarea,
.modal .form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  outline: none;
  transition: border-color 0.3s;
}

.modal .form-group input:focus,
.modal .form-group textarea:focus,
.modal .form-group select:focus {
  border-color: var(--admin-accent);
}

.modal .form-group textarea { min-height: 80px; resize: vertical; }
.modal .form-group select option { background: var(--admin-card); }

.modal .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
}

.btn-cancel {
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--admin-text-muted);
  border: 1px solid var(--admin-border);
  transition: all 0.2s;
}

.btn-cancel:hover { border-color: var(--admin-border-light); color: var(--admin-text); }

.btn-save {
  padding: 12px 26px;
  background: var(--admin-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  transition: all 0.3s;
}

.btn-save:hover { background: var(--admin-accent-light); }

/* --- Documents Panel --- */
.docs-panel {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  margin-top: 12px;
  display: none;
}

.docs-panel.active { display: block; }

.docs-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
}

.docs-panel__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
}

.docs-panel__close {
  color: var(--admin-text-muted);
  font-size: 0.85rem;
  transition: color 0.2s;
}

.docs-panel__close:hover { color: var(--admin-text); }

.upload-area {
  margin: 20px 24px;
  padding: 32px;
  border: 2px dashed var(--admin-border);
  border-radius: 10px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--admin-accent);
  background: rgba(62, 205, 198, 0.03);
}

.upload-area i { font-size: 2rem; color: var(--admin-text-muted); margin-bottom: 12px; }
.upload-area p { font-size: 0.85rem; color: var(--admin-text-muted); }
.upload-area span { color: var(--admin-accent); font-weight: 600; }

.upload-area input[type="file"] { display: none; }

.docs-list { padding: 0 24px 20px; }

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.doc-item__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: rgba(249, 115, 22, 0.1);
  color: var(--admin-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.doc-item__name { font-size: 0.85rem; font-weight: 500; }
.doc-item__meta { font-size: 0.7rem; color: var(--admin-text-muted); }

.doc-item__actions { display: flex; gap: 6px; }

.doc-item__actions button {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--admin-text-muted);
  transition: all 0.2s;
}

.doc-item__actions .btn-download:hover { color: var(--admin-accent); background: rgba(62, 205, 198, 0.08); }
.doc-item__actions .btn-remove:hover { color: var(--admin-red); background: rgba(239, 68, 68, 0.08); }

/* --- Section Visibility --- */
.section { display: none; }
.section.active { display: block; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-section { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  html { font-size: 16px; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .mobile-menu-btn { display: block; }
  .stats-grid { grid-template-columns: 1fr; }
  .modal { margin: 16px; max-width: none; }
  .table-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .search-input { width: 100%; }
  .modal .form-row { grid-template-columns: 1fr; }

  table { table-layout: auto; }

  table, thead, tbody, th, td, tr {
    display: block;
  }

  table th, table td { width: auto !important; }

  thead { display: none; }

  tbody td {
    padding: 8px 24px;
    text-align: right;
    border-bottom: none;
    position: relative;
    padding-left: 45%;
  }

  tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 24px;
    font-weight: 600;
    color: var(--admin-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
  }

  tbody tr {
    border-bottom: 1px solid var(--admin-border);
    padding: 8px 0;
  }
}
