/* ============ ADMIN LAYOUT ============ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #3A2E1E 0%, #5A4A30 100%);
  color: white;
  padding: 1.5rem 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-header {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1rem;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.sidebar-header small {
  opacity: 0.6;
  font-size: 0.8rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.5rem;
  color: rgba(255,255,255,0.7);
  transition: all 0.2s;
  font-size: 0.95rem;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-nav a .icon { font-size: 1.2rem; }

.badge {
  background: #E07A5F;
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.mobile-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  background: #3A2E1E;
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .main-content {
    margin-left: 0 !important;
    padding-top: 4rem;
  }
}

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 2rem;
  background: #F5F0EB;
  min-height: 100vh;
}

/* ============ LOGIN ============ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F5F0EB 0%, #E8E0D5 100%);
  padding: 1rem;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-card h2 {
  text-align: center;
  color: var(--brand-primary);
  margin-bottom: 0.25rem;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: none;
}

.alert.show { display: block; }
.alert-error { background: #FEE2E2; color: #DC2626; }
.alert-success { background: #D1FAE5; color: #059669; }

/* ============ PAGE SECTIONS ============ */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

.page-title {
  font-size: 1.75rem;
  color: var(--brand-primary);
  margin-bottom: 1.5rem;
}

/* ============ STATS GRID ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid;
}

.stat-card.orange { border-color: #F59E0B; }
.stat-card.green { border-color: #10B981; }
.stat-card.red { border-color: #EF4444; }
.stat-card.blue { border-color: #3B82F6; }
.stat-card.purple { border-color: #8B5CF6; }

.stat-card .number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card .label {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ============ TABLES ============ */
.table-card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--warm-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table-card-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: #FAFAF8;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--warm-border);
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--warm-border);
  vertical-align: top;
}

.admin-table tr:hover {
  background: #FAFAF8;
}

.admin-table tr.paid-row {
  background: #D1FAE5;
}

.admin-table tr.paid-row:hover {
  background: #A7F3D0;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-badge.anfrage { background: #FEF3C7; color: #92400E; }
.status-badge.bestaetigt { background: #D1FAE5; color: #065F46; }
.status-badge.abgelehnt { background: #FEE2E2; color: #991B1B; }

.invoice-status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

.invoice-status.pending { background: #F3F4F6; color: #6B7280; }
.invoice-status.done { background: #DBEAFE; color: #1E40AF; }
.invoice-status.sent { background: #D1FAE5; color: #065F46; }

/* ============ ACTION BUTTONS ============ */
.action-btns {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--warm-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  background: #F3F4F6;
}

.modal-body {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--warm-border);
}

/* ============ INVOICE FORM ============ */
.meter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.meter-result {
  display: flex;
  align-items: center;
  height: 38px;
  color: var(--text-light);
  font-size: 0.9rem;
}

.invoice-total {
  background: #F0FDF4;
  border: 2px solid #86EFAC;
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: right;
  font-size: 1.1rem;
  margin-top: 1rem;
}

.extras-override-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.extras-override-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* ============ ADMIN FORM SECTIONS ============ */
.admin-form-section {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.admin-form-section h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.inline-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.settings-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.settings-row label {
  min-width: 180px;
  font-weight: 500;
}

.settings-row input {
  flex: 1;
  min-width: 150px;
  max-width: 200px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ CALENDAR ============ */
.admin-calendar-wrapper {
  background: white;
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.calendar-nav button {
  background: var(--brand-secondary);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  color: white;
}

.calendar-nav h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

#admin-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

#admin-calendar-grid .day-header {
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-light);
  padding: 0.5rem;
}

#admin-calendar-grid .day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

#admin-calendar-grid .day.free {
  background: #F3F4F6;
  color: var(--text-primary);
}

#admin-calendar-grid .day.free:hover {
  background: #E5E7EB;
  border-color: var(--brand-secondary);
}

#admin-calendar-grid .day.requested {
  background: #FEF3C7;
  color: #92400E;
  font-weight: 500;
}

#admin-calendar-grid .day.booked {
  background: #D1FAE5;
  color: #065F46;
  font-weight: 600;
}

#admin-calendar-grid .day.blocked {
  background: #FEE2E2;
  color: #991B1B;
  text-decoration: line-through;
}

#admin-calendar-grid .day.past {
  opacity: 0.4;
  cursor: default;
}

#admin-calendar-grid .day.empty {
  pointer-events: none;
}

/* ============ MESSAGES ============ */
.message-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid #E5E7EB;
}

.message-card.unread {
  border-left-color: #E07A5F;
  background: #FFFBEB;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.message-date {
  color: var(--text-light);
  font-size: 0.85rem;
}

.message-meta {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.message-body {
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ============ CHARTS ============ */
.chart-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 200px;
  padding: 1rem 0;
  gap: 0.5rem;
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-width: 60px;
}

.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, #E07A5F 0%, #C45A3D 100%);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: all 0.3s;
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.chart-label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-align: center;
}

/* ============ EXTRAS STATS ============ */
.extras-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--warm-border);
}

.extras-stat-row:last-child {
  border-bottom: none;
}

/* ============ PAID CHECKBOX ============ */
.paid-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.paid-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.paid-checkbox .checkmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: white;
  border: 2px solid #D1D5DB;
  border-radius: 6px;
  font-size: 1rem;
  color: #10B981;
  font-weight: bold;
  transition: all 0.2s;
}

.paid-checkbox:hover .checkmark {
  border-color: #10B981;
}

.paid-checkbox input:checked + .checkmark {
  background: #10B981;
  border-color: #10B981;
  color: white;
}

.paid-checkbox input:focus + .checkmark {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ============ PAID CHECKBOX ============ */
.paid-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  width: 28px;
  height: 28px;
}

.paid-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  width: 0;
  height: 0;
}

.paid-checkbox .checkmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--warm-border);
  border-radius: var(--radius-sm);
  background: white;
  transition: all 0.2s;
  font-size: 14px;
  color: white;
}

.paid-checkbox:hover .checkmark {
  border-color: var(--primary);
}

.paid-checkbox input:checked + .checkmark {
  background: var(--success);
  border-color: var(--success);
}

.paid-row {
  background: rgba(76, 175, 80, 0.05) !important;
}

.paid-row td {
  color: #4a4a4a;
}
