/* ==========================================================================
   Bürgerhaus am See - Admin CMS Dashboard Styling
   ========================================================================== */

:root {
  --admin-bg: #f1f5f9;
  --admin-sidebar: #0f2744;
  --admin-sidebar-hover: #1e3e62;
  --admin-sidebar-active: #0284c7;
  --admin-card: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text: #1e293b;
  --admin-text-muted: #64748b;
}

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
}

/* Admin Layout Wrapper */
.admin-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: var(--admin-sidebar);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.admin-brand {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-brand h2 {
  color: #ffffff;
  font-size: 1.15rem;
  margin: 0;
  font-weight: 700;
}

.admin-brand span {
  font-size: 0.75rem;
  color: #94a3b8;
  display: block;
}

.admin-nav {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
}

.admin-nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.admin-nav-item a:hover {
  background-color: var(--admin-sidebar-hover);
  color: #ffffff;
}

.admin-nav-item.active a {
  background-color: var(--admin-sidebar-active);
  color: #ffffff;
  font-weight: 600;
}

.admin-nav-badge {
  margin-left: auto;
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
}

.admin-sidebar-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-sidebar-footer a {
  color: #ef4444;
  text-decoration: none;
  font-weight: 600;
}

/* Main Content Area */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.admin-topbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-topbar-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-content {
  padding: 2rem;
  flex: 1;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.green { background: #ecfdf5; color: #10b981; }
.stat-icon.amber { background: #fffbeb; color: #f59e0b; }
.stat-icon.purple { background: #f5f3ff; color: #8b5cf6; }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--admin-text-muted);
  font-weight: 500;
}

/* Data Tables */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  overflow: hidden;
}

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

.admin-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.admin-table th {
  background-color: #f8fafc;
  color: var(--admin-text-muted);
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  color: #334155;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background-color: #f8fafc;
}

/* Modals */
.admin-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-modal.active {
  display: flex;
}

.admin-modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

.admin-modal-body {
  padding: 1.5rem;
}

.admin-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
}

/* Login Page Styling */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2744 0%, #0369a1 100%);
  padding: 1.5rem;
}

.login-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 1.5rem;
  color: #0f172a;
  margin-top: 0.75rem;
}

/* Action & Status Badges */
.badge-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-danger {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-info {
  background-color: #f0fdfa;
  color: #115e59;
  border: 1px solid #99f6e4;
}

.badge-primary {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-secondary {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* Modal Form Grids */
.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Audit Log Styling */
.audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  background: #f8fafc;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
}

.audit-filter-bar .form-control {
  min-width: 180px;
  font-size: 0.88rem;
}

.audit-entry-details {
  font-family: monospace;
  font-size: 0.82rem;
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: #334155;
  word-break: break-all;
}

/* Sidebar Backdrop on Mobile */
.admin-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 90;
}

.admin-backdrop.active {
  display: block;
}

/* Responsive Styles für Smartphones & Tablets */
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
  }

  #adminSidebarToggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid var(--admin-border);
    cursor: pointer;
    color: #0f172a;
  }

  .admin-topbar {
    padding: 0.85rem 1rem;
  }

  .admin-topbar-title {
    font-size: 1.15rem;
  }

  .admin-content {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .modal-grid-2 {
    grid-template-columns: 1fr;
  }

  .admin-modal-dialog {
    margin: 0.5rem;
    max-height: 94vh;
  }

  .admin-modal-body {
    padding: 1rem;
  }

  /* Prevent auto-zoom on mobile inputs */
  input, select, textarea, .form-control {
    font-size: 16px !important;
  }

  .btn {
    min-height: 42px;
  }
}

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

  .admin-topbar-actions span {
    display: none;
  }

  .audit-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .audit-filter-bar .form-control {
    width: 100%;
    min-width: 0;
  }
}

/* ==========================================================================
   Sortierbare Tabellen & Paginierung
   ========================================================================== */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.sortable-th:hover {
  background-color: #f1f5f9;
  color: var(--admin-primary);
}

.sort-indicator {
  display: inline-block;
  font-size: 0.8rem;
  margin-left: 0.35rem;
  color: #94a3b8;
}

.sortable-th:hover .sort-indicator {
  color: var(--admin-primary);
}

.admin-pagination-bar {
  background: #f8fafc;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.6rem;
  font-size: 0.85rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.page-btn.active {
  font-weight: 700;
}

/* ==========================================================================
   A4 Druckansicht (Druckoptimiert für Terminkalender)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 10mm 15mm 10mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  /* Alle Navigations-, Kontroll- und Interaktionselemente ausblenden */
  .admin-sidebar,
  .admin-topbar,
  .header-topbar,
  .site-header,
  .mobile-sticky-bar,
  .admin-backdrop,
  .admin-modal,
  .no-print,
  .calendar-action-bar,
  .admin-pagination-bar,
  .btn,
  form,
  #adminSidebarToggle {
    display: none !important;
  }

  .admin-wrapper,
  .admin-main,
  .admin-content,
  .admin-card {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Druck-Briefkopf aktivieren */
  .print-only-header {
    display: block !important;
    margin-bottom: 1.5rem !important;
  }

  .table-responsive {
    overflow: visible !important;
    max-height: none !important;
  }

  .admin-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10pt !important;
  }

  .admin-table th,
  .admin-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 6px 8px !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }

  .admin-table th {
    background: #f1f5f9 !important;
    font-weight: 700 !important;
  }

  .badge {
    border: 1px solid #000000 !important;
    background: transparent !important;
    color: #000000 !important;
    font-weight: 600 !important;
    padding: 2px 6px !important;
    font-size: 8.5pt !important;
  }

  /* Im Ausdruck alle Zeilen der Terminliste vollständig darstellen */
  .cal-row {
    display: table-row !important;
  }
}

