/* 
 * PlanTicket Dashboard stylesheet
 * Pure Vanilla CSS - Dark Mode & Glassmorphism Design
 */

:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(17, 24, 39, 0.6);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  
  /* Neon Palette */
  --neon-purple: #a78bfa;
  --neon-cyan: #22d3ee;
  --neon-emerald: #34d399;
  --neon-rose: #fb7185;
  
  /* Gradients */
  --purple-glow: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 60%);
  --cyan-glow: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, transparent 60%);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

/* Background Ambient Glows */
.background-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
.background-glow::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 20%;
  width: 600px;
  height: 600px;
  background: var(--purple-glow);
}
.background-glow::after {
  content: '';
  position: absolute;
  bottom: 10%;
  right: 10%;
  width: 600px;
  height: 600px;
  background: var(--cyan-glow);
}

.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Glassmorphism Panel Helper */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: var(--transition-smooth);
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(17, 24, 39, 0.4);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  border-radius: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-emoji {
  font-size: 2.5rem;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(3deg); }
}

.logo-text h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--text-primary), var(--neon-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}

.logo-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.database-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  border: 1px solid var(--panel-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-rose);
  box-shadow: 0 0 10px var(--neon-rose);
}

.database-status.active .status-dot {
  background-color: var(--neon-emerald);
  box-shadow: 0 0 10px var(--neon-emerald);
}

.status-text {
  font-size: 0.8rem;
  font-weight: 500;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stats-grid div:nth-child(1).stat-card::before { background: var(--neon-purple); }
.stats-grid div:nth-child(2).stat-card::before { background: var(--neon-cyan); }
.stats-grid div:nth-child(3).stat-card::before { background: var(--neon-emerald); }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-info h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-info .price-val {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.stat-info .price-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Loading animations */
.stat-card.loading .price-val {
  color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  width: 120px;
  height: 40px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Chart Panel */
.chart-section {
  padding: 2rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.chart-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-controls {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem;
  border-radius: 30px;
  border: 1px solid var(--panel-border);
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  background: linear-gradient(135deg, #7c3aed, #0891b2);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
}

/* History Table Section */
.history-section {
  padding: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

.record-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.history-table th {
  background-color: rgba(17, 24, 39, 0.8);
  color: var(--neon-cyan);
  font-weight: 600;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.history-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.history-table tbody tr {
  transition: var(--transition-smooth);
  background-color: rgba(17, 24, 39, 0.2);
}

.history-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.history-table tbody tr:hover td {
  color: var(--text-primary);
}

/* Status Indicators inside Table */
.dest-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}
.dest-badge.fuk { background: rgba(167, 139, 250, 0.15); color: var(--neon-purple); border: 1px solid rgba(167, 139, 250, 0.3); }
.dest-badge.ngo { background: rgba(34, 211, 238, 0.15); color: var(--neon-cyan); border: 1px solid rgba(34, 211, 238, 0.3); }
.dest-badge.cts { background: rgba(52, 211, 153, 0.15); color: var(--neon-emerald); border: 1px solid rgba(52, 211, 153, 0.3); }

.price-text {
  font-weight: 600;
  color: var(--text-primary);
}

.cheapest-row {
  background-color: rgba(52, 211, 153, 0.05) !important;
}
.cheapest-row .price-text {
  color: var(--neon-emerald);
}

.go-flights-link {
  color: var(--neon-cyan);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 1px dashed var(--neon-cyan);
  transition: var(--transition-smooth);
}

.go-flights-link:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* Placeholder and empty state */
.placeholder-row td {
  text-align: center;
  padding: 3rem !important;
  color: var(--text-secondary);
}

/* Responsive adjustment */
@media (max-width: 768px) {
  body {
    padding: 1rem 0.5rem;
  }
  .main-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .chart-wrapper {
    height: 300px;
  }
}
