/* ============================================
   TaxCoin - Layout: Sidebar, Main, Responsive
   ============================================ */

/* --- App Shell --- */
.app {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: 240px;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand .logo svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.sidebar-brand h1 {
  font-size: 1.125rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.sidebar-nav .nav-section {
  margin-bottom: 0.5rem;
}

.sidebar-nav .nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 0.75rem 0.75rem 0.375rem;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  border-radius: 8px;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-nav .nav-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.sidebar-nav .nav-item.active {
  background: var(--color-sidebar-active);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar-nav .nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav .nav-item .badge {
  margin-left: auto;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.sidebar-footer .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-footer .user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
}

.sidebar-footer .user-email {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer .footer-actions {
  display: flex;
  gap: 0.375rem;
}

.sidebar-footer .footer-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.sidebar-footer .footer-actions button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.sidebar-footer .footer-actions button svg {
  width: 16px;
  height: 16px;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.main-header .header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.main-header .mobile-toggle {
  display: none;
  padding: 0.375rem;
  border-radius: 6px;
  color: var(--color-text-secondary);
}

.main-header .mobile-toggle:hover {
  background: var(--color-surface-hover);
}

.main-header .mobile-toggle svg {
  width: 20px;
  height: 20px;
}

.main-header .page-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.main-header .header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.main-body {
  padding: 1.5rem;
}

/* --- Auth View --- */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: var(--color-bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.auth-card .auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card .auth-logo .logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.auth-card .auth-logo .logo svg {
  width: 26px;
  height: 26px;
  color: #fff;
}

.auth-card .auth-logo h1 {
  font-size: 1.375rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card .auth-logo p {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* --- View Sections --- */
.view-section {
  display: none;
}

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

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-header .page-header-left h2 {
  margin-bottom: 0.25rem;
}

.page-header .page-header-left p {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

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

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

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

  .main-header .mobile-toggle {
    display: flex;
  }

  .main-body {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .main-body {
    padding: 0.75rem;
  }

  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.125rem; }
}

/* --- Sidebar Overlay (Mobile) --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 90;
}

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