/* Base variables (Light mode) */
:root {
  --bg-color: #f5f5f7;
  --surface-color: rgba(255, 255, 255, 0.7);
  --surface-border: rgba(0, 0, 0, 0.1);
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent-color: #0078d4;
  --accent-hover: #106ebe;
  --glass-blur: blur(24px);
  --card-glow-color: rgba(0, 0, 0, 0.05);
  --card-hover-bg: rgba(255, 255, 255, 0.9);
  --hero-gradient: linear-gradient(to right, #1d1d1f, #86868b);
  --btn-download-bg: rgba(0, 0, 0, 0.04);
  --btn-download-hover-bg: rgba(0, 0, 0, 0.08);
  --btn-download-hover-border: rgba(0, 0, 0, 0.15);
  --input-bg: rgba(255, 255, 255, 0.6);
  --topic-hover-bg: rgba(0, 0, 0, 0.03);
  --carousel-caption-bg: rgba(255, 255, 255, 0.85);
  --carousel-btn-bg: rgba(255, 255, 255, 0.7);
  --carousel-btn-color: #000;
  --media-placeholder-bg: rgba(0, 0, 0, 0.05);
  --music-showcase-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(0, 120, 212, 0.05));
  --music-h2-gradient: linear-gradient(135deg, #1d1d1f 40%, #0078d4);
  --nav-btn-hover: rgba(0, 0, 0, 0.05);
}

/* Dark mode overrides */
:root[data-theme="dark"] {
  --bg-color: #0d0d12;
  --surface-color: rgba(30, 30, 35, 0.6);
  --surface-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: #a0a0a5;
  --card-glow-color: rgba(255, 255, 255, 0.1);
  --card-hover-bg: rgba(45, 45, 52, 0.7);
  --hero-gradient: linear-gradient(to right, #ffffff, #888890);
  --btn-download-bg: rgba(255, 255, 255, 0.05);
  --btn-download-hover-bg: rgba(255, 255, 255, 0.1);
  --btn-download-hover-border: rgba(255, 255, 255, 0.2);
  --input-bg: rgba(0, 0, 0, 0.3);
  --topic-hover-bg: rgba(50, 50, 55, 0.7);
  --carousel-caption-bg: rgba(45, 45, 52, 0.7);
  --carousel-btn-bg: rgba(0, 0, 0, 0.5);
  --carousel-btn-color: #fff;
  --media-placeholder-bg: rgba(0, 0, 0, 0.2);
  --music-showcase-bg: linear-gradient(145deg, rgba(13, 13, 18, 0.95), rgba(0, 120, 212, 0.1));
  --music-h2-gradient: linear-gradient(135deg, #fff 40%, #0078d4);
  --nav-btn-hover: rgba(255, 255, 255, 0.1);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

html[data-theme="light"] body {
  background-image: url('/static/images/subtle-light-grid.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

html[data-theme="dark"] body {
  background-image: url('/static/images/subtle-grid.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

header {
  background: var(--surface-color);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--surface-border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

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

main {
  flex: 1;
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* Fluent Card styling */
.card {
  background: var(--surface-color);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, background 0.4s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, var(--card-glow-color), rgba(255,255,255,0));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(0, 120, 212, 0.15);
  background: var(--card-hover-bg);
}

/* Typography and Layouts */
.hero {
  text-align: center;
  padding: 5rem 1rem;
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  background: var(--hero-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  letter-spacing: -1px;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 3rem auto;
  line-height: 1.6;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.subject-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.subject-card h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.75rem;
}

.subject-card p {
  color: var(--text-secondary);
}

.subject-icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #0078d4, #00c6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-sizing: border-box;
}

button:active, .button:active {
  transform: scale(0.92);
  transition-duration: 0.1s;
}

/* Open Button Variant */
.button-open {
  background: linear-gradient(135deg, var(--accent-color), #00c6ff);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 120, 212, 0.35);
}

.button-open:hover {
  box-shadow: 0 8px 25px rgba(0, 120, 212, 0.5);
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Download Button Variant */
.button-download {
  background: var(--btn-download-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  backdrop-filter: var(--glass-blur);
}

.button-download:hover {
  background: var(--btn-download-hover-bg);
  border-color: var(--btn-download-hover-border);
  transform: translateY(-2px);
}

/* Delete Button Variant */
.button-delete {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.button-delete:hover {
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.45);
  transform: translateY(-2px);
  filter: brightness(1.1);
}


/* Forms */
.form-container {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input[type="text"], input[type="file"], select {
  width: 100%;
  padding: 1rem;
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.2);
}

/* Lists */
.topic-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.topic-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
}

.topic-item:hover {
  transform: translateX(5px);
  background: var(--topic-hover-bg);
}

.topic-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
}

.topic-meta {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.download-link {
  background: var(--btn-download-bg);
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.download-link:hover {
  background: var(--btn-download-hover-bg);
}

footer {
  text-align: center;
  padding: 3rem;
  border-top: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: auto;
}

.about-content {
  line-height: 1.8;
  font-size: 1.1rem;
  color: var(--text-secondary);
}
.about-content h2 {
  color: var(--text-primary);
  margin-top: 2rem;
}

/* Carousel */
.carousel-wrapper {
  position: relative;
  max-width: 900px;
  margin: 0 auto 3rem;
}

.carousel-container {
  overflow: hidden;
  position: relative;
  border-radius: 16px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.carousel-track {
  padding: 0;
  margin: 0;
  list-style: none;
  position: relative;
  height: 600px;
  transition: transform 0.5s ease-in-out;
}

.carousel-slide {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

.carousel-media {
  width: 100%;
  height: 450px;
  background: #000;
}

.carousel-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}

.carousel-media-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-caption {
  padding: 1.5rem 2rem;
  text-align: center;
  background: var(--carousel-caption-bg);
  height: 150px;
  box-sizing: border-box;
}

.carousel-caption h3 {
  margin: 0 0 0.5rem 0;
  color: var(--accent-color);
}

.carousel-caption p {
  margin: 0;
  color: var(--text-primary);
}

.carousel-button {
  position: absolute;
  top: 35%;
  transform: translateY(-50%);
  background: var(--carousel-btn-bg);
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: var(--carousel-btn-color);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: none;
}

.carousel-button:hover {
  background: var(--accent-color);
  color: white;
}

.carousel-button--left { left: -25px; }
.carousel-button--right { right: -25px; }

@media (max-width: 950px) {
  .carousel-button--left { left: 10px; }
  .carousel-button--right { right: 10px; }
}

.carousel-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
  position: absolute;
  bottom: 10px;
  width: 100%;
}

.carousel-indicator {
  border: none;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}

.carousel-indicator:hover {
  opacity: 1;
}

.carousel-indicator.current-indicator {
  background: var(--accent-color);
}

/* Event Grid */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.event-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.event-card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 0.8rem;
}

.media-placeholder {
  background: var(--media-placeholder-bg);
  border: 1px dashed var(--surface-border);
  border-radius: 8px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
/* Music Showcase Section */
.music-showcase {
    position: relative;
    padding: 4rem 2rem;
    background: var(--music-showcase-bg);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    margin-top: 4rem;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.music-showcase::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 50% ;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 120, 212, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.music-info {
    flex: 1.2;
    z-index: 1;
}

.music-tags {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.music-tag {
    background: rgba(0, 120, 212, 0.12);
    border: 1px solid rgba(0, 120, 212, 0.3);
    color: #4db8ff;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.music-info h2 {
    font-size: 2.8rem;
    margin: 0 0 1rem 0;
    background: var(--music-h2-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.music-info p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.victory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.victory-pill {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.victory-pill span {
    color: #ffd700; /* Gold */
    font-size: 1.2rem;
}

.victory-pill:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    background: rgba(0, 120, 212, 0.05);
}

.music-visuals {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    min-height: 300px;
}

/* Audio Wave Animation */
.visualizer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
}

.visualizer-bar {
    width: 6px;
    background: linear-gradient(to top, var(--accent-color), #00c6ff);
    border-radius: 4px;
    animation: wave 1.2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { height: 20%; }
    50% { height: 100%; }
}

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

.play-badge {
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 120, 212, 0.5);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.play-badge:hover {
    transform: translate(-50%, -50%) scale(1.15);
    background: #00c6ff;
    box-shadow: 0 0 50px rgba(0, 198, 255, 0.6);
}

.play-badge svg {
    width: 30px;
    height: 30px;
    fill: white;
    margin-left: 4px;
}

@media (max-width: 900px) {
    .music-showcase {
        flex-direction: column;
        padding: 3rem 1.5rem;
        gap: 2rem;
    }
    .music-info h2 {
        font-size: 2.2rem;
    }
    .music-visuals {
        width: 100%;
        min-height: 200px;
    }
}

/* Theme Toggle Switch */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
}

.theme-switch {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 44px;
  margin: 0;
}

.theme-switch input {
  display: none;
}

.slider {
  background-color: rgba(255, 255, 255, 0.2);
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: .4s;
  border-radius: 24px;
  border: 1px solid var(--surface-border);
}

.slider:before {
  background-color: #fff;
  bottom: 3px;
  content: "";
  height: 16px;
  left: 4px;
  position: absolute;
  transition: .4s;
  width: 16px;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }
  .nav-brand {
    font-size: 1.8rem;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
  main {
    padding: 1.5rem 1rem;
  }
  .card {
    padding: 1.2rem;
  }
  .hero {
    padding: 3rem 0.5rem;
  }
  .hero h1 {
    font-size: 2.5rem;
  }
  .hero p {
    font-size: 1rem;
  }
  .subject-grid, .events-grid {
    grid-template-columns: 1fr;
  }
  .topic-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem;
    padding: 1rem 0;
  }
  .topic-item .actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .topic-item .actions .button {
    flex: 1 1 calc(50% - 0.8rem);
    text-align: center;
    padding: 0.75rem 0.5rem;
  }
  .topic-item .actions form {
    width: 100%;
    display: block !important;
  }
  .topic-item .actions form .button {
    width: 100%;
  }
  .accordion-header {
    padding: 1rem !important;
  }
}
