/*
  ========================================
  Aman Pandey | Futuristic Portfolio CSS v5.1 (Final Optimized)
  ========================================
*/

/* ========== :ROOT & THEME VARIABLES ========== */
:root {
  /* Custom viewport units for mobile fix */
  --vh: 1vh;
  --vw: 1vw;
  
  --primary-hue: 221;
  --primary-glow: hsl(var(--primary-hue), 100%, 70%);
  --primary: hsl(var(--primary-hue), 98%, 55%);
  --secondary: hsl(var(--primary-hue), 90%, 65%);
  
  --bg-light: #f4f7fc;
  --surface-light: rgba(255, 255, 255, 0.7);
  --text-light: #111827;
  --text-muted-light: #6b7280;

  --bg-dark: #0d1117; 
  --surface-dark: rgba(22, 27, 34, 0.7);
  --border-dark: rgba(255, 255, 255, 0.1);
  --text-dark: #e6edf3;
  --text-muted-dark: #8b949e;
  
  --radius: 1.25rem;
  --transition: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========== BASE & SETUP ========== */
*, *::before, *::after { 
    box-sizing: border-box !important; 
}

html { 
    scroll-behavior: smooth; 
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    -webkit-text-size-adjust: 100% !important;
    -moz-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* Fix mobile scroll behavior issues */
@media screen and (max-width: 991px) {
    html {
        scroll-behavior: auto !important; /* Disable smooth scroll on mobile to prevent jump issues */
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Ensure no elements interfere with natural scrolling */
    body {
        scroll-behavior: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    
    /* Disable any potential scroll snap on mobile */
    * {
        scroll-snap-type: none !important;
        scroll-behavior: auto !important;
    }
    
    /* Prevent any elements from affecting scroll position */
    .navbar-hidden {
        transform: none !important; /* Disable navbar hiding on mobile */
    }
}

body {
    font-family: 'Rubik', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-light);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden !important;
    cursor: none;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-height: 100vh;
    position: relative;
}

/* CRITICAL MOBILE SCALING FIXES */
@media screen and (max-width: 991px) {
    html {
        font-size: 14px !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 320px !important;
    }
    
    body {
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 320px !important;
        cursor: auto !important;
        overflow-x: hidden !important;
        /* Prevent momentum scrolling issues on mobile */
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: none !important;
        /* Prevent scroll bounce on iOS */
        position: relative !important;
    }
    
    /* Force all elements to respect viewport */
    * {
        max-width: 100vw !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Enhanced button styling for mobile */
    .btn {
        touch-action: manipulation !important;
        user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
        min-height: 44px !important;
        padding: 12px 20px !important;
        font-size: 14px !important;
        position: relative !important;
        z-index: 1 !important;
        pointer-events: auto !important;
        border-radius: 8px !important;
        transition: all 0.2s ease !important;
    }
    
    /* Contact method cards mobile optimization */
    .contact-method-card {
        touch-action: manipulation !important;
        user-select: none !important;
        margin-bottom: 15px !important;
    }
    
    .contact-method-card .btn {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
        padding: 14px 20px !important;
        position: relative !important;
        z-index: 10 !important;
        pointer-events: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    
    /* Offcanvas mobile enhancements */
    .offcanvas {
        touch-action: manipulation !important;
        width: min(320px, 85vw) !important;
        max-width: 85vw !important;
    }
    
    .btn-close {
        touch-action: manipulation !important;
        user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        border-radius: 50% !important;
        position: relative !important;
        z-index: 1060 !important;
        pointer-events: auto !important;
        background: rgba(0, 0, 0, 0.1) !important;
        border: 2px solid rgba(0, 0, 0, 0.1) !important;
        font-size: 1.8rem !important;
        line-height: 1 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
    }
    
    .btn-close:hover,
    .btn-close:focus,
    .btn-close:active {
        background: rgba(0, 0, 0, 0.2) !important;
        border-color: rgba(0, 0, 0, 0.3) !important;
        transform: scale(1.05) !important;
    }
    
    /* Navbar toggler enhancement */
    .navbar-toggler {
        touch-action: manipulation !important;
        user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
        min-width: 48px !important;
        min-height: 48px !important;
        padding: 8px !important;
        border-radius: 8px !important;
        position: relative !important;
        z-index: 1000 !important;
        pointer-events: auto !important;
    }
}

/* CRITICAL CONTAINER AND GRID FIXES */
.container,
.container-fluid {
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    width: 100% !important;
}

.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

[class*="col-"] {
    padding-left: 12px !important;
    padding-right: 12px !important;
    max-width: 100% !important;
    min-width: 0 !important;
    word-wrap: break-word !important;
}

/* REMOVE HORIZONTAL SCROLLBAR ON MOBILE */
@media screen and (max-width: 991px) {
    .container,
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    [class*="col-"] {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }
    
    .row {
        margin-left: -5px !important;
        margin-right: -5px !important;
    }
    
    /* Hide any elements that might cause horizontal scroll */
    .floating-shapes,
    .music-visualizer {
        display: none !important;
    }
}

/* Custom Scrollbar - Remove duplicates and enhance main scrollbar */
html, body {
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-hue), 80%, 60%, 0.8) transparent;
}

/* Hide any duplicate scrollbars */
.container, .container-fluid, .row, [class*="col-"] {
    overflow-x: visible !important;
}

/* Main scrollbar styling with acrylic effect */
::-webkit-scrollbar { 
    width: 8px; 
    height: 8px;
}

::-webkit-scrollbar-track { 
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, 
        rgba(var(--primary-hue), 80%, 60%, 0.8),
        rgba(var(--primary-hue), 70%, 70%, 0.6)
    );
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, 
        rgba(var(--primary-hue), 80%, 70%, 1),
        rgba(var(--primary-hue), 70%, 80%, 0.8)
    );
}

/* ========== CUSTOM CURSOR ========== */
.cursor-dot, .cursor-outline {
  position: fixed;
  top: 0; left: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
}
.cursor-dot {
  width: 8px; height: 8px;
  background-color: white;
}
.cursor-outline {
  width: 40px; height: 40px;
  border: 2px solid white;
  transition: transform 0.2s ease-out, width 0.3s ease-out, height 0.3s ease-out, border-color 0.3s ease, background-color 0.3s ease;
  will-change: transform, width, height;
}
body.cursor-link-hover .cursor-outline {
  transform: scale(1.5);
  border-color: var(--primary-glow);
  background-color: hsla(var(--primary-hue), 100%, 70%, 0.2);
}

/* ========== FLOATING SHAPES ========== */
.floating-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary-glow), var(--secondary));
  opacity: 0.1;
  animation: float-shapes 20s ease-in-out infinite;
}

.shape-1 {
  width: 80px;
  height: 80px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 120px;
  height: 120px;
  top: 20%;
  right: 20%;
  animation-delay: -5s;
}

.shape-3 {
  width: 60px;
  height: 60px;
  bottom: 30%;
  left: 15%;
  animation-delay: -10s;
}

.shape-4 {
  width: 100px;
  height: 100px;
  bottom: 20%;
  right: 10%;
  animation-delay: -15s;
}

.shape-5 {
  width: 140px;
  height: 140px;
  top: 50%;
  left: 50%;
  animation-delay: -7s;
}

.shape-6 {
  width: 70px;
  height: 70px;
  top: 80%;
  right: 40%;
  animation-delay: -12s;
}

/* ========== MUSIC VISUALIZER ========== */
.music-visualizer {
  position: fixed;
  bottom: 30px;
  left: 30px;
  display: flex;
  align-items: end;
  gap: 3px;
  z-index: 100;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.music-visualizer:hover {
  opacity: 1;
}

.music-visualizer .bar {
  width: 3px;
  height: 4px;
  background: linear-gradient(to top, var(--primary), var(--secondary));
  border-radius: 2px;
  animation: music-bar 1s ease-in-out infinite;
}

.music-visualizer .bar:nth-child(1) { animation-delay: 0s; }
.music-visualizer .bar:nth-child(2) { animation-delay: 0.1s; }
.music-visualizer .bar:nth-child(3) { animation-delay: 0.2s; }
.music-visualizer .bar:nth-child(4) { animation-delay: 0.3s; }
.music-visualizer .bar:nth-child(5) { animation-delay: 0.4s; }
.music-visualizer .bar:nth-child(6) { animation-delay: 0.5s; }
.music-visualizer .bar:nth-child(7) { animation-delay: 0.6s; }
.music-visualizer .bar:nth-child(8) { animation-delay: 0.7s; }

/* ========== ANIMATION KEYFRAMES ========== */
@keyframes subtle-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes cursor-blink { 50% { opacity: 0; } }
@keyframes preloader-anim { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-30px); } }
@keyframes gradient-border-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rainbow-shift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
  50% { box-shadow: 0 0 40px var(--primary-glow), 0 0 60px var(--primary-glow); }
}
@keyframes float-shapes {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-20px) rotate(120deg); }
  66% { transform: translateY(10px) rotate(240deg); }
}
@keyframes music-bar {
  0%, 100% { height: 4px; }
  50% { height: 20px; }
}
@keyframes text-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes ripple-effect {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}
@keyframes typing-indicator {
  0%, 60%, 100% { transform: scale(1); opacity: 0.3; }
  30% { transform: scale(1.2); opacity: 1; }
}
@keyframes progress-load {
  from { width: 0; }
  to { width: var(--target-width); }
}

/* ========== GLOBAL & HELPER CLASSES ========== */
.gradient-text { background: linear-gradient(90deg, var(--primary), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-primary { color: var(--primary) !important; }
/* ========== OPTIMIZED BACKGROUND BLUR SYSTEM ========== */
/* Lightweight background blur overlay - toggleable */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(var(--primary-hue), 60%, 95%, 0.08) 0%,
    rgba(270, 60%, 95%, 0.05) 50%,
    rgba(var(--primary-hue), 60%, 95%, 0.08) 100%
  );
  backdrop-filter: blur(1px) saturate(1.1);
  -webkit-backdrop-filter: blur(1px) saturate(1.1);
  z-index: -10;
  pointer-events: none;
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Enhanced background blur when enabled via toggle */
body.background-blur-enabled::before {
  opacity: 1;
  backdrop-filter: blur(8px) saturate(1.4) brightness(1.02);
  -webkit-backdrop-filter: blur(8px) saturate(1.4) brightness(1.02);
}

/* Additional subtle effects when blur is enabled */
body.background-blur-enabled::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 30% 30%, rgba(var(--primary-hue), 80%, 70%, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 70% 70%, rgba(270, 80%, 70%, 0.05) 0%, transparent 60%);
  z-index: -9;
  pointer-events: none;
  animation: backgroundFloat 25s ease-in-out infinite;
}

@keyframes backgroundFloat {
  0%, 100% { 
    transform: translateY(0px) scale(1);
    opacity: 0.7;
  }
  50% { 
    transform: translateY(-10px) scale(1.01);
    opacity: 1;
  }
}

/* Dark mode background blur */
body.dark-mode::before {
  background: linear-gradient(135deg,
    rgba(var(--primary-hue), 40%, 20%, 0.08) 0%,
    rgba(270, 40%, 20%, 0.05) 50%,
    rgba(var(--primary-hue), 40%, 20%, 0.08) 100%
  );
}

body.dark-mode.background-blur-enabled::before {
  backdrop-filter: blur(10px) saturate(1.5) brightness(0.95);
  -webkit-backdrop-filter: blur(10px) saturate(1.5) brightness(0.95);
}

body.dark-mode.background-blur-enabled::after {
  background: 
    radial-gradient(circle at 30% 30%, rgba(var(--primary-hue), 80%, 40%, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 70% 70%, rgba(270, 80%, 40%, 0.05) 0%, transparent 60%);
}
/* Optimized acrylic glassmorphism with lighter effects */
.glassmorphism {
  background: linear-gradient(145deg, 
    rgba(var(--primary-hue), 70%, 95%, 0.25), 
    rgba(270, 70%, 95%, 0.15),
    rgba(var(--primary-hue), 70%, 95%, 0.20)
  );
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(var(--primary-hue), 60%, 85%, 0.25);
  box-shadow: 
    0 8px 25px rgba(var(--primary-hue), 70%, 80%, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.glassmorphism::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--primary-hue), 80%, 85%, 0.1),
    transparent
  );
  transition: left 0.8s ease;
  pointer-events: none;
  z-index: 0;
}

.glassmorphism:hover {
  backdrop-filter: blur(25px) saturate(1.6);
  -webkit-backdrop-filter: blur(25px) saturate(1.6);
  box-shadow: 
    0 12px 35px rgba(var(--primary-hue), 70%, 80%, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.glassmorphism:hover::before {
  left: 100%;
}

.glassmorphism > * {
  position: relative;
  z-index: 1;
}

/* Optimized acrylic glass card effects */
.glass-card {
  background: linear-gradient(135deg, 
    rgba(var(--primary-hue), 70%, 95%, 0.35), 
    rgba(270, 70%, 95%, 0.25),
    rgba(var(--primary-hue), 70%, 95%, 0.30)
  );
  backdrop-filter: blur(25px) saturate(1.5);
  -webkit-backdrop-filter: blur(25px) saturate(1.5);
  border: 1px solid rgba(var(--primary-hue), 60%, 85%, 0.3);
  border-radius: 20px;
  box-shadow: 
    0 12px 35px rgba(var(--primary-hue), 70%, 80%, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.glass-card::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg,
    rgba(var(--primary-hue), 80%, 70%, 0.3),
    transparent 30%,
    transparent 70%,
    rgba(var(--primary-hue), 80%, 70%, 0.3)
  );
  border-radius: 22px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-8px) scale(1.02);
  backdrop-filter: blur(50px) saturate(2) brightness(1.2);
  -webkit-backdrop-filter: blur(50px) saturate(2) brightness(1.2);
  box-shadow: 
    0 24px 70px rgba(0, 0, 0, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(var(--primary-hue), 80%, 70%, 0.2);
}

.glass-card:hover::after {
  opacity: 1;
}

/* Enhanced gradient backgrounds */
.gradient-bg {
  background: linear-gradient(135deg, 
    rgba(var(--primary-hue), 80%, 60%, 0.1),
    rgba(var(--primary-hue), 70%, 50%, 0.05),
    rgba(270, 80%, 60%, 0.1)
  );
  position: relative;
}

.gradient-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg,
    rgba(var(--primary-hue), 100%, 80%, 0.05) 0%,
    transparent 50%,
    rgba(270, 100%, 80%, 0.05) 100%
  );
  pointer-events: none;
}
.bg-light { background-color: var(--bg-light) !important; transition: background-color .3s ease; }
.section-heading {
  font-size: clamp(2rem, 5vw, 2.8rem); font-weight: bold;
  position: relative; padding-bottom: 0.5rem; margin-bottom: 1rem;
  color: var(--text-light);
}
.section-heading::after {
  content: ''; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%); width: 0; height: 4px;
  border-radius: 2px; background: var(--primary);
  transition: width 0.5s ease-in-out;
}
[data-aos="fade-up"].aos-animate .section-heading::after {
  width: 60px;
}


/* ========== PRELOADER ========== */
#preloader { 
  position: fixed; 
  inset: 0; 
  z-index: 9999; 
  background: linear-gradient(135deg, var(--bg-light), var(--surface-light)); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  flex-direction: column;
  transition: opacity 0.5s ease, background-color .3s ease; 
}
#preloader.fade-out { opacity: 0; pointer-events: none; }
.preloader-box { width: 65px; display: flex; flex-wrap: wrap; justify-content: space-between; margin-bottom: 20px; }
.preloader-box div { 
  height: 15px; 
  width: 15px; 
  background: linear-gradient(45deg, var(--primary), var(--secondary));
  border-radius: 50%; 
  animation: preloader-anim 1s ease infinite; 
  box-shadow: 0 0 20px var(--primary-glow);
}
.preloader-box div:nth-child(2) { animation-delay: 0.1s; }
.preloader-box div:nth-child(3) { animation-delay: 0.2s; }
.preloader-text {
  color: var(--text-light);
  font-weight: 600;
  font-size: 1.1rem;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-shimmer 2s ease-in-out infinite;
}

/* ========== NAVBAR ========== */
/* ========== OPTIMIZED NAVBAR EFFECTS ========== */
#navbar { 
  padding: 0.75rem 0; 
  border: 0; 
  transform: translateY(0);
  background: linear-gradient(135deg,
    rgba(var(--primary-hue), 70%, 95%, 0.65) 0%,
    rgba(270, 70%, 95%, 0.55) 100%
  ) !important;
  backdrop-filter: blur(15px) saturate(1.4);
  -webkit-backdrop-filter: blur(15px) saturate(1.4);
  border-bottom: 1px solid rgba(var(--primary-hue), 60%, 85%, 0.25);
  box-shadow: 
    0 4px 20px rgba(var(--primary-hue), 70%, 80%, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  z-index: 1050 !important; /* Ensure navbar stays above everything */
}

/* Dropdown menus need higher z-index than navbar */
.navbar .dropdown-menu {
  z-index: 1060 !important;
  position: absolute !important;
}

/* All dropdown menus should be above other content */
.dropdown-menu {
  z-index: 1060 !important;
  background: var(--surface-light) !important;
  border: 1px solid rgba(var(--primary-hue), 0.1) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}

/* Ensure Bootstrap dropdown component and its children have proper stacking */
.dropdown,
.dropup,
.dropstart,
.dropend {
  position: relative !important;
}

.dropdown .dropdown-menu,
.dropup .dropdown-menu,
.dropstart .dropdown-menu,
.dropend .dropdown-menu {
  z-index: 1060 !important;
}

body.dark-mode .dropdown-menu {
  background: var(--surface-dark) !important;
  border-color: var(--border-dark) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
}

/* Dropdown items styling */
.dropdown-item {
  color: var(--text-light) !important;
  padding: 0.75rem 1rem !important;
  border-radius: 8px !important;
  margin: 0.25rem 0.5rem !important;
  transition: all 0.3s ease !important;
}

body.dark-mode .dropdown-item {
  color: var(--text-dark) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(var(--primary-hue), 78%, 56%, 0.1) !important;
  color: var(--primary) !important;
  transform: translateX(4px) !important;
}

.dropdown-item i {
  margin-right: 0.5rem !important;
  font-size: 1rem !important;
}

/* Floating Tools Button Styling */
.floating-tools-btn {
  z-index: 1040 !important;
}

.floating-tools-btn .dropdown-menu {
  z-index: 1070 !important; /* Higher than navbar dropdowns */
  min-width: 200px !important;
}

.floating-tools-btn .btn {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

.floating-tools-btn .btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2) !important;
}

#navbar.navbar-hidden { 
  transform: translateY(-100%); 
}

/* Mobile responsive navigation - no hamburger menu */
@media (max-width: 991px) {
  #navbar {
    padding: 0.5rem 0;
  }
  
  #navbar .container {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  
  .navbar-brand {
    font-size: 1.1rem;
    margin-bottom: 0;
  }
  
  .navbar-nav {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
  }
  
  .nav-link {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.9rem !important;
    margin: 0.1rem;
    white-space: nowrap;
  }
}

/* Extra small screens */
@media (max-width: 576px) {
  .navbar-nav {
    gap: 0.1rem;
  }
  
  .nav-link {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.85rem !important;
  }
  
  #realtime-clock-container {
    display: none !important;
  }
  
  /* Make navigation more compact on very small screens */
  .navbar-brand {
    font-size: 1rem;
  }
}

/* Mobile theme toggle button styling */
#mobile-theme-toggle {
  border-radius: 50px !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.9rem !important;
  transition: all 0.3s ease !important;
}

#mobile-theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--primary-hue), 78%, 56%, 0.3);
}

body.dark-mode #mobile-theme-toggle {
  border-color: var(--border-dark);
  color: var(--text-dark);
}

/* Ensure navigation links are accessible on mobile */
@media (max-width: 991px) {
  .nav-link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }
  
  .navbar-nav {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  body.dark-mode .navbar-nav {
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  }
}
.offcanvas { background-color: var(--bg-light); transition: background-color .3s ease; max-width: 80%; width: 320px;}

/* Enhanced offcanvas styling for better mobile support */
.offcanvas-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    z-index: 1040 !important;
    transition: opacity 0.3s ease !important;
}

.offcanvas-backdrop.show {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Ensure offcanvas header and body are properly styled */
.offcanvas-header {
    position: relative !important;
    padding: 1rem 1.5rem !important;
    border-bottom: 1px solid var(--border-light) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.offcanvas-body {
    padding: 1rem 1.5rem !important;
    flex-grow: 1 !important;
    overflow-y: auto !important;
}

/* Dark mode offcanvas styling */
body.dark-mode .offcanvas {
    background-color: var(--bg-dark) !important;
    border-left: 1px solid var(--border-dark) !important;
}

body.dark-mode .offcanvas-header {
    border-bottom-color: var(--border-dark) !important;
}

body.dark-mode .btn-close {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    filter: invert(1) !important;
}
.navbar-brand .fw-bold { color: var(--text-light); }
#navbar .nav-link { font-weight: 500; padding: 0.6em 1.3em; border-radius: 50px; position: relative; overflow: hidden; transition: color var(--transition); color: var(--text-light) !important; }
#navbar .nav-link::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 50px; transform: translateY(101%); transition: transform var(--transition); z-index: -1; }
#navbar .nav-link:hover, #navbar .nav-link.active { color: white !important; }
#navbar .nav-link:hover::before, #navbar .nav-link.active::before { transform: translateY(0); }

/* Real-Time Clock with Animated Border */
#realtime-clock-container {
    color: var(--text-muted-light);
    font-size: 0.9rem;
    font-family: monospace;
    cursor: default;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    position: relative;
    background: var(--surface-light);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
}

/* Mobile clock positioning fix */
@media (max-width: 991px) {
    #realtime-clock-container {
        position: static !important;
        display: none !important; /* Hide on mobile as it's in offcanvas */
    }
    
    /* Show clock in offcanvas instead */
    .offcanvas #realtime-clock-container {
        display: block !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        margin: 1rem 0;
        text-align: center;
    }
}
#realtime-clock-container::before {
    content: ''; position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: 50px;
    background: conic-gradient(from 90deg at 40% -25%, var(--primary), var(--secondary), var(--primary-glow), var(--primary));
    animation: gradient-border-spin 3s linear infinite;
    opacity: 0;
    transition: opacity var(--transition);
}
body.dark-mode #realtime-clock-container::before { opacity: 1; }
body.dark-mode #realtime-clock-container { border: 1px solid transparent; }

/* Auto theme badge styling */
.auto-theme-badge {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white !important;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
    display: inline-block;
    font-family: 'Rubik', sans-serif;
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.6);
        transform: scale(1.05);
    }
}

/* Weather Widget */
#weather-widget {
    color: var(--text-muted-light);
    font-size: 0.9rem;
    font-family: monospace;
    cursor: default;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    position: relative;
    background: var(--surface-light);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all var(--transition);
}

#weather-widget:hover {
    background: var(--primary-glow);
    color: white;
    transform: scale(1.05);
}

body.dark-mode #weather-widget {
    color: var(--text-muted-dark);
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
}

/* ========== ENHANCED SECTION BACKGROUNDS ========== */
#services {
    background: linear-gradient(135deg, 
        rgba(var(--primary-hue), 80%, 95%, 0.5),
        rgba(var(--primary-hue), 70%, 90%, 0.3),
        rgba(270, 80%, 95%, 0.5)
    );
    position: relative;
    overflow: hidden;
}

#services::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        rgba(var(--primary-hue), 100%, 80%, 0.05) 0%,
        transparent 50%,
        rgba(270, 100%, 80%, 0.05) 100%
    );
    pointer-events: none;
}

#skills {
    background: linear-gradient(135deg, 
        rgba(var(--primary-hue), 60%, 98%, 0.4),
        rgba(var(--primary-hue), 80%, 95%, 0.3)
    );
    position: relative;
}

#projects {
    background: linear-gradient(135deg, 
        rgba(270, 80%, 95%, 0.4),
        rgba(var(--primary-hue), 70%, 98%, 0.3),
        rgba(195, 80%, 95%, 0.4)
    );
    position: relative;
    overflow: hidden;
}

#projects::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 40%;
    height: 200%;
    background: linear-gradient(45deg,
        rgba(var(--primary-hue), 80%, 70%, 0.1),
        transparent
    );
    transform: rotate(15deg);
    pointer-events: none;
}

#blog {
    background: linear-gradient(135deg, 
        rgba(var(--primary-hue), 80%, 95%, 0.5),
        rgba(var(--primary-hue), 70%, 90%, 0.3),
        rgba(270, 80%, 95%, 0.5)
    );
    position: relative;
}
.hero-section { 
  position: relative; 
  overflow: hidden; 
  background-color: var(--bg-light);
  min-height: 100vh; /* Fallback */
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  align-items: center;
  padding: 6rem 0 4rem;
  z-index: 1; /* Keep hero section below navbar and dropdowns */
}
#particles-js { position: absolute; width: 100%; height: 100%; z-index: 0; }
.hero-avatar-wrap { perspective: 1000px; display: flex; justify-content: center; align-items: center;}
.hero-avatar {
  width: 280px; height: 280px; border: 4px solid white;
  animation: subtle-float 5s ease-in-out infinite;
  transform-style: preserve-3d;
  will-change: transform;
}
body.dark-mode .hero-avatar { box-shadow: 0 0 16px var(--primary-glow), 0 0 32px var(--primary), inset 0 0 8px var(--primary-glow); }
.hero-section .lead, .hero-section p, .hero-section .text-muted { color: var(--text-muted-light) !important; }
#auto-typing-animation { height: 1.2em; color: var(--text-light); font-size: 1.25rem; font-weight: 500; }
#auto-typing-animation .cursor {
    display: inline-block; background-color: var(--text-light);
    width: 4px; animation: cursor-blink 0.7s infinite; vertical-align: bottom;
}

/* ========== ABOUT & SERVICES ========== */
.about-illust {
  animation: subtle-float 4s ease-in-out infinite;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  box-shadow: 0 4px 12px var(--shadow-color); max-width: 300px; margin: auto;
  will-change: transform;
}
.about-section .lead { color: var(--text-muted-light); }
.about-section .list-inline-item i { margin-right: 0.25rem; }

.service-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15), 
        rgba(255, 255, 255, 0.06),
        rgba(255, 255, 255, 0.12)
    );
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2rem 1.5rem; 
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    height: 100%;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%,
        rgba(var(--primary-hue), 80%, 80%, 0.15),
        transparent 60%
    );
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
}

.service-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        transparent 0deg,
        rgba(var(--primary-hue), 80%, 70%, 0.1) 45deg,
        transparent 90deg,
        rgba(var(--primary-hue), 80%, 70%, 0.1) 135deg,
        transparent 180deg,
        rgba(var(--primary-hue), 80%, 70%, 0.1) 225deg,
        transparent 270deg,
        rgba(var(--primary-hue), 80%, 70%, 0.1) 315deg,
        transparent 360deg
    );
    animation: serviceCardRotate 20s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-card:hover::before {
    opacity: 1;
}

.service-card:hover::after {
    opacity: 1;
}

@keyframes serviceCardRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.service-card:hover { 
    transform: translateY(-8px) scale(1.02); 
    backdrop-filter: blur(25px) saturate(1.6);
    -webkit-backdrop-filter: blur(25px) saturate(1.6);
    box-shadow: 
        0 16px 40px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.service-card-icon { font-size: 3rem; color: var(--primary); margin-bottom: 1rem; display: inline-block; }
.service-card-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-light); }
.service-card-text { color: var(--text-muted-light); line-height: 1.6; }

/* ========== SKILLS & TIMELINE ========== */
.skill-card {
  padding: 1.5rem 1rem; 
  text-align: center; 
  border-radius: 16px;
  background: linear-gradient(135deg, 
      rgba(255, 255, 255, 0.12), 
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.10)
  );
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  position: relative; 
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 
      0 6px 20px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.skill-card::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, 
    rgba(var(--primary-hue), 80%, 80%, 0.15) 0%, 
    rgba(var(--primary-hue), 80%, 80%, 0.05) 40%,
    transparent 70%
  );
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.skill-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg,
    rgba(var(--primary-hue), 80%, 70%, 0.2),
    transparent 25%,
    transparent 75%,
    rgba(var(--primary-hue), 80%, 70%, 0.2)
  );
  border-radius: 22px;
  z-index: -1;
  opacity: 0;
  transition: all 0.3s ease;
}

.skill-card:hover::after {
  width: 200%;
  height: 200%;
}

.skill-card:hover::before {
  opacity: 1;
}

.skill-card:hover { 
  transform: translateY(-4px) scale(1.03); 
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 
      0 12px 30px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.skill-card i { font-size: 2.8rem; margin-bottom: 0.75rem; color: var(--primary); transition: transform var(--transition); }
.skill-card div { font-weight: 600; color: var(--text-light); }
.skill-card:hover i { transform: scale(1.1); }

/* ========== SKILL PROGRESS BARS ========== */
.skill-progress-container {
  gap: 1.5rem;
}

.skill-progress-item {
  margin-bottom: 1.5rem;
}

.skill-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-light);
}

.skill-progress-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50px;
  overflow: hidden;
  position: relative;
}

.skill-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 50px;
  width: 0;
  transition: width 2s ease-in-out;
  position: relative;
  overflow: hidden;
}

.skill-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: text-shimmer 2s ease-in-out infinite;
}

.skill-progress-fill.animate {
  animation: progress-load 2s ease-in-out forwards;
}

/* ========== CONTACT METHODS ========== */
.contact-methods-container {
  padding: 2rem;
}

.contact-method-card {
  background: var(--surface-light);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  height: 100%;
}

.contact-method-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: conic-gradient(from 0deg, var(--primary), var(--secondary), var(--primary));
  border-radius: var(--radius);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.contact-method-card:hover::before {
  opacity: 0.1;
}

.contact-method-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.contact-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.contact-icon i {
  font-size: 1.5rem;
  color: white;
}

.contact-method-card .card-title {
  color: var(--text-light);
  font-weight: 600;
}

.contact-method-card .card-text {
  color: var(--text-muted-light);
  font-size: 0.9rem;
}

/* Dark mode contact methods */
body.dark-mode .contact-method-card {
  background: var(--surface-dark);
  border-color: var(--border-dark);
}

body.dark-mode .contact-method-card .card-title {
  color: var(--text-dark);
}

body.dark-mode .contact-method-card .card-text {
  color: var(--text-muted-dark);
}

/* Footer contact cards */
footer .contact-method-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

footer .contact-method-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: conic-gradient(from 0deg, var(--primary), var(--secondary), var(--primary-glow), var(--primary));
  border-radius: var(--radius);
  z-index: -1;
  opacity: 0;
  transition: all 0.5s ease;
  animation: rotate 3s linear infinite;
}

footer .contact-method-card:hover::before {
  opacity: 0.3;
  animation-play-state: paused;
}

footer .contact-method-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

footer .contact-method-card .card-title {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

footer .contact-method-card .card-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

footer .contact-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

footer .contact-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

footer .contact-method-card:hover .contact-icon::before {
  transform: translateX(100%);
}

footer .contact-method-card:hover .contact-icon {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Dark mode footer overrides */
body.dark-mode footer {
  background-color: var(--bg-dark) !important;
  color: var(--text-dark) !important;
}

body.dark-mode footer h2 {
  color: var(--text-dark) !important;
}

body.dark-mode footer p {
  color: var(--text-muted-dark) !important;
}

body.dark-mode footer .contact-method-card {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: var(--text-dark) !important;
}

body.dark-mode footer .contact-method-card:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

body.dark-mode footer .contact-method-card .card-title {
  color: var(--text-dark) !important;
}

body.dark-mode footer .contact-method-card .card-text {
  color: var(--text-muted-dark) !important;
}

body.dark-mode footer .badge {
  background-color: var(--primary) !important;
}

/* Ensure buttons work in dark mode */
body.dark-mode footer .btn {
  color: white !important;
}

/* Dark mode skill progress */
body.dark-mode .skill-progress-header {
  color: var(--text-dark);
}

body.dark-mode .skill-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

/* Dark mode preloader */
body.dark-mode #preloader {
  background: linear-gradient(135deg, var(--bg-dark), var(--surface-dark));
}

body.dark-mode .preloader-text {
  color: var(--text-dark);
}

/* Dark mode floating shapes */
body.dark-mode .shape {
  opacity: 0.05;
}

/* Enhanced button animations */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transition: width 0.6s ease, height 0.6s ease;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn .btn-text {
  position: relative;
  z-index: 1;
}

/* Enhanced section animations */
section {
  position: relative;
  overflow: hidden;
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  transition: left 0.8s ease;
}

section.animate::before {
  left: 100%;
}

.timeline { position: relative; max-width: 800px; margin: auto; }
.timeline::before {
  content: ''; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 4px; border-radius: 2px;
  background: linear-gradient(var(--primary), var(--secondary), transparent);
  transform: translateX(-50%);
}
.timeline-event { position: relative; margin-bottom: 3rem; width: 50%; }
.timeline-event:nth-child(odd) { left: 0; padding-right: 3rem; }
.timeline-event:nth-child(even) { left: 50%; padding-left: 3rem; }
.timeline-event::after {
    content: ''; position: absolute; top: 5px; width: 16px; height: 16px;
    border-radius: 50%; background-color: var(--bg-light);
    border: 4px solid var(--primary); z-index: 1; transition: transform var(--transition);
}
.timeline-event:nth-child(odd)::after { right: -8px; }
.timeline-event:nth-child(even)::after { left: -8px; }
.timeline-event:hover::after { transform: scale(1.2); }
.timeline-content { padding: 1.5rem; border-radius: var(--radius); background: var(--surface-light); border: 1px solid rgba(0,0,0,0.05); transition: transform var(--transition), box-shadow var(--transition); will-change: transform; }
.timeline-content p { color: var(--text-muted-light); }
.timeline-event:hover .timeline-content { transform: translateY(-5px); box-shadow: 0 4px 12px var(--shadow-color); }
.timeline-content h5 { color: var(--primary); font-weight: 700; }

/* ========== PROJECTS SECTION ========== */
.project-card {
  position: relative;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.22), 
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.15)
  );
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 24px;
  padding: 0;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  backdrop-filter: blur(40px) saturate(1.8) brightness(1.1);
  -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.1);
  box-shadow: 
    0 16px 45px rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: conic-gradient(
    from 0deg at 50% 50%,
    hsl(var(--primary-hue), 100%, 60%) 0deg,
    hsl(calc(var(--primary-hue) + 60), 100%, 60%) 60deg,
    hsl(calc(var(--primary-hue) + 120), 100%, 60%) 120deg,
    hsl(calc(var(--primary-hue) + 180), 100%, 60%) 180deg,
    hsl(calc(var(--primary-hue) + 240), 100%, 60%) 240deg,
    hsl(calc(var(--primary-hue) + 300), 100%, 60%) 300deg,
    hsl(var(--primary-hue), 100%, 60%) 360deg
  );
  opacity: 0;
  transition: opacity 0.5s ease;
  animation: rgb-border-rotate 3s linear infinite;
  z-index: -2;
}

.project-card:hover::before {
  opacity: 1;
}

.project-card-glow {
  position: absolute;
  inset: -2px;
  background: conic-gradient(
    from 0deg,
    transparent,
    hsl(var(--primary-hue), 100%, 70%),
    transparent,
    hsl(calc(var(--primary-hue) + 120), 100%, 70%),
    transparent,
    hsl(calc(var(--primary-hue) + 240), 100%, 70%),
    transparent
  );
  border-radius: var(--radius);
  opacity: 0;
  filter: blur(15px);
  transition: opacity 0.5s ease, filter 0.5s ease;
  animation: rgb-glow-pulse 4s ease-in-out infinite;
  z-index: -1;
}

.project-card:hover .project-card-glow {
  opacity: 0.8;
  filter: blur(20px);
}

.project-card-content {
  position: relative;
  padding: 2rem;
  background: var(--surface-light);
  border-radius: calc(var(--radius) - 1px);
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.project-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  position: relative;
  overflow: hidden;
}

.project-icon::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: conic-gradient(
    from 0deg,
    hsl(var(--primary-hue), 100%, 70%),
    hsl(calc(var(--primary-hue) + 90), 100%, 70%),
    hsl(calc(var(--primary-hue) + 180), 100%, 70%),
    hsl(calc(var(--primary-hue) + 270), 100%, 70%),
    hsl(var(--primary-hue), 100%, 70%)
  );
  border-radius: 50%;
  animation: rgb-icon-spin 6s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.project-card:hover .project-icon::before {
  opacity: 1;
}

.project-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted-light);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: linear-gradient(45deg, #00ff88, #00cc6a);
  border-radius: 50%;
  animation: status-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.status-dot.live {
  background: linear-gradient(45deg, #ff6b6b, #ee5a52);
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.project-card:has(.status-text:contains("Live")) .status-dot {
  background: linear-gradient(45deg, #ff6b6b, #ee5a52);
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.project-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 1rem;
  background: linear-gradient(90deg, var(--text-light), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  transition: all 0.3s ease;
}

.project-card:hover .project-title {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.project-description {
  color: var(--text-muted-light);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.project-tag {
  padding: 0.3rem 0.8rem;
  background: rgba(var(--primary-hue), 98%, 55%, 0.1);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(var(--primary-hue), 98%, 55%, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.project-tag::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover .project-tag::before {
  opacity: 0.1;
}

.project-footer {
  margin-top: auto;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.5rem 0;
}

.project-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s ease;
}

.project-link:hover::after {
  width: 100%;
}

.project-link i {
  transition: transform 0.3s ease;
}

.project-link:hover i {
  transform: translateX(5px);
}

.project-link:hover {
  color: var(--secondary);
  text-shadow: 0 0 10px rgba(var(--primary-hue), 98%, 55%, 0.3);
}

/* Project Card Hover Effects */
.project-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(var(--primary-hue), 98%, 55%, 0.1);
}

/* RGB Animations */
@keyframes rgb-border-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes rgb-glow-pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.05);
  }
}

@keyframes rgb-icon-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes status-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.2);
  }
}

/* Dark Mode Overrides for Projects */
body.dark-mode .project-card {
  background: var(--surface-dark);
  border-color: var(--border-dark);
}

body.dark-mode .project-card-content {
  background: var(--surface-dark);
}

body.dark-mode .project-title {
  color: var(--text-dark);
  background: linear-gradient(90deg, var(--text-dark), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
}

body.dark-mode .project-description,
body.dark-mode .project-status {
  color: var(--text-muted-dark);
}

body.dark-mode .project-card:hover {
  background: var(--surface-dark);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(var(--primary-hue), 98%, 55%, 0.2),
    0 0 30px rgba(var(--primary-hue), 98%, 55%, 0.1);
}

body.dark-mode .project-tag {
  background: rgba(var(--primary-hue), 98%, 55%, 0.15);
  border-color: rgba(var(--primary-hue), 98%, 55%, 0.3);
}

/* ========== BLOG SECTION ========== */
.blog-card {
  border-radius: var(--radius); border: 0;
  box-shadow: 0 4px 12px var(--shadow-color); background: #fff;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  will-change: transform;
}
.blog-card:hover {
  box-shadow: 0 8px 30px var(--shadow-color); transform: translateY(-8px);
}
.blog-card .card-title { font-weight: 700; color: var(--text-light); font-size: 1.3rem; letter-spacing: .6px; }
.blog-card .card-text { color: var(--text-muted-light); }
.blog-meta { font-size: 0.85rem; color: var(--text-muted-light); font-weight: 500; }
.animated-underline { position: relative; text-decoration: none !important; font-weight: 600; }
.animated-underline::after {
  content: ''; display: block; width: 0; height: 2px;
  background: var(--primary);
  transition: width .3s;
  position: absolute; left: 0; bottom: -2px;
}
.animated-underline:hover::after { width: 100%; }

/* Blog Modal */
.modal-content { border-radius: var(--radius); border: 0; background-color: var(--bg-light); }
.modal-header { border-bottom-color: rgba(0,0,0,0.1); }
.modal-title { color: var(--text-light); }
.modal-body { color: var(--text-muted-light); }
.blog-article h6 { margin-top: 1.5em; font-size: 1.17em; color: var(--primary); font-weight: 700; }
.blog-article p { color: var(--text-muted-light); }

/* ========== BUTTONS ========== */
.btn { border-radius: 50px; font-weight: 600; padding: 0.75rem 1.75rem; transition: transform var(--transition), box-shadow var(--transition) !important; will-change: transform; }
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; color: white !important; }
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 8px 30px var(--shadow-color) !important; }
.btn-outline-primary { border-color: var(--primary) !important; color: var(--primary) !important; }
.btn-outline-primary:hover { background-color: var(--primary) !important; color: white !important; transform: scale(1.05); }

/* ========== FOOTER ========== */
footer { background: var(--bg-light); transition: background-color .3s ease, border-color .3s ease; }
footer h3 { color: var(--text-light); }
.footer-email-link { color: var(--text-muted-light); text-decoration: none; position: relative; }
.footer-email-link:hover { color: var(--primary); }
.footer-email-link::after { content: ''; position: absolute; left: 0; bottom: -3px; width: 100%; height: 1px; background-color: var(--primary); transform: scaleX(0); transform-origin: right; transition: transform 0.3s ease; }
.footer-email-link:hover::after { transform: scaleX(1); transform-origin: left; }
.social-icon-btn { font-size: 1.5rem; color: var(--text-muted-light); transition: transform var(--transition), color var(--transition); background: none; border: none; padding: 0; will-change: transform; }
.social-icon-btn:hover { color: var(--primary); transform: translateY(-5px); }
.copy-tooltip { position: fixed; background-color: #282c34; color: white; padding: 5px 10px; border-radius: 6px; font-size: 0.85rem; z-index: 1050; opacity: 0; transform: translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none; }
.copy-tooltip.show { opacity: 1; transform: translateY(0); }

/* ========== STYLE SWITCHER ========== */
.style-switcher {
  position: fixed; right: 0; top: 120px;
  padding: 1rem; width: 200px;
  border-right: 0; border-radius: 1rem 0 0 1rem; z-index: 101;
  transform: translateX(100%); transition: transform var(--transition);
  background: var(--surface-light); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,0.08);
}
.style-switcher.open { transform: translateX(0); }
.style-switcher-toggler {
  position: absolute; height: 40px; width: 40px; right: 100%; top: -1px;
  background: inherit; border: inherit; border-right: 0;
  border-radius: .5rem 0 0 .5rem; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-light);
}
.style-switcher-toggler i { animation: spin 4s linear infinite; }
.style-switcher hr, .style-switcher-mobile hr { margin: 1rem 0; opacity: 0.1; }
.style-switcher h4, .style-switcher-mobile h4 { color: var(--text-light); font-size: 1rem; text-align: center; }
.day-night {
    cursor: pointer; 
    font-size: 1.5rem; 
    margin: 0.5rem auto; 
    width: 50px; 
    height: 50px;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-light);
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.1);
    border: 2px solid rgba(var(--primary-rgb), 0.2);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.day-night:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
    transform: scale(1.05);
}

.day-night:active {
    transform: scale(0.95);
}

/* Mobile specific theme toggle */
@media (max-width: 991px) {
    .style-switcher-mobile {
        display: block !important;
        visibility: visible !important;
    }
    
    .style-switcher-mobile .day-night {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.8rem !important;
        margin: 1rem auto !important;
        background: var(--primary) !important;
        color: white !important;
        border: 3px solid rgba(255, 255, 255, 0.2) !important;
        box-shadow: 0 4px 15px rgba(var(--primary-hue), 0.3) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
    }
    
    .style-switcher-mobile .day-night:hover,
    .style-switcher-mobile .day-night:active {
        transform: scale(1.1) !important;
        box-shadow: 0 6px 20px rgba(var(--primary-hue), 0.5) !important;
    }
    
    /* Make sure it's visible in dark mode too */
    body.dark-mode .style-switcher-mobile .day-night {
        background: var(--primary) !important;
        color: white !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
    }
}
.colors { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 0 .5rem; }
.colors span {
  display: inline-block; height: 30px; width: 30px;
  border-radius: 50%; cursor: pointer; transition: transform var(--transition);
}
.colors span:hover { transform: scale(1.1); }
.color-1 { background-color: hsl(221, 98%, 55%); }
.color-2 { background-color: hsl(350, 98%, 55%); }
.color-3 { background-color: hsl(270, 98%, 55%); }
.color-4 { background-color: hsl(145, 80%, 45%); }
.color-5 { background-color: hsl(38, 98%, 55%); }
.color-6 { background-color: hsl(195, 98%, 55%); }
.color-7 { background-color: hsl(60, 98%, 55%); }
.color-8 { background-color: hsl(0, 98%, 55%); }
.color-9 { background-color: hsl(300, 98%, 55%); }

.color-picker {
  position: relative;
  background: conic-gradient(from 0deg, red, yellow, lime, cyan, blue, magenta, red);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  animation: rainbow-shift 3s linear infinite;
  overflow: hidden;
}

.color-picker input[type="color"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
}

.color-picker i {
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 0 3px rgba(0,0,0,0.5));
}

/* ========== BACK TO TOP BUTTON ========== */
#backToTopButton {
  position: fixed; bottom: 25px; right: 25px; z-index: 100;
  width: 50px; height: 50px; font-size: 1.2rem;
  display: none; opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#backToTopButton.show { opacity: 1; display: flex; align-items: center; justify-content: center; }
#backToTopButton:hover { transform: scale(1.05); }

/*
  ========================================
  DARK MODE OVERHAUL
  ========================================
*/
body.dark-mode { --shadow-color: hsla(var(--primary-hue), 100%, 50%, 0.15); background-color: var(--bg-dark); color: var(--text-dark); }
body.dark-mode ::-webkit-scrollbar-track { background: var(--bg-dark); }
body.dark-mode .text-muted { color: var(--text-muted-dark) !important; }
body.dark-mode .bg-light { background-color: var(--bg-dark) !important; }
/* Enhanced dark mode acrylic glass effects */
body.dark-mode .glassmorphism {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.08), 
        rgba(255, 255, 255, 0.03),
        rgba(255, 255, 255, 0.06)
    );
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

body.dark-mode .glassmorphism:hover {
    backdrop-filter: blur(50px) saturate(2) brightness(1.3);
    -webkit-backdrop-filter: blur(50px) saturate(2) brightness(1.3);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

body.dark-mode .glass-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.12), 
        rgba(255, 255, 255, 0.04),
        rgba(255, 255, 255, 0.08)
    );
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 16px 50px rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

body.dark-mode .glass-card:hover {
    backdrop-filter: blur(60px) saturate(2.2) brightness(1.4);
    -webkit-backdrop-filter: blur(60px) saturate(2.2) brightness(1.4);
    box-shadow: 
        0 24px 70px rgba(0, 0, 0, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(var(--primary-hue), 80%, 70%, 0.3);
}

body.dark-mode .service-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.06), 
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.04)
    );
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.25),
        inset 0 2px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

body.dark-mode .service-card:hover {
    backdrop-filter: blur(55px) saturate(2.5) brightness(1.3);
    -webkit-backdrop-filter: blur(55px) saturate(2.5) brightness(1.3);
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.35),
        inset 0 2px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 1px rgba(var(--primary-hue), 80%, 70%, 0.4);
}

body.dark-mode .skill-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.08), 
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.05)
    );
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.02);
}

body.dark-mode .skill-card:hover {
    backdrop-filter: blur(50px) saturate(2.2) brightness(1.35);
    -webkit-backdrop-filter: blur(50px) saturate(2.2) brightness(1.35);
    box-shadow: 
        0 18px 40px rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 1px rgba(var(--primary-hue), 80%, 70%, 0.4);
}

body.dark-mode .project-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.10), 
        rgba(255, 255, 255, 0.03),
        rgba(255, 255, 255, 0.06)
    );
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 16px 45px rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

/* Dark mode scrollbar with acrylic effect */
body.dark-mode ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, 
        rgba(var(--primary-hue), 80%, 60%, 0.9),
        rgba(var(--primary-hue), 70%, 70%, 0.7)
    );
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Dark mode section backgrounds */
body.dark-mode #services {
    background: linear-gradient(135deg, 
        rgba(var(--primary-hue), 60%, 20%, 0.3),
        rgba(var(--primary-hue), 50%, 15%, 0.2),
        rgba(270, 60%, 20%, 0.3)
    );
}

body.dark-mode #skills {
    background: linear-gradient(135deg, 
        rgba(var(--primary-hue), 40%, 15%, 0.2),
        rgba(var(--primary-hue), 60%, 20%, 0.15)
    );
}

body.dark-mode #projects {
    background: linear-gradient(135deg, 
        rgba(270, 60%, 20%, 0.25),
        rgba(var(--primary-hue), 50%, 15%, 0.2),
        rgba(195, 60%, 20%, 0.25)
    );
}

body.dark-mode #blog {
    background: linear-gradient(135deg, 
        rgba(var(--primary-hue), 60%, 20%, 0.3),
        rgba(var(--primary-hue), 50%, 15%, 0.2),
        rgba(270, 60%, 20%, 0.3)
    );
}
body.dark-mode .offcanvas { background-color: var(--bg-dark); border-left: 1px solid var(--border-dark);}
body.dark-mode .btn-close { filter: invert(1) grayscale(100) brightness(200%); }
body.dark-mode .navbar-brand .fw-bold, body.dark-mode .navbar .nav-link, body.dark-mode .section-heading,
body.dark-mode #auto-typing-animation, body.dark-mode #auto-typing-animation .cursor,
body.dark-mode .service-card-title, body.dark-mode .skill-card div, body.dark-mode footer h3,
body.dark-mode .style-switcher-toggler, body.dark-mode .day-night, body.dark-mode h4, body.dark-mode .blog-card .card-title, body.dark-mode .modal-title,
body.dark-mode .navbar-toggler .bi-list, body.dark-mode .offcanvas-title { color: var(--text-dark); }
body.dark-mode #navbar .nav-link { color: var(--text-dark) !important; }

/* Optimized dark mode navbar */
body.dark-mode #navbar {
  background: linear-gradient(135deg,
    rgba(var(--primary-hue), 50%, 18%, 0.75) 0%,
    rgba(270, 50%, 18%, 0.65) 100%
  ) !important;
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid rgba(var(--primary-hue), 60%, 35%, 0.3);
  box-shadow: 
    0 4px 20px rgba(var(--primary-hue), 70%, 25%, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
body.dark-mode .hero-section .lead, body.dark-mode .hero-section p, body.dark-mode .service-card-text, body.dark-mode .about-section .lead, body.dark-mode .timeline-content p,
body.dark-mode #realtime-clock-container, body.dark-mode .blog-meta, body.dark-mode .blog-card .card-text, body.dark-mode .modal-body, body.dark-mode .blog-article p { color: var(--text-muted-dark); }
body.dark-mode .about-illust, body.dark-mode .hero-avatar { border-color: var(--surface-dark); }
body.dark-mode .hero-section { background-color: var(--bg-dark) !important; }
body.dark-mode .skill-card, body.dark-mode .service-card, body.dark-mode .timeline-content, body.dark-mode .blog-card { border-color: var(--border-dark); background: transparent; }
body.dark-mode .skill-card:hover, body.dark-mode .service-card:hover, body.dark-mode .timeline-event:hover .timeline-content, body.dark-mode .blog-card:hover {
    background: var(--surface-dark);
    box-shadow: 0 0 25px hsla(var(--primary-hue), 80%, 50%, 0.25);
}
body.dark-mode .timeline-event::after { background-color: var(--bg-dark); }
body.dark-mode footer { background: var(--bg-dark); border-top: 1px solid var(--border-dark); }
body.dark-mode .btn-outline-primary { color: var(--secondary) !important; border-color: var(--secondary) !important; }
body.dark-mode .btn-outline-primary:hover { background-color: var(--secondary) !important; border-color: var(--secondary) !important; color: var(--text-dark) !important; }
body.dark-mode .modal-content { background-color: var(--bg-dark); border: 1px solid var(--border-dark); }
body.dark-mode .modal-header { border-bottom-color: var(--border-dark); }
body.dark-mode .footer-email-link { color: var(--text-muted-dark); }
body.dark-mode .social-icon-btn { color: var(--text-muted-dark); }
body.dark-mode .social-icon-btn:hover { color: var(--primary-glow); }

/* ========== RESPONSIVE ========== */

/* Fix mobile scaling and overflow issues */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Mobile Navbar */
@media (max-width: 991px) {
    /* CRITICAL: Enhanced Mobile Theme Toggle Visibility */
    .style-switcher-mobile .day-night {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        width: 45px !important;
        height: 45px !important;
        background: var(--primary) !important;
        border-radius: 50% !important;
        font-size: 1.2rem !important;
        color: white !important;
        border: none !important;
        z-index: 1000 !important;
        transform: scale(1) !important;
        transition: all 0.3s ease !important;
    }
    
    .style-switcher-mobile .day-night:hover {
        background: var(--secondary) !important;
        transform: scale(1.05) !important;
    }
    
    .style-switcher-mobile .day-night:active {
        transform: scale(0.95) !important;
    }
    
    /* CRITICAL: Enhanced Hamburger Menu Visibility and Functionality */
    .navbar-toggler {
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        padding: 0.5rem !important;
        font-size: 1.8rem !important;
        color: var(--text-light) !important;
        background: rgba(var(--primary-hue), 98%, 55%, 0.1) !important;
        border-radius: 8px !important;
        transition: all 0.3s ease !important;
        width: 50px !important;
        height: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
        z-index: 1050 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .navbar-toggler:hover {
        background: rgba(var(--primary-hue), 98%, 55%, 0.2) !important;
        color: var(--primary) !important;
        transform: scale(1.05) !important;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(var(--primary-hue), 98%, 55%, 0.25) !important;
    }
    
    .navbar-toggler:active {
        transform: scale(0.95) !important;
    }
    
    /* Enhanced Offcanvas */
    .offcanvas {
        background: var(--bg-light) !important;
        border-left: 1px solid rgba(var(--primary-hue), 0.1);
        backdrop-filter: blur(20px);
        width: 320px !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease-in-out !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        z-index: 1045 !important;
        height: 100vh !important;
        visibility: visible !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .offcanvas.show {
        transform: translateX(0) !important;
    }
    
    /* Offcanvas backdrop */
    .offcanvas-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 1040 !important;
        width: 100vw !important;
        height: 100vh !important;
        background-color: rgba(0, 0, 0, 0.5) !important;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .offcanvas-backdrop.show {
        opacity: 1 !important;
    }
    
    .offcanvas-header {
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: white;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 1.5rem;
    }
    
    .offcanvas-title {
        font-size: 1.3rem;
        font-weight: 600;
    }
    
    .btn-close {
        background-color: rgba(255, 255, 255, 0.2) !important;
        border-radius: 50% !important;
        opacity: 1 !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.3s ease !important;
        position: relative !important;
        z-index: 1060 !important;
        visibility: visible !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .btn-close:hover {
        background-color: rgba(255, 255, 255, 0.4) !important;
        transform: scale(1.1) !important;
        border-color: rgba(255, 255, 255, 0.5) !important;
    }
    
    .btn-close:active,
    .btn-close:focus {
        background-color: rgba(255, 255, 255, 0.6) !important;
        transform: scale(0.95) !important;
        outline: none !important;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3) !important;
    }
    
    .offcanvas-body {
        padding: 2rem 1.5rem;
    }
    
    .offcanvas .nav-link {
        padding: 1rem 0;
        font-size: 1.1rem;
        font-weight: 500;
        color: var(--text-light);
        border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
        transition: all 0.3s ease;
    }
    
    .offcanvas .nav-link:hover,
    .offcanvas .nav-link.active {
        color: var(--primary);
        background: rgba(var(--primary-rgb), 0.1);
        padding-left: 1rem;
        border-radius: 8px;
        border-bottom-color: transparent;
    }
    
    /* Mobile Style Switcher */
    .style-switcher-mobile {
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid rgba(var(--primary-rgb), 0.1);
    }
    
    .style-switcher-mobile h4 {
        color: var(--text-light);
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 1rem;
    }
    
    .style-switcher-mobile hr {
        margin: 1.5rem 0;
        opacity: 0.2;
        border-color: var(--primary);
    }
}

/* Dark mode offcanvas */
body.dark-mode .offcanvas {
    background: var(--bg-dark) !important;
    border-left-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .offcanvas .nav-link {
    color: var(--text-dark);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .offcanvas .nav-link:hover,
body.dark-mode .offcanvas .nav-link.active {
    background: rgba(var(--primary-rgb), 0.2);
}

body.dark-mode .navbar-toggler {
    color: var(--text-dark);
    background: rgba(var(--primary-rgb), 0.15);
}

body.dark-mode .style-switcher-mobile {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .style-switcher-mobile h4 {
    color: var(--text-dark);
}

/* Tablet and small desktop optimizations */
@media (max-width: 1199px) {
    .container { padding: 0 2rem; }
    .hero-section { padding: 6rem 0 4rem; }
    .section { padding: 5rem 0; }
}

/* Large mobile and tablet */
@media (max-width: 991px) {
    body { 
        cursor: auto; 
        overflow-x: hidden;
        min-height: 100vh;
        width: 100%;
        position: relative;
    }
    
    .cursor-dot, .cursor-outline { display: none; }
    
    /* Prevent horizontal scrolling */
    * {
        max-width: 100%;
    }
    
    .container, .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
        width: 100%;
    }
    
    .row {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    [class*="col-"] {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        width: 100%;
    }
    
    /* Hero section mobile optimizations */
    .hero-section { 
        text-align: center; 
        padding: 4rem 0 3rem;
        min-height: 100vh; /* Fallback */
        min-height: calc(var(--vh, 1vh) * 100);
        width: 100vw;
        max-width: 100%;
        overflow-x: hidden;
        display: flex;
        align-items: center;
    }
    
    .hero-section .container {
        width: 100%;
        max-width: 100%;
    }
    
    .hero-section .justify-content-lg-start { 
        justify-content: center !important; 
    }
    
    .hero-avatar { 
        width: 200px; 
        height: 200px;
        margin: 0 auto 2rem;
        max-width: 90vw;
        max-height: 90vw;
    }
    
    .hero-content {
        width: 100%;
        padding: 0 1rem;
    }
    
    .hero-content h1 { 
        font-size: 2.2rem; 
        line-height: 1.2;
        margin-bottom: 1rem;
        word-break: break-word;
    }
    
    .hero-content .lead { 
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .hero-content .typed-text {
        font-size: 1.1rem;
        word-break: break-word;
    }
    
    /* Timeline mobile optimization */
    .timeline::before { left: 20px; }
    .timeline-event, .timeline-event:nth-child(even) { 
        left: 0; 
        width: 100%; 
        padding-left: 3rem;
        margin-bottom: 2rem;
    }
    .timeline-event:nth-child(odd) { padding-right: 0; }
    .timeline-event::after, .timeline-event:nth-child(odd)::after, 
    .timeline-event:nth-child(even)::after { left: 12px; }
    
    /* Mobile enhancements */
    .floating-shapes { display: none; }
    .music-visualizer { display: none; }
    .contact-form-container { 
        padding: 2rem 1.5rem;
        margin: 2rem 1rem;
        border-radius: 20px;
    }
    
    /* Animations optimized for mobile */
    .shape {
        animation-duration: 15s;
        transform: scale(0.8);
    }
    
    /* Mobile skill progress */
    .skill-progress-container {
        padding: 0 1rem;
    }
    .skill-item { margin-bottom: 2rem; }
    
    /* Style switcher mobile */
    .colors {
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
    }
    .colors span {
        width: 25px;
        height: 25px;
        margin: 2px;
    }
    
    /* Preloader mobile */
    .preloader-text {
        font-size: 1rem;
        text-align: center;
        padding: 0 2rem;
    }
    
    /* Project cards mobile */
    .project-card {
        margin-bottom: 2rem;
        border-radius: 15px;
    }
    
    /* Services mobile */
    .service-card {
        padding: 2rem 1.5rem;
        margin-bottom: 2rem;
        text-align: center;
    }
    
    /* Footer mobile optimization */
    footer .contact-method-card {
        flex: 1 1 calc(50% - 1rem);
        min-width: 140px;
        margin: 0.5rem;
    }
    
    /* Navbar mobile fixes */
    .navbar-toggler {
        border: none;
        padding: 0.25rem 0.5rem;
    }
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
    }
}

/* Small mobile devices */
@media (max-width: 576px) {
    .container { padding: 0 1rem; }
    
    /* Hero ultra-mobile */
    .hero-section { 
        padding: 3rem 0 2rem;
        min-height: 70vh;
    }
    .hero-avatar {
        width: 180px;
        height: 180px;
        margin-bottom: 1.5rem;
    }
    .hero-content h1 { 
        font-size: 2rem; 
        margin-bottom: 1rem;
    }
    .hero-content .lead { font-size: 1rem; }
    
    /* Contact form ultra-mobile */
    .contact-form-container {
        padding: 1.5rem;
        margin: 1rem 0.5rem;
        border-radius: 15px;
    }
    
    /* Skills ultra-mobile */
    .skill-progress-container { padding: 0; }
    .skill-item { margin-bottom: 1.5rem; }
    .skill-name { font-size: 0.9rem; }
    .skill-percentage { font-size: 0.8rem; }
    
    /* Project cards ultra-mobile */
    .project-card-content {
        padding: 1.5rem;
    }
    .project-title { font-size: 1.2rem; }
    .project-description { font-size: 0.9rem; }
    
    /* Service cards ultra-mobile */
    .service-card {
        padding: 2rem 1rem;
        margin-bottom: 1.5rem;
    }
    .service-card h3 { font-size: 1.3rem; }
    .service-card p { font-size: 0.9rem; }
    
    /* Footer ultra-mobile */
    footer .contact-method-card {
        flex: 1 1 100%;
        margin: 0.25rem 0;
        padding: 1rem;
        min-height: auto;
    }
    footer .contact-method-card h5 { font-size: 1rem; }
    footer .contact-method-card p { font-size: 0.85rem; }
    
    /* Timeline ultra-mobile */
    .timeline-event {
        padding-left: 2.5rem;
    }
    .timeline-event h4 { font-size: 1.1rem; }
    .timeline-event p { font-size: 0.9rem; }
    
    /* Typography ultra-mobile */
    .section-title { 
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    .section-subtitle { 
        font-size: 1rem;
        margin-bottom: 3rem;
    }
    
    /* Button optimizations */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    /* Style switcher ultra-mobile */
    .style-switcher {
        width: 90%;
        left: 5%;
        right: 5%;
        padding: 1rem;
    }
    
    /* Navbar ultra-mobile */
    .navbar-brand { font-size: 1.1rem; }
    
    /* Spacing adjustments */
    .section { padding: 3rem 0; }
    .mb-5 { margin-bottom: 2rem !important; }
    .mb-4 { margin-bottom: 1.5rem !important; }
}

/* Ultra-small devices (landscape phones) */
@media (max-width: 480px) {
    .hero-content h1 { font-size: 1.8rem; }
    .hero-avatar { width: 160px; height: 160px; }
    .section-title { font-size: 1.8rem; }
    .contact-form-container { margin: 0.5rem 0; }
}

/* Fix for horizontal scrolling and scaling - Remove duplicate scrollbars */
@media (max-width: 991px) {
    html { 
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        overflow-x: hidden !important;
    }
    
    html, body { 
        overflow-x: hidden !important; 
        width: 100% !important;
        max-width: 100vw !important;
        position: relative !important;
    }
    
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    .container, .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        overflow-x: visible !important;
    }
    
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        overflow-x: visible !important;
    }
    
    [class*="col-"] {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        width: 100% !important;
        flex: 0 0 100%;
        max-width: 100%;
        overflow-x: visible !important;
    }
    
    /* Hide any extra scrollbars on mobile elements */
    .navbar, .hero-section, section, .modal, .dropdown-menu {
        overflow-x: visible !important;
    }
}

/* Enhanced touch targets for mobile */
@media (max-width: 991px) {
    .btn {
        min-height: 48px !important;
        min-width: 48px !important;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(var(--primary-rgb), 0.3);
    }
    
    .nav-link {
        padding: 1rem !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(var(--primary-rgb), 0.3);
    }
    
    .contact-method-card {
        min-height: 60px !important;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(var(--primary-rgb), 0.3);
        touch-action: manipulation;
        transition: all 0.3s ease;
    }
    
    .contact-method-card:active {
        transform: scale(0.95);
        background: rgba(var(--primary-rgb), 0.1);
    }
    
    /* Improve form inputs on mobile */
    .form-control, .form-select {
        min-height: 48px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
        border-radius: 8px !important;
        touch-action: manipulation;
    }
    
    /* Better mobile buttons */
    .colors span {
        min-height: 40px !important;
        min-width: 40px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.2);
    }
    
    .day-night {
        min-height: 60px !important;
        min-width: 60px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(var(--primary-rgb), 0.3);
    }
    
    /* Mobile navbar toggler */
    .navbar-toggler {
        min-height: 48px !important;
        min-width: 48px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(var(--primary-rgb), 0.3);
    }
    
    /* Disable hover effects on touch devices */
    @media (hover: none) {
        .btn:hover,
        .nav-link:hover,
        .contact-method-card:hover,
        .colors span:hover,
        .day-night:hover {
            transform: none;
        }
    }
    
    /* Enable active states for touch */
    .btn:active,
    .nav-link:active,
    .navbar-toggler:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* ========== CUSTOM OFFCANVAS SYSTEM ========== */
/* Ensure our custom offcanvas works properly */
.custom-offcanvas-backdrop {
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.offcanvas {
    /* Force proper positioning and styling */
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    border: none !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

.navbar-toggler {
    border: none !important;
    padding: 0.5rem !important;
    font-size: 1.5rem !important;
    background: none !important;
    color: var(--text-light) !important;
    transition: all 0.3s ease !important;
}

.navbar-toggler:focus {
    box-shadow: none !important;
    outline: 2px solid var(--primary) !important;
    outline-offset: 2px !important;
}

.navbar-toggler .bi-list {
    transition: transform 0.3s ease;
}

.navbar-toggler[aria-expanded="true"] .bi-list {
    transform: rotate(90deg);
}

body.dark-mode .navbar-toggler {
    color: var(--text-dark) !important;
}

/* Mobile offcanvas specific styling */
@media (max-width: 991px) {
    .offcanvas {
        background: var(--surface-light) !important;
        border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
    
    body.dark-mode .offcanvas {
        background: var(--surface-dark) !important;
        border-left: 1px solid var(--border-dark) !important;
    }
    
    .offcanvas-header {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 1.5rem;
    }
    
    body.dark-mode .offcanvas-header {
        background: rgba(0, 0, 0, 0.2);
        border-bottom: 1px solid var(--border-dark);
    }
    
    .offcanvas-body {
        padding: 1.5rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .offcanvas .nav-link {
        padding: 1rem 0 !important;
        font-size: 1.1rem !important;
        font-weight: 500 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
        color: var(--text-light) !important;
    }
    
    body.dark-mode .offcanvas .nav-link {
        border-bottom: 1px solid var(--border-dark);
        color: var(--text-dark) !important;
    }
    
    .offcanvas .nav-link:hover,
    .offcanvas .nav-link:active {
        color: var(--primary) !important;
        padding-left: 1rem;
        background: rgba(var(--primary-hue), 78%, 56%, 0.1);
    }
    
    .btn-close {
        filter: brightness(1);
        opacity: 0.7;
        transition: all 0.3s ease;
        background-size: 1.2rem;
        padding: 0.75rem;
    }
    
    .btn-close:hover {
        opacity: 1;
        transform: scale(1.1);
    }
    
    body.dark-mode .btn-close {
        filter: invert(1) brightness(1.5);
    }
}

/* ========== NAVBAR THEME CONTROLS ========== */
/* Navbar theme toggle button styling */
.navbar-theme-toggle {
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
    background: rgba(var(--primary-hue), 83%, 53%, 0.1) !important;
    border-color: rgba(var(--primary-hue), 83%, 53%, 0.3) !important;
    color: var(--primary) !important;
}

.navbar-theme-toggle:hover {
    background: rgba(var(--primary-hue), 83%, 53%, 0.2) !important;
    border-color: var(--primary) !important;
    transform: scale(1.05) !important;
}

.navbar-theme-toggle:active {
    transform: scale(0.95) !important;
}

body.dark-mode .navbar-theme-toggle {
    background: rgba(var(--primary-hue), 83%, 53%, 0.15) !important;
    border-color: rgba(var(--primary-hue), 83%, 53%, 0.4) !important;
    color: var(--secondary) !important;
}

body.dark-mode .navbar-theme-toggle:hover {
    background: rgba(var(--primary-hue), 83%, 53%, 0.25) !important;
    border-color: var(--secondary) !important;
}

/* Navbar color picker dropdown styling */
.navbar-colors {
    max-width: 160px;
}

.navbar-color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.navbar-color-option:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.navbar-color-option:active {
    transform: scale(0.95);
}

.navbar-color-option.active {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4), 0 0 20px rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.navbar-color-option.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

body.dark-mode .navbar-color-option:hover {
    border-color: rgba(255, 255, 255, 0.7);
}

body.dark-mode .navbar-color-option.active {
    border-color: var(--text-dark);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3), 0 0 20px rgba(255, 255, 255, 0.15);
}

/* Color Picker Modal Styling */
#colorPickerModal .modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

body.dark-mode #colorPickerModal .modal-content {
    background: rgba(22, 27, 34, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dark);
}

#colorPickerModal .navbar-colors {
    max-width: none;
    justify-content: center;
}

#colorPickerModal .navbar-color-option {
    width: 40px;
    height: 40px;
    margin: 5px;
    transition: all 0.3s ease;
}

#colorPickerModal .navbar-color-option:hover {
    transform: scale(1.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

#colorPickerModal .navbar-color-option.active {
    transform: scale(1.1);
    border-width: 3px;
}

/* Custom color picker styling in modal */
#colorPickerModal #navbarCustomColor {
    width: 100% !important;
    height: 40px !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    padding: 0 !important;
}

/* Dropdown menu styling */
#navbarColorPicker + .dropdown-menu {
    background: var(--surface-light);
    border: 1px solid rgba(var(--primary-hue), 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

body.dark-mode #navbarColorPicker + .dropdown-menu {
    background: var(--surface-dark);
    border-color: var(--border-dark);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.dropdown-header {
    color: var(--text-light) !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    margin-bottom: 0.5rem !important;
}

body.dark-mode .dropdown-header {
    color: var(--text-dark) !important;
}

/* Mobile navbar theme controls */
@media (max-width: 991px) {
    .navbar .d-flex.align-items-center.gap-2.ms-3 {
        margin-left: 0 !important;
        margin-top: 0.5rem;
        justify-content: center;
        gap: 1rem !important;
    }
    
    .navbar-theme-toggle {
        min-width: 36px !important;
        height: 36px !important;
        font-size: 0.9rem !important;
    }
    
    .navbar-colors {
        max-width: 120px;
        gap: 6px !important;
    }
    
    .navbar-color-option {
        width: 24px;
        height: 24px;
    }
    
    #navbarCustomColor {
        height: 32px !important;
    }
    
    .dropdown-menu {
        min-width: 180px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    
    #navbarColorPicker {
        min-width: 36px !important;
        padding: 0.375rem 0.5rem !important;
    }
}