/* ============================================
   CSS Design System - Countdown Tracker
   ============================================ */

:root {
  /* Colors - Blue Ocean Theme */
  --bg-primary: #040d1a;
  --bg-secondary: #081828;
  --bg-card: rgba(56, 189, 248, 0.03);
  --bg-card-hover: rgba(56, 189, 248, 0.07);
  --bg-glass: rgba(56, 189, 248, 0.04);
  --border-glass: rgba(56, 189, 248, 0.1);
  --border-glass-hover: rgba(56, 189, 248, 0.22);

  --text-primary: #e8f4fd;
  --text-secondary: rgba(186, 220, 248, 0.65);
  --text-muted: rgba(148, 200, 240, 0.35);

  --accent-blue: #3b82f6;
  --accent-sky: #38bdf8;
  --accent-cyan: #22d3ee;
  --accent-teal: #2dd4bf;
  --accent-indigo: #6366f1;
  --accent-light-blue: #7dd3fc;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;

  --gradient-primary: linear-gradient(135deg, #1d4ed8, #3b82f6, #38bdf8);
  --gradient-secondary: linear-gradient(135deg, #22d3ee, #3b82f6);
  --gradient-success: linear-gradient(135deg, #2dd4bf, #22d3ee);
  --gradient-warning: linear-gradient(135deg, #fbbf24, #f59e0b);
  --gradient-danger: linear-gradient(135deg, #f87171, #ef4444);

  /* Status Colors */
  --status-completed: #2dd4bf;
  --status-completed-bg: rgba(45, 212, 191, 0.12);
  --status-inprogress: #38bdf8;
  --status-inprogress-bg: rgba(56, 189, 248, 0.12);
  --status-pending: #fbbf24;
  --status-pending-bg: rgba(251, 191, 36, 0.12);
  --status-notstarted: rgba(148, 200, 240, 0.25);
  --status-notstarted-bg: rgba(148, 200, 240, 0.05);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 30px rgba(56, 189, 248, 0.25);
  --shadow-glow-cyan: 0 0 30px rgba(34, 211, 238, 0.25);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Noto Sans Thai', 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ============================================
   Animated Background
   ============================================ */

.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.bg-orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #1d4ed8, transparent 70%);
  top: -10%;
  left: -10%;
  animation-delay: 0s;
  animation-duration: 25s;
}

.bg-orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #0ea5e9, transparent 70%);
  top: 50%;
  right: -10%;
  animation-delay: -5s;
  animation-duration: 20s;
}

.bg-orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #22d3ee, transparent 70%);
  bottom: -5%;
  left: 30%;
  animation-delay: -10s;
  animation-duration: 22s;
}

.bg-orb-4 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #2dd4bf, transparent 70%);
  top: 30%;
  left: 50%;
  animation-delay: -15s;
  animation-duration: 18s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -30px) scale(1.05); }
  50% { transform: translate(-30px, 50px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ============================================
   Container
   ============================================ */

.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* ============================================
   Header
   ============================================ */

.header {
  text-align: center;
  padding: var(--space-xl) var(--space-xl);
  position: relative;
  margin-bottom: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-icon-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInDown 0.8s ease;
}

.header-icon-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.2), transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

.header-icon-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: rgba(34, 211, 238, 0.05);
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.3) inset, 0 0 15px rgba(34, 211, 238, 0.3);
}

.header-icon-dashed-ring {
  position: absolute;
  top: 10px;
  left: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  border-radius: 50%;
  border: 1px dashed rgba(34, 211, 238, 0.5);
  animation: rotateDashedRing 20s linear infinite;
}

@keyframes rotateDashedRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.header-icon {
  width: 44px;
  height: 44px;
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.8));
  position: relative;
  z-index: 2;
}

.header-title-server {
  font-family: 'Inter', sans-serif;
  font-size: clamp(3.5rem, 10vw, 6rem);
  font-weight: 900;
  color: #e0f2fe;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.6), 0 0 30px rgba(34, 211, 238, 0.4), 0 0 50px rgba(34, 211, 238, 0.2);
  animation: fadeInUp 0.8s ease 0.2s both;
  line-height: 1;
}

.header-subtitle-main {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-sm);
  animation: fadeInUp 0.8s ease 0.4s both;
}

.header-subtitle-small {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--text-secondary);
  font-weight: 500;
  animation: fadeInUp 0.8s ease 0.6s both;
}

/* ============================================
   Countdown Section
   ============================================ */

.countdown-section {
  margin-bottom: var(--space-2xl);
  animation: fadeInUp 0.8s ease 0.6s both;
}

.countdown-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-2xl);
}

.countdown-card {
  perspective: 800px;
}

.countdown-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: var(--transition-base);
  min-width: 130px;
}

.countdown-card:hover .countdown-card-inner {
  border-color: var(--border-glass-hover);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-blue);
}

.countdown-ring {
  position: relative;
  width: 100px;
  height: 100px;
}

.countdown-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 4;
}

.ring-progress {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-days { stroke: #1d4ed8; }
.ring-hours { stroke: #3b82f6; }
.ring-minutes { stroke: #38bdf8; }
.ring-seconds { stroke: #22d3ee; }

.countdown-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Inter', monospace;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.countdown-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.countdown-separator {
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--text-muted);
  padding-bottom: 30px;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Overall Progress */
.overall-progress {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.progress-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.progress-percent {
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.progress-bar-track {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar-glow {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  filter: blur(8px);
  opacity: 0.5;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Stats Section
   ============================================ */

.stats-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  animation: fadeInUp 0.8s ease 0.8s both;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-completed { background: var(--status-completed-bg); color: var(--status-completed); }
.stat-icon-inprogress { background: var(--status-inprogress-bg); color: var(--status-inprogress); }
.stat-icon-pending { background: var(--status-pending-bg); color: var(--status-pending); }
.stat-icon-notstarted { background: var(--status-notstarted-bg); color: var(--status-notstarted); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================
   Updates Section
   ============================================ */

.updates-section {
  animation: fadeInUp 0.8s ease 1s both;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-title svg {
  color: var(--accent-sky);
}

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-base);
  font-family: inherit;
}

.filter-pill:hover {
  border-color: var(--border-glass-hover);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.filter-pill.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  font-weight: 600;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #1d4ed8, #3b82f6, #38bdf8, #22d3ee, transparent);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-md);
  opacity: 0;
  transform: translateX(-20px);
  animation: slideInRight 0.5s ease forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(4) { animation-delay: 0.4s; }
.timeline-item:nth-child(5) { animation-delay: 0.5s; }
.timeline-item:nth-child(6) { animation-delay: 0.6s; }
.timeline-item:nth-child(7) { animation-delay: 0.7s; }
.timeline-item:nth-child(8) { animation-delay: 0.8s; }
.timeline-item:nth-child(9) { animation-delay: 0.9s; }
.timeline-item:nth-child(10) { animation-delay: 1.0s; }

/* Timeline dot */
.timeline-dot {
  position: absolute;
  left: -28px;
  top: 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  border: 3px solid var(--bg-primary);
}

.timeline-dot-completed {
  background: var(--status-completed);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.4);
}

.timeline-dot-inprogress {
  background: var(--status-inprogress);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  animation: dotPulse 2s ease-in-out infinite;
}

.timeline-dot-pending {
  background: var(--status-pending);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

.timeline-dot-notstarted {
  background: rgba(148, 200, 240, 0.15);
  border-color: var(--bg-primary);
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(56, 189, 248, 0.4); }
  50% { box-shadow: 0 0 20px rgba(56, 189, 248, 0.7); }
}

.timeline-dot svg {
  width: 10px;
  height: 10px;
  color: white;
  stroke-width: 3;
}

/* Timeline Card */
.timeline-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: var(--transition-base);
  cursor: default;
}

.timeline-card:hover {
  border-color: var(--border-glass-hover);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.timeline-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.timeline-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge-completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}

.status-badge-inprogress {
  background: var(--status-inprogress-bg);
  color: var(--status-inprogress);
}

.status-badge-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
}

.status-badge-notstarted {
  background: var(--status-notstarted-bg);
  color: var(--status-notstarted);
}

.timeline-card-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}

.timeline-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-sky);
  font-size: 0.7rem;
  font-weight: 500;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state p {
  font-size: 1rem;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  text-align: center;
  padding: var(--space-2xl) 0;
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-link {
  margin-top: var(--space-sm);
}

.footer-link a {
  color: var(--accent-sky);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-fast);
}

.footer-link a:hover {
  color: var(--accent-cyan);
}

/* ============================================
   Animations
   ============================================ */

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

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  .container {
    padding: var(--space-md);
  }

  .countdown-grid {
    gap: var(--space-sm);
  }

  .countdown-card-inner {
    min-width: 100px;
    padding: var(--space-md);
  }

  .countdown-ring {
    width: 75px;
    height: 75px;
  }

  .countdown-value {
    font-size: 1.5rem;
  }

  .countdown-separator {
    font-size: 1.5rem;
    padding-bottom: 20px;
  }

  .stats-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-pills {
    width: 100%;
    overflow-x: auto;
    padding-bottom: var(--space-xs);
  }

  .header-title {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .countdown-grid {
    gap: 4px;
  }

  .countdown-card-inner {
    min-width: 70px;
    padding: var(--space-sm) var(--space-xs);
  }

  .countdown-ring {
    width: 58px;
    height: 58px;
  }

  .countdown-value {
    font-size: 1.2rem;
  }

  .countdown-separator {
    font-size: 1.2rem;
    padding-bottom: 15px;
  }

  .countdown-label {
    font-size: 0.65rem;
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-number {
    font-size: 1.2rem;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
