/**
 * tablewizzard.app – Dashboard Stylesheet
 * 
 * Layout: Sidebar + Header + Hauptbereich
 * Breakpoints: Desktop >1024px | Tablet 768-1024px | Mobile <768px
 */

/* ============================================================================
   Layout-Grundgerüst
   ============================================================================ */

.dashboard-layout {
  display: grid;
  grid-template-columns: var(--tw-sidebar-width) 1fr;
  grid-template-rows: var(--tw-header-height) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
  background-color: var(--tw-background);
}


/* ============================================================================
   Sidebar
   ============================================================================ */

.sidebar {
  grid-area: sidebar;
  background: var(--tw-primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: var(--tw-z-sticky);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--tw-space-md);
  padding: var(--tw-space-md) var(--tw-space-lg);
  text-decoration: none;
}

.sidebar-brand:hover {
  text-decoration: none;
}

/* Brand-Row (Logo + Collapse-Button) */
.sidebar-brand-row {
  display: flex;
  align-items: center;
  height: var(--tw-header-height);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-row .sidebar-brand {
  flex: 1;
  min-width: 0;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--tw-radius-sm);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.sidebar-collapse-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: var(--tw-font-display);
  font-size: var(--tw-text-lg);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--tw-space-md) 0;
}

.sidebar-section {
  margin-bottom: var(--tw-space-md);
}

.sidebar-section-title {
  padding: var(--tw-space-sm) var(--tw-space-lg);
  font-size: var(--tw-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.45);
  margin-bottom: var(--tw-space-xs);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--tw-space-md);
  padding: 10px var(--tw-space-lg);
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: var(--tw-text-sm);
  font-weight: 500;
  transition: all var(--tw-transition-fast);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

.sidebar-link.is-active {
  color: #fff;
  background: rgba(255,255,255,0.12);
  border-left-color: var(--tw-accent);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-link.is-active svg {
  opacity: 1;
  color: var(--tw-accent);
}

.sidebar-badge {
  margin-left: auto;
  background: var(--tw-accent);
  color: var(--tw-primary-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

/* Sidebar-Footer */
.sidebar-footer {
  padding: var(--tw-space-md) var(--tw-space-lg);
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: var(--tw-text-xs);
  color: rgba(255,255,255,0.35);
}

.sidebar-footer a {
  color: rgba(255,255,255,0.35);
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
}


/* ============================================================================
   Eingeklappte Sidebar (Desktop)
   ============================================================================ */

.sidebar.is-collapsed {
  width: 64px;
  overflow-x: hidden;
}

.sidebar-collapsed.dashboard-layout {
  grid-template-columns: 64px 1fr;
}

/* Brand-Row: Logo zentriert, Collapse-Button darunter */
.sidebar.is-collapsed .sidebar-brand-row {
  flex-direction: column;
  height: auto;
  padding: var(--tw-space-sm) 0;
  gap: 4px;
}

.sidebar.is-collapsed .sidebar-brand-row .sidebar-brand {
  justify-content: center;
  padding: var(--tw-space-sm) 0;
}

.sidebar.is-collapsed .sidebar-brand-text {
  display: none;
}

.sidebar.is-collapsed .sidebar-collapse-btn {
  width: 40px;
  height: 28px;
  margin: 0 auto 4px;
  border: none;
}

.sidebar.is-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* Navigation: nur Icons zentriert */
.sidebar.is-collapsed .sidebar-section-title {
  display: none;
}

.sidebar.is-collapsed .sidebar-nav {
  padding: var(--tw-space-sm) 0;
}

.sidebar.is-collapsed .sidebar-link {
  position: relative;
  justify-content: center;
  padding: 12px 0;
  border-left: 3px solid transparent;
  gap: 0;
}

.sidebar.is-collapsed .sidebar-link span:not(.sidebar-badge) {
  display: none;
}

.sidebar.is-collapsed .sidebar-link svg {
  margin: 0;
}

.sidebar.is-collapsed .sidebar-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  padding: 1px 4px;
  min-width: 16px;
}

/* Footer ausblenden */
.sidebar.is-collapsed .sidebar-footer {
  padding: var(--tw-space-sm);
  overflow: hidden;
}

.sidebar.is-collapsed .sidebar-footer > * {
  display: none;
}

/* Tooltip bei Hover (eingeklappter Zustand) */
.sidebar.is-collapsed .sidebar-link::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(44, 62, 64, 0.95);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--tw-radius-sm);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}

.sidebar.is-collapsed .sidebar-link:hover::after {
  opacity: 1;
}


/* ============================================================================
   Header
   ============================================================================ */

.dashboard-header {
  grid-area: header;
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--tw-space-xl);
  background: #fff;
  border-bottom: 1px solid #E2E8E4;
  height: var(--tw-header-height);
  z-index: var(--tw-z-sticky);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--tw-space-md);
}

.header-menu-toggle {
  display: none;  /* Nur auf Mobile sichtbar */
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tw-text);
  border-radius: var(--tw-radius-sm);
  transition: background var(--tw-transition-fast);
}

.header-menu-toggle:hover {
  background: var(--tw-surface);
}

.header-menu-toggle svg {
  width: 24px;
  height: 24px;
}

.header-title {
  font-family: var(--tw-font-display);
  font-size: var(--tw-text-lg);
  font-weight: 700;
  color: var(--tw-text);
}

.header-subtitle {
  font-size: var(--tw-text-sm);
  color: var(--tw-text-light);
  margin-left: var(--tw-space-sm);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--tw-space-md);
}

/* Offline-Indikator */
.header-offline {
  display: none;
  align-items: center;
  gap: var(--tw-space-xs);
  padding: 4px 12px;
  background: var(--tw-warning-light);
  color: #935610;
  border-radius: var(--tw-radius-sm);
  font-size: var(--tw-text-xs);
  font-weight: 600;
}

.header-offline.is-visible {
  display: flex;
}

.header-offline svg {
  width: 14px;
  height: 14px;
}

/* Sprachumschalter im Header */
.header-language .language-switcher__current {
  color: var(--tw-text-light);
}

/* User-Menü */
.header-user {
  display: flex;
  align-items: center;
  gap: var(--tw-space-sm);
  padding: 6px 12px;
  background: none;
  border: 1px solid #E2E8E4;
  border-radius: var(--tw-radius-sm);
  cursor: pointer;
  transition: all var(--tw-transition-fast);
  font-family: var(--tw-font-body);
}

.header-user:hover {
  background: var(--tw-surface);
  border-color: var(--tw-primary-light);
}

.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--tw-radius-full);
  background: var(--tw-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--tw-text-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.header-user-info {
  text-align: left;
  line-height: 1.3;
}

.header-user-name {
  font-size: var(--tw-text-sm);
  font-weight: 600;
  color: var(--tw-text);
}

.header-user-role {
  font-size: var(--tw-text-xs);
  color: var(--tw-text-muted);
}

/* User-Dropdown */
.user-dropdown {
  position: relative;
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #E2E8E4;
  border-radius: var(--tw-radius-md);
  box-shadow: var(--tw-shadow-lg);
  min-width: 200px;
  z-index: var(--tw-z-dropdown);
  overflow: hidden;
}

.user-dropdown-menu.is-open {
  display: block;
  animation: tw-fade-in 0.15s ease-out;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--tw-space-sm);
  padding: 10px var(--tw-space-md);
  font-size: var(--tw-text-sm);
  color: var(--tw-text);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-family: var(--tw-font-body);
  transition: background var(--tw-transition-fast);
}

.user-dropdown-item:hover {
  background: var(--tw-surface);
  text-decoration: none;
}

.user-dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--tw-text-muted);
}

.user-dropdown-divider {
  height: 1px;
  background: #E2E8E4;
  margin: var(--tw-space-xs) 0;
}

.user-dropdown-item--danger {
  color: var(--tw-error);
}

.user-dropdown-item--danger svg {
  color: var(--tw-error);
}


/* ============================================================================
   Hauptbereich
   ============================================================================ */

.dashboard-main {
  grid-area: main;
  padding: var(--tw-space-xl);
  overflow-y: auto;
  overflow-x: hidden;
}


/* ============================================================================
   Statistik-Karten (Tagesübersicht)
   ============================================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--tw-space-lg);
  margin-bottom: var(--tw-space-xl);
}

.stat-card {
  background: #fff;
  border-radius: var(--tw-radius-md);
  box-shadow: var(--tw-shadow-sm);
  padding: var(--tw-space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--tw-space-md);
  transition: box-shadow var(--tw-transition-fast);
}

.stat-card:hover {
  box-shadow: var(--tw-shadow-md);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--tw-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-icon--reservations {
  background: rgba(212, 168, 83, 0.15);
  color: var(--tw-accent-dark);
}

.stat-icon--guests {
  background: rgba(45, 90, 71, 0.1);
  color: var(--tw-primary);
}

.stat-icon--tables {
  background: rgba(90, 154, 122, 0.15);
  color: var(--tw-success);
}

.stat-icon--occupancy {
  background: rgba(41, 128, 185, 0.1);
  color: var(--tw-info);
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: var(--tw-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--tw-text-muted);
  margin-bottom: 2px;
}

.stat-value {
  font-family: var(--tw-font-display);
  font-size: var(--tw-text-xl);
  font-weight: 700;
  color: var(--tw-text);
  line-height: 1.2;
}

.stat-detail {
  font-size: var(--tw-text-xs);
  color: var(--tw-text-muted);
  margin-top: 2px;
}


/* ============================================================================
   Inhaltsbereich (Tischplan-Platzhalter / Reservierungsliste)
   ============================================================================ */

.content-section {
  background: #fff;
  border-radius: var(--tw-radius-md);
  box-shadow: var(--tw-shadow-sm);
  margin-bottom: var(--tw-space-xl);
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--tw-space-lg) var(--tw-space-xl);
  border-bottom: 1px solid #E8F0EC;
}

.content-header h2 {
  font-size: var(--tw-text-lg);
  margin: 0;
}

.content-header-actions {
  display: flex;
  align-items: center;
  gap: var(--tw-space-sm);
}

.content-body {
  padding: var(--tw-space-xl);
}

/* Platzhalter-Zustand (leer / wird geladen) */
.content-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--tw-space-3xl) var(--tw-space-xl);
  text-align: center;
  color: var(--tw-text-muted);
}

.content-placeholder svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
  margin-bottom: var(--tw-space-lg);
}

.content-placeholder h3 {
  color: var(--tw-text-light);
  margin-bottom: var(--tw-space-sm);
}

.content-placeholder p {
  font-size: var(--tw-text-sm);
  max-width: 400px;
}


/* ============================================================================
   Heutige Reservierungen (Kurzliste)
   ============================================================================ */

.reservation-list {
  list-style: none;
}

.reservation-item {
  display: flex;
  align-items: center;
  gap: var(--tw-space-md);
  padding: var(--tw-space-md) 0;
  border-bottom: 1px solid #F0F4F2;
}

.reservation-item:last-child {
  border-bottom: none;
}

.reservation-time {
  font-family: var(--tw-font-mono);
  font-size: var(--tw-text-sm);
  font-weight: 600;
  color: var(--tw-primary);
  min-width: 50px;
}

.reservation-info {
  flex: 1;
  min-width: 0;
}

.reservation-name {
  font-weight: 600;
  font-size: var(--tw-text-sm);
  color: var(--tw-text);
}

.reservation-details {
  font-size: var(--tw-text-xs);
  color: var(--tw-text-muted);
}

.reservation-status {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.reservation-status--reserved {
  background: rgba(212, 168, 83, 0.15);
  color: var(--tw-accent-dark);
}

.reservation-status--seated {
  background: rgba(90, 154, 122, 0.15);
  color: #2D7A52;
}

.reservation-status--completed {
  background: rgba(138, 154, 156, 0.15);
  color: var(--tw-text-light);
}

.reservation-status--noshow {
  background: rgba(192, 57, 43, 0.1);
  color: var(--tw-error);
}


/* ============================================================================
   Sidebar-Overlay (Mobile)
   ============================================================================ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: calc(var(--tw-z-sticky) - 1);
}

.sidebar-overlay.is-visible {
  display: block;
}


/* ============================================================================
   Responsive: Tablet (768px – 1024px)
   ============================================================================ */

@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--tw-sidebar-width);
    transform: translateX(-100%);
    transition: transform var(--tw-transition);
    z-index: var(--tw-z-overlay);
  }

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

  .header-menu-toggle {
    display: flex;
  }

  .header-user-info {
    display: none; /* Nur Avatar auf Tablet */
  }

  /* Collapse-Button nur auf Desktop */
  .sidebar-collapse-btn {
    display: none;
  }

  /* Collapsed-State auf Tablet/Mobile ignorieren */
  .sidebar.is-collapsed {
    width: var(--tw-sidebar-width);
  }
  .sidebar.is-collapsed .sidebar-brand-row {
    flex-direction: row;
    height: var(--tw-header-height);
    padding: 0;
  }
  .sidebar.is-collapsed .sidebar-brand-row .sidebar-brand {
    justify-content: flex-start;
    padding: var(--tw-space-md) var(--tw-space-lg);
  }
  .sidebar.is-collapsed .sidebar-brand-text,
  .sidebar.is-collapsed .sidebar-section-title,
  .sidebar.is-collapsed .sidebar-footer > *,
  .sidebar.is-collapsed .sidebar-link span:not(.sidebar-badge) {
    display: revert;
  }
  .sidebar.is-collapsed .sidebar-link {
    justify-content: flex-start;
    padding: 10px var(--tw-space-lg);
    gap: var(--tw-space-md);
  }
  .sidebar.is-collapsed .sidebar-link::after {
    display: none;
  }
  .sidebar.is-collapsed .sidebar-badge {
    position: static;
    font-size: 11px;
    padding: 2px 7px;
    min-width: 22px;
  }
}


/* ============================================================================
   Responsive: Mobile (<768px)
   ============================================================================ */

@media (max-width: 767px) {
  .dashboard-header {
    padding: 0 var(--tw-space-md);
  }

  .dashboard-main {
    padding: var(--tw-space-md);
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--tw-space-md);
  }

  .stat-card {
    padding: var(--tw-space-md);
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stat-icon svg {
    width: 18px;
    height: 18px;
  }

  .stat-value {
    font-size: var(--tw-text-lg);
  }

  .content-header {
    padding: var(--tw-space-md);
    flex-wrap: wrap;
    gap: var(--tw-space-sm);
  }

  .content-body {
    padding: var(--tw-space-md);
  }

  .header-subtitle {
    display: none;
  }

  .header-right {
    gap: var(--tw-space-sm);
  }
}

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

  .header-language {
    display: none;
  }
}


/* ============================================================================
   Offene Anfragen Widget
   ============================================================================ */

.inquiry-widget {
  border: 2px solid var(--tw-accent);
  box-shadow: 0 2px 8px rgba(212, 168, 83, 0.15);
}

.inquiry-widget__header h2 {
  display: flex;
  align-items: center;
}

.inquiry-widget__count {
  background: var(--tw-accent);
  color: var(--tw-primary-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  min-width: 22px;
  text-align: center;
  line-height: 1.4;
}

.inquiry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.inquiry-item {
  display: flex;
  align-items: flex-start;
  gap: var(--tw-space-md);
  padding: var(--tw-space-md) var(--tw-space-xl);
  border-bottom: 1px solid #F0F4F2;
  transition: background 0.1s;
}
.inquiry-item:last-child {
  border-bottom: none;
}
.inquiry-item:hover {
  background: rgba(212, 168, 83, 0.04);
}

.inquiry-item__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--tw-radius-full);
  background: rgba(212, 168, 83, 0.15);
  color: var(--tw-accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.inquiry-item__body {
  flex: 1;
  min-width: 0;
}

.inquiry-item__top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inquiry-item__name {
  font-weight: 600;
  font-size: var(--tw-text-sm);
  color: var(--tw-text);
}

.inquiry-item__ago {
  font-size: 11px;
  color: var(--tw-text-muted);
}

.inquiry-item__details {
  font-size: var(--tw-text-xs);
  color: var(--tw-text-muted);
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.inquiry-item__detail {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.inquiry-item__detail svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
  flex-shrink: 0;
}

.inquiry-item__notes {
  font-size: 12px;
  color: var(--tw-text-light);
  margin-top: 4px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.inquiry-item__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}

.inquiry-btn {
  padding: 5px 12px;
  border-radius: var(--tw-radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.inquiry-btn:active {
  transform: scale(0.97);
}

.inquiry-btn--confirm {
  background: var(--tw-primary);
  color: #fff;
}
.inquiry-btn--confirm:hover {
  background: var(--tw-primary-dark);
}

.inquiry-btn--open {
  background: var(--tw-surface);
  color: var(--tw-text);
  border: 1px solid #E2E8E4;
}
.inquiry-btn--open:hover {
  background: #E8F0EC;
}

@media (max-width: 767px) {
  .inquiry-item {
    flex-wrap: wrap;
    padding: var(--tw-space-md);
  }
  .inquiry-item__actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }
}