/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Dark Theme (default) */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.09);
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --accent: #7c5cfc;
  --accent-glow: rgba(124, 92, 252, 0.4);
  --accent-secondary: #00d4ff;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --timer-bg: rgba(124, 92, 252, 0.12);
  --success: #00e676;
}

[data-theme="light"] {
  --bg-primary: #f0f2f8;
  --bg-secondary: #ffffff;
  --bg-card: rgba(0, 0, 0, 0.03);
  --bg-card-hover: rgba(0, 0, 0, 0.06);
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a7a;
  --accent: #6c4ce0;
  --accent-glow: rgba(108, 76, 224, 0.25);
  --accent-secondary: #0099cc;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --timer-bg: rgba(108, 76, 224, 0.08);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ===== ANIMATED BACKGROUND ===== */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.gradient-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: radial-gradient(ellipse at 20% 20%, rgba(124, 92, 252, 0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
  transition: opacity 0.4s ease;
}

[data-theme="light"] .gradient-overlay {
  background: radial-gradient(ellipse at 20% 20%, rgba(108, 76, 224, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(0, 153, 204, 0.06) 0%, transparent 50%);
}

/* ===== APP CONTAINER ===== */
.app {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: rgba(10, 10, 26, 0.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.4s ease;
}

[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.75);
}

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 1.15rem;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* ===== MAIN CONTENT ===== */
.main {
  flex: 1;
  padding: 1.5rem;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* ===== EXAM LIST VIEW ===== */
.view {
  display: none;
  animation: fadeIn 0.35s ease;
}

.view.active {
  display: block;
}

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

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
}

.page-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.exam-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.exam-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(8px);
}

.exam-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 20px var(--accent-glow);
}

.exam-card-left h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.exam-card-left p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.exam-card-right {
  font-size: 1.5rem;
  color: var(--accent);
  transition: transform 0.25s ease;
}

.exam-card:hover .exam-card-right {
  transform: translateX(4px);
}

/* ===== COUNTDOWN VIEW ===== */
.countdown-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.back-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.countdown-title {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { filter: drop-shadow(0 0 4px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 12px var(--accent-glow)); }
}

.countdown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 1rem 0 2rem;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 520px;
}

.timer-box {
  background: var(--timer-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.4rem 0.5rem;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: boxGlow 4s ease-in-out infinite;
}

@keyframes boxGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(124, 92, 252, 0); }
  50% { box-shadow: 0 0 20px var(--accent-glow); }
}

.timer-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  opacity: 0.8;
}

.timer-value {
  font-size: 2.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  letter-spacing: -1px;
  animation: numberPulse 2s ease-in-out infinite;
}

@keyframes numberPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.timer-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  font-weight: 600;
}

.target-date {
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

.fullscreen-btn {
  margin-top: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.fullscreen-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ===== FULLSCREEN MODE ===== */
body.fullscreen-mode .header,
body.fullscreen-mode .branding,
body.fullscreen-mode .countdown-header,
body.fullscreen-mode .target-date,
body.fullscreen-mode .fullscreen-btn {
  display: none !important;
}

body.fullscreen-mode .main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  max-width: 100%;
}

body.fullscreen-mode .countdown-container {
  padding: 0;
}

body.fullscreen-mode .timer-grid {
  max-width: 700px;
  gap: 1.5rem;
}

body.fullscreen-mode .timer-box {
  padding: 2rem 1rem;
}

body.fullscreen-mode .timer-value {
  font-size: 3.5rem;
}

body.fullscreen-mode .timer-label {
  font-size: 0.9rem;
}

/* Exit fullscreen button (only in fullscreen) */
.exit-fs-btn {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
}

body.fullscreen-mode .exit-fs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.exit-fs-btn:hover {
  background: var(--accent);
  transform: scale(1.08);
}

/* ===== BRANDING ===== */
.branding {
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: rgba(10, 10, 26, 0.55);
  backdrop-filter: blur(12px);
  margin-top: auto;
}

[data-theme="light"] .branding {
  background: rgba(255, 255, 255, 0.75);
}

.made-by {
  font-size: 0.78rem;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  font-weight: 500;
  opacity: 0.85;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  padding: 0.55rem 1.2rem;
  border-radius: 50px;
  background: linear-gradient(135deg, rgba(42, 171, 238, 0.12), rgba(34, 158, 217, 0.08));
  border: 1px solid rgba(42, 171, 238, 0.25);
  transition: all 0.3s ease;
}

.brand-link:hover {
  background: linear-gradient(135deg, rgba(42, 171, 238, 0.22), rgba(34, 158, 217, 0.15));
  border-color: rgba(42, 171, 238, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(42, 171, 238, 0.2);
}

.brand-link svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(42, 171, 238, 0.4));
}

.brand-text {
  background: linear-gradient(135deg, #2AABEE, #1a9fd6 40%, #0d8ec4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .timer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }

  .timer-value {
    font-size: 2rem;
  }

  .page-title {
    font-size: 1.35rem;
  }

  .countdown-title {
    font-size: 1.25rem;
  }

  .main {
    padding: 1.25rem 1rem;
  }

  body.fullscreen-mode .timer-value {
    font-size: 2.6rem;
  }

  body.fullscreen-mode .timer-grid {
    max-width: 340px;
  }
}

@media (max-width: 380px) {
  .timer-value {
    font-size: 1.7rem;
  }
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}
