/* ============================================================
   Hub Design System - Layout
   Dashboard Grid, Sidebar, Header, App Grid, Bottom Nav
   ============================================================ */

/* ── Dashboard Root Layout ── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  width: 100%;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background-color: var(--pt-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--pt-sidebar-border);
  transition: background-color var(--pt-transition-normal), border-color var(--pt-transition-normal);
}

/* ── Logo ── */
.sidebar__logo {
  padding: 24px;
  border-bottom: 1px solid var(--pt-sidebar-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar__logo-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}
.sidebar__logo-icon img, .sidebar__logo-icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar__logo-text {
  font-family: var(--pt-font-heading);
  font-weight: 700;
  font-size: 18px;
  color: var(--pt-sidebar-text);
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.sidebar__logo-subtitle {
  font-family: var(--pt-font-body);
  font-weight: 400;
  font-size: 12px;
  color: var(--pt-sidebar-muted);
  margin-top: 4px;
}

/* ── Navigation ── */
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  flex: 1;
}

.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--pt-radius-md);
  color: var(--pt-sidebar-muted);
  cursor: pointer;
  transition: color var(--pt-transition-fast), background-color var(--pt-transition-fast);
  font-family: var(--pt-font-body);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar__nav-item:hover {
  background-color: var(--pt-sidebar-hover);
}

.sidebar__nav-item--active {
  background-color: var(--pt-sidebar-active-bg);
  color: var(--pt-accent-red);
  font-weight: 500;
}

.sidebar__nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── Footer ── */
.sidebar__footer {
  padding: 16px;
  border-top: 1px solid var(--pt-sidebar-border);
  font-family: var(--pt-font-body);
  font-size: 12px;
  color: var(--pt-sidebar-muted);
  flex-shrink: 0;
}

.sidebar__footer-version {
  font-family: var(--pt-font-mono);
  font-size: 11px;
  color: var(--pt-outline-variant);
  margin-bottom: 4px;
}

.sidebar__footer-copy {
  font-size: 11px;
  color: var(--pt-outline-variant);
}

/* Language toggle (sidebar) */
.sidebar__lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-bottom: 12px;
  border-radius: var(--pt-radius-sm);
  border: 1px solid var(--pt-sidebar-border);
  background: transparent;
  color: var(--pt-sidebar-muted);
  font-family: var(--pt-font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--pt-transition-fast), border-color var(--pt-transition-fast);
}
.sidebar__lang:hover {
  color: var(--pt-accent-red);
  border-color: var(--pt-accent-red);
}
.sidebar__lang svg { width: 14px; height: 14px; }

/* Language toggle (header, text pill) */
.theme-toggle--lang {
  font-family: var(--pt-font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ── Mobile Logo ── */
.header__mobile-logo {
  display: none;
  width: 40px;
  height: 40px;
}
.header__mobile-logo img, .header__mobile-logo svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ============================================================
   Main Content Area
   ============================================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  min-height: 100vh;
  grid-column: 2;
  background-color: var(--pt-bg);
  transition: background-color var(--pt-transition-normal);
}

/* ============================================================
   Header
   ============================================================ */
.header {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.header__top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* ── Greeting ── */
.header__greeting {
  display: flex;
  flex-direction: column;
}

.header__greeting-name {
  font-family: var(--pt-font-heading);
  font-weight: 700;
  font-size: 24px;
  color: var(--pt-on-surface);
  line-height: 1.2;
}

.header__greeting-date {
  font-family: var(--pt-font-body);
  font-weight: 400;
  font-size: 14px;
  color: var(--pt-outline);
  margin-top: 4px;
}

/* ── Header Actions (status + theme toggle) ── */
.header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Status Summary ── */
.header__status-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--pt-surface-container);
  padding: 8px 16px;
  border-radius: 20px;
  transition: background-color var(--pt-transition-normal);
}

.header__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--pt-success);
  flex-shrink: 0;
}

.header__status-text {
  font-family: var(--pt-font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--pt-on-surface-variant);
}

/* ── Theme Toggle ── */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--pt-radius-md);
  border: 1px solid var(--pt-border-dark);
  background-color: var(--pt-surface-container);
  color: var(--pt-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--pt-transition-fast), border-color var(--pt-transition-fast), color var(--pt-transition-fast);
  padding: 0;
}

.theme-toggle:hover {
  background-color: var(--pt-surface-container-high);
  border-color: var(--pt-accent-red);
  color: var(--pt-accent-red);
}

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

.theme-toggle__icon--sun {
  display: none;
}

.theme-toggle__icon--moon {
  display: block;
}

[data-theme="light"] .theme-toggle__icon--sun {
  display: block;
}

[data-theme="light"] .theme-toggle__icon--moon {
  display: none;
}

/* ── Search ── */
.header__search-wrapper {
  position: relative;
  max-width: 480px;
  width: 100%;
}

.header__search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background-color: var(--pt-surface-container);
  border: 1px solid var(--pt-border-dark);
  border-radius: var(--pt-radius-md);
  color: var(--pt-on-surface);
  font-family: var(--pt-font-body);
  font-size: 14px;
  transition: border-color var(--pt-transition-fast), background-color var(--pt-transition-normal);
}

.header__search-input::placeholder {
  color: var(--pt-outline);
}

.header__search-input:focus {
  border-color: var(--pt-accent-red);
  outline: none;
}

.header__search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pt-outline);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* ============================================================
   App Grid
   ============================================================ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 32px 32px;
}

/* ============================================================
   Bottom Navigation (Mobile)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--pt-bottomnav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--pt-border-dark);
  display: none;
  justify-content: space-around;
  align-items: center;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background-color var(--pt-transition-normal), border-color var(--pt-transition-normal);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--pt-outline);
  cursor: pointer;
  transition: color var(--pt-transition-fast);
  background: none;
  border: none;
  text-decoration: none;
}

.bottom-nav__item--active {
  color: var(--pt-accent-red);
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav__label {
  font-family: var(--pt-font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================
   Responsive Breakpoints
   ============================================================ */

/* ── Mobile: max-width 768px ── */
@media (max-width: 768px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    grid-column: 1;
    padding-bottom: 80px;
  }

  .header {
    padding: 16px;
  }

  .header__mobile-logo {
    display: block;
    flex-shrink: 0;
  }

  .header__greeting-name {
    font-size: 20px;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 0 16px 16px;
  }

  .bottom-nav {
    display: flex;
  }
}

/* ── Tablet: 769px - 1024px ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    grid-column: 1;
    padding-bottom: 80px;
  }

  .header__mobile-logo {
    display: block;
    flex-shrink: 0;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }

  .bottom-nav {
    display: flex;
  }
}

/* ── Desktop: min-width 1025px ── */
@media (min-width: 1025px) {
  .sidebar {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }
}
