/* ─── Desktop layout (>= 1024px) ──────────────────── */

/* Desktop sidebar & topbar hidden by default (mobile) */
.desktop-sidebar,
.desktop-topbar {
  display: none;
}

/* ─── Tablet transitional (768-1023px) ────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .page {
    max-width: 680px;
  }
}

/* ─── Desktop ─────────────────────────────────────── */
@media (min-width: 1024px) {

  /* Hide bottom nav on desktop */
  .bottom-nav {
    display: none !important;
  }

  /* Show sidebar */
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    z-index: 100;
    overflow-y: auto;
  }

  /* Show topbar */
  .desktop-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 var(--space-6);
    z-index: 99;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }

  /* Adjust main content area */
  #app {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
  }

  .page {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: var(--space-6);
  }

  /* Auth pages: no sidebar offset */
  .page--full {
    margin-left: 0;
    max-width: 100%;
  }

  /* ─── Sidebar internals ──────────────────────────── */
  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
  }

  .sidebar-logo__text {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.5px;
  }

  .sidebar-nav-items {
    flex: 1;
    padding: var(--space-3) 0;
    overflow-y: auto;
  }

  .sidebar-nav__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    min-height: 44px;
  }

  .sidebar-nav__item:hover {
    background: var(--color-surface-2);
    color: var(--color-text);
  }

  .sidebar-nav__item.active {
    color: var(--color-primary);
    background: rgba(22, 163, 74, 0.08);
    border-left-color: var(--color-primary);
    font-weight: 600;
  }

  .sidebar-nav__item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .sidebar-separator {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-2) var(--space-5);
  }

  .sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
  }

  .sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
  }

  .sidebar-user__avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
  }

  .sidebar-user__name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-user__role {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
  }

  /* ─── Topbar internals ───────────────────────────── */
  .topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  .topbar-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  .topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: background 0.15s;
  }

  .topbar-user:hover {
    background: var(--color-surface-2);
  }

  .topbar-user__avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: #fff;
  }

  .topbar-user__name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
  }

  /* ─── Multi-column grids on desktop ──────────────── */
  .grid-3-desktop {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
  }

  /* ─── Cards: light theme shadow on desktop ───────── */
  [data-theme="light"] .card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  }

  /* ─── Auth pages on desktop ──────────────────────── */
  .auth-container {
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: var(--space-8);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
}

/* ─── Theme toggle button ─────────────────────────── */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  color: var(--color-text-muted);
  padding: 0;
}

.theme-toggle-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.theme-toggle-btn:active {
  transform: scale(0.93);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
}

/* ─── Theme switch (for perfil page) ──────────────── */
.theme-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
}

.theme-switch-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
  font-weight: 500;
}

.theme-switch-label svg {
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
}

.theme-switch {
  position: relative;
  width: 52px;
  height: 28px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch__slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background 0.2s;
}

.theme-switch__slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: var(--color-text);
  border-radius: 50%;
  transition: transform 0.2s;
}

.theme-switch input:checked + .theme-switch__slider {
  background: var(--color-primary);
}

.theme-switch input:checked + .theme-switch__slider::before {
  transform: translateX(24px);
  background: #fff;
}
