/* ============================================================================
   Keyhan Studio — Base Styles
   Dark navy + electric blue theme, glassmorphism
   ============================================================================ */

:root {
  --navy-deep: #050816;
  --navy: #0a0e1a;
  --navy-light: #111827;
  --navy-card: #151c2e;
  --cyan: #38bdf8;
  --cyan-bright: #7dd3fc;
  --cyan-dim: #0ea5e9;
  --purple: #a78bfa;
  --purple-bright: #c4b5fd;
  --text: #e0e7ff;
  --text-dim: rgba(224, 231, 255, 0.6);
  --text-bright: #f0f4ff;
  --border: rgba(56, 189, 248, 0.08);
  --border-light: rgba(56, 189, 248, 0.18);
  --glow-cyan: rgba(56, 189, 248, 0.3);
  --glow-purple: rgba(167, 139, 250, 0.3);
  --danger: #f87171;
  --success: #34d399;
}

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

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

body {
  background-color: var(--navy-deep);
  color: var(--text);
  font-family: "Inter", "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* --- Background Grid --- */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* --- Glow Orbs --- */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-orb-cyan { background: var(--glow-cyan); }
.glow-orb-purple { background: var(--glow-purple); }

/* --- Glass Card --- */
.glass-card {
  background: rgba(21, 28, 46, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.08);
}

/* --- Gradient Text --- */
.gradient-text {
  background: linear-gradient(135deg, var(--cyan), var(--purple), var(--cyan-bright));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* --- Scroll Fade-in --- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-delay-1 { transition-delay: 0.1s; }
.fade-delay-2 { transition-delay: 0.2s; }
.fade-delay-3 { transition-delay: 0.3s; }
.fade-delay-4 { transition-delay: 0.4s; }
.fade-delay-5 { transition-delay: 0.5s; }
.fade-delay-6 { transition-delay: 0.6s; }

/* --- Section Divider --- */
.section-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  border-radius: 1px;
  margin: 0 auto;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 28px;
  border-radius: 12px;
  background: rgba(21, 28, 46, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 0.9rem;
  z-index: 1000;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(52, 211, 153, 0.4); }
.toast.error { border-color: rgba(248, 113, 113, 0.4); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}
.btn-primary {
  background: var(--cyan);
  color: var(--navy-deep);
}
.btn-primary:hover {
  background: var(--cyan-bright);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover {
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--text-bright);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--danger);
}
.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* --- Inputs --- */
.input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: rgba(21, 28, 46, 0.8);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: var(--text-dim); }
.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.1);
}

textarea.input {
  resize: vertical;
  min-height: 100px;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* --- Form Group --- */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 8, 22, 0.8);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal {
  background: var(--navy-light);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-bright);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* --- Table --- */
.table-wrap {
  background: rgba(21, 28, 46, 0.6);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(21, 28, 46, 0.4);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(56, 189, 248, 0.03); }
.empty-state {
  padding: 3rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-cyan {
  background: rgba(56, 189, 248, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.2);
}
.badge-purple {
  background: rgba(167, 139, 250, 0.15);
  color: var(--purple);
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.badge-green {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

/* --- Stat Cards --- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: rgba(21, 28, 46, 0.6);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.2s ease;
  overflow: hidden;
  min-width: 0;
}
.stat-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}
.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
}

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 1rem;
}
.loading-screen .spinner {
  width: 32px;
  height: 32px;
}

/* --- Toggle / Checkbox --- */
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle .slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--navy-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  transition: all 0.2s ease;
}
.toggle .slider::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.2s ease;
}
.toggle input:checked + .slider {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--cyan);
}
.toggle input:checked + .slider::before {
  transform: translateX(16px);
  background: var(--cyan);
}
