/* ===== Design System — My Planner Premium ===== */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-base: #0f1117;
  --bg-surface: #161922;
  --bg-card: #1c1f2e;
  --bg-card-hover: #222640;
  --bg-input: #1a1d2b;
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text-primary: #f1f3f9;
  --text-secondary: #8b8fa7;
  --text-muted: #5c6078;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --primary-glow-strong: rgba(99, 102, 241, 0.25);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.15);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.12);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.12);
  --accent-sky: #38bdf8;
  --accent-sky-glow: rgba(56, 189, 248, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: "Kanit", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(56, 189, 248, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(245, 158, 11, 0.02) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Layout ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

/* ===== Top Navigation Bar ===== */
.topbar {
  background: rgba(22, 25, 34, 0.75);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md), var(--shadow-glow);
  margin-bottom: 28px;
  position: sticky;
  top: 12px;
  z-index: 100;
  transition: var(--transition);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #a855f7);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
  transition: var(--transition);
}

.brand-mark:hover {
  transform: scale(1.05) rotate(-3deg);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav a {
  text-decoration: none;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  opacity: 0;
  transition: var(--transition);
  border-radius: inherit;
}

.nav a:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.nav a.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  position: relative;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  position: relative;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 600px;
}

/* ===== Card Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  opacity: 0;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.06);
  background: var(--bg-card-hover);
}

.card:hover::before { opacity: 1; }

.card:nth-child(1)::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.card:nth-child(2)::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.card:nth-child(3)::before { background: linear-gradient(90deg, #10b981, #34d399); }

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-primary:active { transform: translateY(0); }

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.4);
  transform: translateY(-1px);
}

.btn-soft {
  background: var(--primary-glow);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.btn-soft:hover {
  background: var(--primary-glow-strong);
  border-color: rgba(99, 102, 241, 0.3);
}

/* ===== Content Grid (2-column) ===== */
.content-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

/* ===== Panel / Card ===== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.panel h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel h3::before {
  content: '';
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--primary), #a855f7);
  flex-shrink: 0;
}

/* ===== Form Elements ===== */
.form-grid {
  display: grid;
  gap: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

input:hover, textarea:hover, select:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--primary-glow), var(--shadow-sm);
  background: rgba(99, 102, 241, 0.03);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238b8fa7' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* ===== List Items ===== */
.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  transition: var(--transition);
  animation: fadeInUp 0.3s ease both;
}

.item:hover {
  background: rgba(99, 102, 241, 0.04);
  border-color: rgba(99, 102, 241, 0.12);
  transform: translateX(4px);
}

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

.item:nth-child(1) { animation-delay: 0ms; }
.item:nth-child(2) { animation-delay: 50ms; }
.item:nth-child(3) { animation-delay: 100ms; }
.item:nth-child(4) { animation-delay: 150ms; }
.item:nth-child(5) { animation-delay: 200ms; }

.item-main {
  flex: 1;
  min-width: 0;
}

.item-main h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: var(--transition);
}

.badge:first-child {
  background: var(--primary-glow);
  border-color: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
}

.note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

.item-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

/* ===== Empty State ===== */
.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.01);
  font-size: 0.92rem;
}

/* ===== Summary Grid (Plan Page) ===== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.summary-box::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.summary-box:nth-child(1)::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.summary-box:nth-child(2)::before { background: linear-gradient(90deg, var(--accent-amber), #fbbf24); }
.summary-box:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-emerald), #34d399); }

.summary-box:hover {
  background: rgba(99, 102, 241, 0.04);
  border-color: rgba(99, 102, 241, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-box h4 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-box strong {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Utility ===== */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Plan details panel ===== */
.panel[style*="background"] {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid var(--border);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* ===== Loading Animation ===== */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

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

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .container { padding: 12px 16px 60px; }

  .content-grid { grid-template-columns: 1fr; }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 12px;
  }

  .nav { width: 100%; }
  .nav a { font-size: 0.82rem; padding: 7px 11px; }

  .form-row { grid-template-columns: 1fr; }

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

  .item-actions { width: 100%; }

  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 1.6rem; }

  .summary-grid { grid-template-columns: 1fr; }

  .flex-between { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .nav a { font-size: 0.78rem; padding: 6px 10px; }
}
