/* ===========================
   Base & Theme
=========================== */
:root {
  --primary: #4b70ff;
  --primary-light: #7fc7ff;
  --accent: #ff6b6b;
  --bg-light: #f9faff;
  --bg-dark: #1e1e2f;
  --card-light: #ffffff;
  --card-dark: #2a2a3d;
  --text-light: #222;
  --text-dark: #eee;
  --muted-light: #6b7280;
  --muted-dark: #a1a1b5;
  --radius: 1rem;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --transition: all 0.3s ease;
}

[data-theme="light"] {
  --bg: var(--bg-light);
  --card: var(--card-light);
  --text: var(--text-light);
  --muted: var(--muted-light);
}

[data-theme="dark"] {
  --bg: var(--bg-dark);
  --card: var(--card-dark);
  --text: var(--text-dark);
  --muted: var(--muted-dark);
}

/* ===========================
   Global
=========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: var(--transition);
}

img { max-width: 100%; display: block; }

h1, h2, h3 { font-weight: 700; line-height: 1.2; }
p { margin: 0.5rem 0; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.8; transform: translateY(-2px); }

/* ===========================
   Header / Topbar
=========================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  animation: fadeDown 0.6s ease forwards;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  animation: spinIn 0.6s ease forwards;
}

.brand-text h1 { font-size: 1.3rem; }
.subtitle { font-size: 0.85rem; color: var(--muted); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  font-size: 1.2rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
  animation: spinIn 0.6s ease forwards;
}
.icon-btn:nth-child(1) { animation-delay: 0.2s; }
.icon-btn:nth-child(2) { animation-delay: 0.4s; }
.icon-btn:hover { transform: rotate(15deg) scale(1.2); }

/* ===========================
   Hero
=========================== */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-light), var(--accent));
  background-size: 300% 300%;
  color: #fff;
  text-align: center;
  padding: 4rem 2rem;
  border-radius: var(--radius);
  margin: 1.5rem auto;
  max-width: 1200px;
  box-shadow: var(--shadow);
  animation: gradientShift 8s ease infinite, fadeUp 0.8s ease forwards;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  animation: fadeIn 1s ease forwards;
}
.tagline {
  color: rgba(255,255,255,0.9);
  margin-bottom: 1.5rem;
  animation: fadeIn 1.2s ease forwards;
}
.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* ===========================
   Layout
=========================== */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

/* ===========================
   Cards
=========================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}
.card:hover { transform: translateY(-6px) scale(1.02); }
.card:nth-child(1) { animation-delay: 0.2s; }
.card:nth-child(2) { animation-delay: 0.4s; }
.card:nth-child(3) { animation-delay: 0.6s; }

.card h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* ===========================
   Stats Row
=========================== */
.stats-row {
  display: flex;
  justify-content: space-around;
  text-align: center;
  margin-bottom: 1.5rem;
}
.stat {
  opacity: 0;
  animation: slideInRight 0.7s ease forwards;
}
.stat:nth-child(1) { animation-delay: 0.2s; }
.stat:nth-child(2) { animation-delay: 0.4s; }
.stat:nth-child(3) { animation-delay: 0.6s; }
.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}
.stat strong {
  font-size: 1.4rem;
  color: var(--primary);
}

/* ===========================
   Lists
=========================== */
.list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}
.list li {
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  transition: var(--transition);
  opacity: 0;
  animation: slideInLeft 0.8s ease forwards;
}
.list li:nth-child(1) { animation-delay: 0.2s; }
.list li:nth-child(2) { animation-delay: 0.4s; }
.list li:nth-child(3) { animation-delay: 0.6s; }
.list li:nth-child(4) { animation-delay: 0.8s; }
.list li:nth-child(5) { animation-delay: 1s; }
.list li:hover { background: var(--primary-light); color: #fff; transform: translateX(6px); }

/* ===========================
   Inputs / Buttons
=========================== */
.input, select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--muted);
  margin: 0.5rem 0 1rem;
  background: var(--card);
  color: var(--text);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}
.btn.primary {
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover { background: var(--primary-light); animation: pulse 1.5s infinite; }

.btn.ghost {
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--text);
}
.btn.ghost:hover { background: var(--muted); color: #fff; }

.btn.cta {
  background: #fff;
  color: var(--primary);
}
.btn.cta:hover { opacity: 0.9; transform: scale(1.05); }

.row-actions { display: flex; gap: 0.5rem; }

/* ===========================
   Footer
=========================== */
.footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  animation: fadeIn 1s ease forwards;
}

/* ===========================
   Modal & Toast
=========================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal-backdrop[aria-hidden="false"] { display: flex; }

.modal {
  background: var(--card);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  opacity: 0;
  animation: scaleIn 0.6s ease forwards;
}

.toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: grid;
  gap: 0.5rem;
}
.toasts > * {
  opacity: 0;
  animation: toastSlide 0.6s ease forwards;
}
.toasts > *:nth-child(1) { animation-delay: 0.1s; }
.toasts > *:nth-child(2) { animation-delay: 0.3s; }
.toasts > *:nth-child(3) { animation-delay: 0.5s; }

/* ===========================
   Animations
=========================== */
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes slideInLeft {
  0% { opacity: 0; transform: translateX(-30px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  0% { opacity: 0; transform: translateX(30px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes spinIn {
  0% { opacity: 0; transform: rotate(-180deg) scale(0.5); }
  100% { opacity: 1; transform: rotate(0) scale(1); }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(75,112,255,0.6); }
  70% { box-shadow: 0 0 0 15px rgba(75,112,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(75,112,255,0); }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes toastSlide {
  0% { opacity: 0; transform: translateX(100%); }
  100% { opacity: 1; transform: translateX(0); }
}
/* Skeleton Loader Base */
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #ddd 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

/* Skeleton Variants */
.skeleton-text {
  height: 16px;
  width: 80%;
  margin: 8px 0;
}

.skeleton-thumb {
  height: 120px;
  width: 100%;
  margin: 8px 0;
}

/* Shimmer Animation */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}
