/*
  © 2025 Miloš Saric. All rights reserved.
  Serbia Page - Dark Mode Styles
  Enhanced with purple accents and animations
*/

/* ====================== */
/* SERBIA PAGE DARK MODE  */
/* ====================== */

/* Main Content Area */
.dark-mode .main-content {
  background: var(--primary-bg);
  color: var(--text-primary);
  min-height: 100vh;
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

@media (min-width: 769px) {
  .dark-mode .main-content.sidebar-open {
    margin-left: 280px;
  }
}

/* ====================== */
/* HERO SECTION           */
/* ====================== */

.dark-mode .hero-section {
  background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
  position: relative;
  overflow: hidden;
  padding: 6rem 0 4rem;
  border-bottom: 1px solid var(--border-light);
}

.dark-mode .hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at top right, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
              radial-gradient(ellipse at bottom left, rgba(10, 132, 255, 0.15) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.dark-mode .hero-content {
  position: relative;
  z-index: 1;
}

.dark-mode .hero-content h1,
.dark-mode .hero-section h1 {
  background: linear-gradient(135deg, #0a84ff, #a855f7, #ec4899, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300% 300%;
  font-weight: 800;
  font-size: 3rem;
  margin-bottom: 1rem;
  text-shadow: none;
}

.dark-mode .hero-content p,
.dark-mode .hero-section p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
}

/* ====================== */
/* SIDEBAR SECTION        */
/* ====================== */

.dark-mode .projects-sidebar {
  background: var(--backdrop-blur);
  border-right: 1px solid var(--glass-border);
  box-shadow: 2px 0 20px var(--shadow-medium);
}

.dark-mode .sidebar-header {
  border-bottom: 1px solid var(--border-light);
}

.dark-mode .sidebar-header h3 {
  color: var(--text-primary);
}

.dark-mode .sidebar-toggle {
  color: var(--text-secondary);
}

.dark-mode .sidebar-toggle:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.dark-mode .nav-section h4 {
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 0;
}

.dark-mode .nav-section a {
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.dark-mode .nav-section a:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.dark-mode .nav-section a.active {
  background: rgba(10, 132, 255, 0.15);
  color: var(--accent);
}

.dark-mode .nav-section a.active::before {
  background: var(--accent);
}

.dark-mode .nav-section a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dark-mode .nav-section span.disabled,
.dark-mode .nav-section a.disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: none;
}

.dark-mode .sidebar-footer {
  border-top: 1px solid var(--border-light);
}

.dark-mode .collapse-btn {
  color: var(--text-secondary);
}

.dark-mode .collapse-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.dark-mode .projects-sidebar.collapsed .nav-section a:hover::after {
  background: var(--elevated-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 32px var(--shadow-strong);
}

.dark-mode .sidebar-overlay {
  background: rgba(0, 0, 0, 0.8);
}

.dark-mode .sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-medium);
}

.dark-mode .sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ====================== */
/* NOTEBOOK SECTION       */
/* ====================== */

.dark-mode .notebook-section {
  background: var(--secondary-bg);
  padding: 4rem 0;
  position: relative;
  animation: fadeIn 0.5s ease-in;
}

.dark-mode .notebook-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.dark-mode .notebook-section .container {
  position: relative;
  z-index: 1;
}

.dark-mode .notebook-cell {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px var(--shadow-medium);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  scroll-margin-top: 100px;
}

.dark-mode .notebook-cell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, 
    rgba(10, 132, 255, 0.03) 0%, 
    rgba(168, 85, 247, 0.03) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.dark-mode .notebook-cell:hover {
  border-color: var(--border-medium);
  box-shadow: 0 12px 40px var(--shadow-strong);
  transform: translateY(-4px);
  animation: none;
}

.dark-mode .notebook-cell:hover::before {
  opacity: 1;
}

.dark-mode .notebook-cell:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.dark-mode .markdown-cell h2,
.dark-mode .cell-content h2 {
  color: #ffffff !important;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light);
  position: relative;
  font-weight: 700;
}

.dark-mode .markdown-cell h2::after,
.dark-mode .cell-content h2::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  box-shadow: 0 0 10px var(--glow-accent);
}

.dark-mode .cell-content {
  color: var(--text-primary);
  line-height: 1.8;
}

.dark-mode .cell-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.8;
  text-align: justify;
}

/* ====================== */
/* IMAGE SECTION          */
/* ====================== */

.dark-mode .image-cell {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px var(--shadow-medium);
  transition: all 0.3s ease;
}

.dark-mode .image-cell:hover {
  border-color: var(--border-medium);
  box-shadow: 0 12px 40px var(--shadow-strong);
}

.dark-mode .historical-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1),
}

.dark-mode .image-cell:hover .historical-image {
  transform: scale(1.02);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2),
}

.dark-mode .image-cell figcaption {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-style: italic;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--elevated-bg);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}

/* ====================== */
/* AUTHOR SECTION         */
/* ====================== */

.dark-mode .author-section {
  background: var(--primary-bg);
  padding: 4rem 0;
  border-top: 1px solid var(--border-light);
}

.dark-mode .author-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 3rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
  box-shadow: 0 8px 32px var(--shadow-medium);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.dark-mode .author-card:hover {
  border-color: var(--border-medium);
  box-shadow: 0 12px 40px var(--shadow-strong);
  transform: translateY(-4px);
}

.dark-mode .author-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(168, 85, 247, 0.1), 
    transparent);
  transition: left 0.7s ease;
  pointer-events: none;
}

.dark-mode .author-card:hover::after {
  left: 100%;
}

.dark-mode .author-image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: 0 8px 32px rgba(10, 132, 255, 0.3);
  transition: all 0.3s ease;
}

.dark-mode .author-card:hover .author-image {
  border-color: #a855f7;
  box-shadow: 0 12px 48px rgba(168, 85, 247, 0.5);
  transform: scale(1.05);
}

.dark-mode .author-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dark-mode .author-info h3 {
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.dark-mode .author-info h2 {
  color: var(--text-primary);
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.dark-mode .author-title {
  color: var(--text-tertiary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.dark-mode .author-socials {
  display: flex;
  gap: 1rem;
}

.dark-mode .author-socials a {
  background: var(--tertiary-bg);
  border: 1px solid var(--border-light);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode .author-socials a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(10, 132, 255, 0.5);
}

.dark-mode .author-socials a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dark-mode .author-socials a svg {
  width: 20px;
  height: 20px;
}

/* ====================== */
/* ANIMATIONS             */
/* ====================== */

@keyframes gradient-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes section-pulse {
  0%, 100% { 
    box-shadow: 0 8px 32px var(--shadow-medium);
  }
  50% { 
    box-shadow: 0 12px 40px var(--shadow-strong),
                0 0 30px rgba(10, 132, 255, 0.1);
  }
}

@keyframes fadeIn {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ====================== */
/* CONTAINER              */
/* ====================== */

.dark-mode .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ====================== */
/* MOBILE-SPECIFIC FIXES  */
/* ====================== */

@media (max-width: 768px) {
  /* Fix scroll container */
  html {
    position: relative;
    overflow-x: hidden;
    overscroll-behavior: none;
  }
  
  body {
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix main content */
  .dark-mode .main-content {
    position: relative;
    min-height: 100vh;
    will-change: auto;
  }
  
  /* Disable animations on mobile to prevent black screen */
  .dark-mode .notebook-cell {
    animation: none !important;
  }
  
  .dark-mode .hero-section::before,
  .dark-mode .notebook-section::before {
    animation: none !important;
    opacity: 0.5 !important;
  }
  
  /* Reduce backdrop filters on mobile */
  .dark-mode .projects-sidebar {
    background: rgba(28, 28, 30, 0.98);
  }

  .dark-mode .projects-sidebar.open {
    box-shadow: 4px 0 40px var(--shadow-strong);
  }
  
  /* Simplify shadows on mobile */
  .dark-mode .notebook-cell:hover {
    box-shadow: 0 12px 40px var(--shadow-strong) !important;
  }
  
  .dark-mode .image-cell:hover .historical-image {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) !important;
  }
  
  /* Disable transforms on mobile */
  .dark-mode .notebook-cell:hover,
  .dark-mode .author-card:hover,
  .dark-mode .author-card:hover .author-image {
    transform: none !important;
  }
  
  /* Fix floating button */
  .floating-sidebar-btn {
    pointer-events: auto;
    touch-action: manipulation;
  }
  
  /* Typography - More words per line, bigger text */
  .dark-mode .container {
    padding: 0 0.75rem !important;
    max-width: 100% !important;
  }
  
  .dark-mode .notebook-cell {
    padding: 1.25rem 0.75rem !important;
    margin-bottom: 1.5rem;
    border-radius: 12px;
  }
  
  .dark-mode .cell-content p {
    font-size: 1.15rem !important;
    line-height: 1.8 !important;
    text-align: justify !important;
    word-spacing: -0.05em;
    hyphens: auto;
    -webkit-hyphens: auto;
  }
  
  .dark-mode .hero-content h1,
  .dark-mode .hero-section h1 {
    font-size: 2rem;
  }
  
  .dark-mode .hero-content p,
  .dark-mode .hero-section p {
    font-size: 1.15rem !important;
    line-height: 1.75 !important;
    padding: 0 0.5rem;
  }
  
  .dark-mode .markdown-cell h2,
  .dark-mode .cell-content h2 {
    font-size: 1.75rem !important;
    padding: 0;
  }
  
  .dark-mode .image-cell {
    padding: 1.25rem 0.75rem !important;
  }
  
  .dark-mode .image-cell figcaption {
    font-size: 1rem !important;
    line-height: 1.7;
    padding: 1rem 0.5rem;
  }
  
  .dark-mode .author-card {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1.5rem 0.75rem !important;
  }
  
  .dark-mode .author-image {
    width: 120px;
    height: 120px;
    margin: 0 auto;
  }
  
  .dark-mode .author-info h2 {
    font-size: 1.75rem !important;
  }
  
  .dark-mode .author-socials {
    justify-content: center;
  }
}

/* Small phones optimization */
@media (max-width: 375px) {
  .dark-mode .container {
    padding: 0 0.5rem !important;
  }
  
  .dark-mode .notebook-cell {
    padding: 1rem 0.5rem !important;
  }
  
  .dark-mode .cell-content p {
    font-size: 1.1rem !important;
  }
}

/* Large phones optimization */
@media (min-width: 414px) and (max-width: 768px) {
  .dark-mode .cell-content p {
    font-size: 1.2rem !important;
  }
  
  .dark-mode .container {
    padding: 0 1rem !important;
  }
}

/* ====================== */
/* PRINT STYLES           */
/* ====================== */

@media print {
  .dark-mode .notebook-cell {
    background: white !important;
    color: black !important;
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
  }
  
  .dark-mode .cell-content h2,
  .dark-mode .cell-content p {
    color: black !important;
  }
  
  .dark-mode .author-section {
    page-break-before: always;
  }
}

/* ====================== */
/* ACCESSIBILITY          */
/* ====================== */

@media (prefers-reduced-motion: reduce) {
  .dark-mode .notebook-cell,
  .dark-mode .hero-section::before,
  .dark-mode .notebook-section::before {
    animation: none !important;
  }
}