﻿/* ==================== Page Wrapper for Sidebar Slide Effect ==================== */
/* This wrapper contains all page content and slides right when sidebar opens */
#pageWrapper {
  position: relative;
  width: 100%;
  min-height: 100vh; /* Ensure it's at least viewport height */
  display: block; /* Changed from flex to block for normal document flow */
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  transform: translateX(0);
  /* Add safe area to header height spacing */
  padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  box-sizing: border-box;
  overflow-x: hidden;
  /* Removed overflow-y: auto - let body handle scrolling */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Copilot-style page slide effect - when sidebar is open, shift entire page right */
body.sidebar-open #pageWrapper {
  transform: translateX(var(--sidebar-width, 280px));
}

/* Spacer removed */

/* ==================== Notification Banner (Fixed Position) ==================== */
/* Android-style notification at top center */
.notification-banner {
  position: fixed !important;
  top: -100px !important;
  bottom: auto !important;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  max-width: 90vw;
  transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification-banner.active {
  top: 20px !important;
  pointer-events: auto;
}

.notification-content {
  background: rgba(0, 0, 0, 0.9); /* Increased opacity from 0.75 to 0.9 */
  color: #fff;
  padding: 14px 28px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid #073165;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

[data-theme="light"] .notification-content {
  background: rgba(255, 255, 255, 0.85);
  color: #000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.notification-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Ensure html/body don't have fixed height that conflicts */
html {
  height: auto;
  min-height: 100%;
}

/* Optional helper to scale the frame down on small viewports while keeping aspect ratio.
   To enable, add the class 'scale-to-fit' to the page-frame and set --page-scale via JS.
*/
body.use-page-frame .page-frame.scale-to-fit {
  transform-origin: top left;
  transform: scale(var(--page-scale, 1));
}

/* Safe area support for PWA */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--border);
  z-index: 1000;
  padding: 8px 0; /* Increased from 6px for better spacing */
  /* Add safe area inset for notch */
  padding-top: env(safe-area-inset-top, 0px);
  /* Use specific transitions to prevent "flying" on load */
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease, height 0.3s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  /* Adjust height to include safe area if needed, though usually padding handles it.
     We use min-height or automatic height with box-sizing */
  height: auto;
  min-height: calc(48px + env(safe-area-inset-top, 0px)); /* compact desktop + safe area */
  will-change: transform;
}

/* Slide navbar right when sidebar is open */
body.sidebar-open nav {
  transform: translateX(var(--sidebar-width, 280px));
}

nav.scrolled {
  box-shadow: 0 5px 30px var(--accent-glow);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start; /* left pack logo + links */
  align-items: center; /* vertically center all items */
  padding: 0 20px;
  gap: 10px;
  flex-wrap: nowrap; /* prevent wrapping that causes upward movement */
  height: 48px; /* Fixed height for content inside nav */
  /* overflow: hidden; REMOVED to allow search dropdown to show */
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 700;
  /* Gold Metallic Shine for both themes */
  background: linear-gradient(135deg, 
    #ffd700, #ffed4e, #ffb700, #ffc800, 
    #ffdf00, #fff44f, #ffa500, #ffb347
  );
  background-size: 200% 200%;
  animation: goldShine 3s ease-in-out infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  flex-shrink: 0;
  order: 1; /* leftmost */
  transition: filter 0.3s ease;
  /* Gold glow shadow for visible shine */
  filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.4))
          drop-shadow(0 0 8px rgba(255, 215, 0, 0.3))
          drop-shadow(0 0 12px rgba(255, 165, 0, 0.2));
}

/* Gold shimmer animation */
@keyframes goldShine {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Hover effect - glow only */
.nav-logo:hover {
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.8)) 
          drop-shadow(0 0 20px rgba(147, 51, 234, 0.6))
          drop-shadow(0 0 30px rgba(59, 130, 246, 0.4));
}

/* Active/Click effect - reload animation */
.nav-logo:active,
.nav-logo.clicked {
  animation: reloadSpin 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform: scale(0.7) translateZ(-80px) rotateY(360deg);
}

/* Reload spin animation */
@keyframes reloadSpin {
  0% {
    transform: scale(1) translateZ(0) rotateY(0deg);
  }
  50% {
    transform: scale(0.6) translateZ(-100px) rotateY(180deg);
    filter: brightness(1.5) blur(1px);
  }
  100% {
    transform: scale(1) translateZ(0) rotateY(360deg);
  }
}

.nav-logo strong,
.nav-logo i {
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: italic;
  display: inline-block;
  transition: transform 0.4s ease;
}

.nav-links {
  display: flex;
  gap: 15px; /* Reduced from 20px for tighter spacing */
  align-items: center;
  list-style: none;
  flex: 0 0 auto; /* don't stretch, keep left-aligned */
  justify-content: flex-start;
  order: 2; /* after logo */
}

/* Desktop search goes to the right */
.desktop-search {
  display: flex; /* Always visible, JS controls icon-mode */
  order: 3;
  margin-left: auto; /* push to right */
  flex-shrink: 1; /* allow shrinking when space is tight */
  min-width: 40px; /* minimum width when in icon mode */
  max-width: 280px; /* maximum width for search box */
  align-items: center;
  justify-content: flex-end; /* Ensure icon stays far right */
  transition: all 0.3s ease;
}

/* When in icon mode, ensure icon is far right */
.desktop-search.icon-mode {
  max-width: 40px;
  min-width: 40px;
  flex-shrink: 0;
}

/* Theme toggle comes after search */
.theme-toggle {
  order: 4;
  margin-left: 8px; /* small gap after search */
  flex-shrink: 0;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  padding: 4px 0;
  font-size: 0.95rem;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a:hover {
  color: var(--accent);
}

/* Active navigation link styles */
.nav-links a.active {
  color: var(--accent);
  font-weight: 700;
  text-shadow: 0 0 8px var(--accent-glow);
}

.nav-links a.active::after {
  width: 100%;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ==================== ALL OLD SCATTERED MEDIA QUERIES REMOVED - NOW CONSOLIDATED AT END OF FILE ==================== */

/* Theme Toggle - Default (Mobile): Circular button */
.theme-toggle {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--border);
    box-sizing: border-box;
    padding: 2px; /* Symmetric padding for perfect centering */
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center; /* Center icon horizontally */
    gap: 8px;
    font-weight: 600;
    user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: visible;
    height: 40px;
    min-height: 40px;
    line-height: normal; /* Prevent text from affecting vertical position */
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(1.05);
}

.theme-toggle:active,
.theme-toggle:focus-visible {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(0.95);
  outline: none;
}

.theme-icon {
  width: 36px; /* Maximized icon size */
  height: 36px; /* Maximized icon size */
  object-fit: cover; /* Changed from contain to eliminate transparent padding */
  object-position: center; /* Ensure icon is centered */
  transition: transform 0.3s ease;
  display: block;
  flex-shrink: 0;
  margin: 0 auto; /* Center horizontally within flex container */
  transform: translateX(3px); /* Increased to 3px for better centering */
}

.theme-toggle:hover .theme-icon {
  transform: translateX(3px) rotate(20deg); /* Maintain centering while rotating */
}

.theme-text {
  display: none; /* Hidden on mobile by default */
}

/* Settings Toggle Button - Matches Theme Toggle */
.settings-toggle {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--border);
    box-sizing: border-box;
    padding: 2px 10px; /* Minimal padding - just small gap */
    border-radius: 50px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none; /* Hidden by default, shown on desktop via responsive.css */
    align-items: center;
    gap: 8px;
    font-weight: 600;
    user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: visible;
    height: 40px;
    min-height: 40px;
    line-height: normal; /* Prevent text from affecting vertical position */
}

.settings-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(1.05);
}

.settings-toggle:active,
.settings-toggle:focus-visible {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(0.95);
    outline: none;
}

.settings-icon {
    width: 32px; /* Maximized icon size */
    height: 32px; /* Maximized icon size */
    object-fit: contain;
    transition: transform 0.3s ease;
    display: block; /* Prevent inline spacing issues */
}

.settings-toggle:hover .settings-icon {
    transform: rotate(90deg); /* Gear rotation on hover */
}

.settings-text {
    display: none; /* Hidden on mobile by default */
}

