/* Sidebar, page layout, header, footer and responsive rules */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform 0.3s ease, width 0.3s ease;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
  padding: 1.4rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sidebar-brand .logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1a2b2b;
  font-size: 1.1rem;
}

.sidebar-brand h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.sidebar-brand span {
  font-size: 0.7rem;
  opacity: 0.7;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--sidebar-text);
  border-radius: 8px;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-nav a .nav-icon {
  width: 22px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .user-info {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  opacity: 0.9;
}

.theme-toggle-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Main content area */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.top-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.top-bar h1 {
  font-size: 1.2rem;
}

.page-body {
  flex: 1;
  padding: 1.5rem;
}

.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  background: var(--primary);
  color: #fff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 1.3rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
}

/* Auth pages layout (no sidebar) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #0d5c60 100%);
}

.auth-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 420px;
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 0.35rem;
  color: var(--primary);
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Landing page without shell */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-header {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-header .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
}

.landing-header .brand .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a2b2b;
}

.landing-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background: linear-gradient(160deg, var(--bg) 0%, rgba(13, 115, 119, 0.08) 100%);
}

.hero-content {
  max-width: 640px;
  text-align: center;
}

.hero-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

[data-theme="dark"] .hero-content h1 {
  color: var(--primary-light);
}

.hero-content p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

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

  /* Hover open on mobile when toggle is hovered or sidebar hovered */
  .sidebar:hover,
  .sidebar-toggle:hover + .sidebar-overlay + .sidebar,
  .sidebar-toggle:focus + .sidebar-overlay + .sidebar {
    transform: translateX(0);
  }
}

@media (max-width: 600px) {
  .page-body {
    padding: 1rem;
  }

  .top-bar {
    padding: 0.7rem 1rem;
  }

  .top-bar h1 {
    font-size: 1rem;
  }

  .auth-card {
    padding: 1.5rem;
  }
}
