/* ============================================================
   GoSMS - Design System
   Glassmorphism + Violet/Indigo gradients + motion
   Tailwind is loaded via CDN in header.php; this file adds
   custom tokens, keyframes and component classes on top of it.
   ============================================================ */

:root {
  --color-primary-from: #7C3AED;
  --color-primary-to: #4F46E5;
  --color-cyan: #22D3EE;
  --color-fuchsia: #E879F9;
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #0F172A;
  --color-text-muted: #64748B;
  --color-success: #22C55E;
  --color-danger: #EF4444;
  --color-warning: #F59E0B;
  --radius-card: 1.25rem;
}

* { scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---------------- Gradient utilities ---------------- */
.text-gradient {
  background: linear-gradient(90deg, var(--color-primary-from), var(--color-primary-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bg-gradient-primary {
  background: linear-gradient(135deg, var(--color-primary-from), var(--color-primary-to));
}

.bg-gradient-accent {
  background: linear-gradient(135deg, var(--color-fuchsia), var(--color-primary-to));
}

/* ---------------- Glassmorphism ---------------- */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------------- Cards ---------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px rgba(79, 70, 229, 0.25);
  border-color: rgba(124, 58, 237, 0.25);
}

.card-glass {
  border-radius: var(--radius-card);
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .875rem;
  padding: .65rem 1.4rem;
  border-radius: 9999px;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-from), var(--color-primary-to));
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.55);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 12px 28px -6px rgba(79, 70, 229, 0.7); }

.btn-glass {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(15,23,42,0.08);
  color: var(--color-text);
}
.btn-glass:hover { background: rgba(255,255,255,0.85); }

.btn-outline {
  border: 1.5px solid var(--color-primary-to);
  color: var(--color-primary-to);
  background: transparent;
}
.btn-outline:hover { background: rgba(79,70,229,0.08); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(1.08); }

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-ghost {
  color: var(--color-text-muted);
  background: transparent;
}
.btn-ghost:hover { background: rgba(15,23,42,0.05); color: var(--color-text); }

.btn-sm { padding: .4rem 1rem; font-size: .8rem; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .65rem;
  border-radius: 9999px;
  text-transform: capitalize;
}
.badge-success { background: rgba(34,197,94,.12); color: #16a34a; }
.badge-danger  { background: rgba(239,68,68,.12); color: #dc2626; }
.badge-warning { background: rgba(245,158,11,.12); color: #b45309; }
.badge-neutral { background: rgba(100,116,139,.12); color: #475569; }

/* ---------------- Inputs ---------------- */
.field {
  position: relative;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: .85rem 1rem;
  border-radius: .85rem;
  border: 1.5px solid rgba(15,23,42,0.1);
  background: #fff;
  font-size: .9rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary-to);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
}
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: .4rem;
}
.field .hint { font-size: .75rem; color: var(--color-text-muted); margin-top: .35rem; }
.field .error-text { font-size: .75rem; color: var(--color-danger); margin-top: .35rem; }
.field.has-error input,
.field.has-error textarea { border-color: var(--color-danger); animation: shake .35s; }

/* Password toggle icon inside input */
.field .toggle-pass {
  position: absolute;
  right: .9rem;
  top: 2.35rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

/* ---------------- Toggle switch ---------------- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 9999px; transition: .25s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--color-primary-from), var(--color-primary-to)); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: 1rem; border: 1px solid rgba(15,23,42,0.06); }
table.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.data-table thead th {
  text-align: left; padding: .85rem 1.1rem; background: #F8FAFC;
  color: var(--color-text-muted); font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid rgba(15,23,42,0.06);
}
table.data-table tbody td { padding: .85rem 1.1rem; border-bottom: 1px solid rgba(15,23,42,0.05); }
table.data-table tbody tr { transition: background .15s ease; }
table.data-table tbody tr:hover { background: rgba(124,58,237,0.035); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* Mobile: let wide tables scroll horizontally instead of squeezing
   columns unreadably or breaking the page layout. */
@media (max-width: 767px) {
  table.data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  table.data-table thead, table.data-table tbody, table.data-table tr {
    display: table;
    width: 100%;
    table-layout: auto;
  }
}

/* ---------------- Sidebar ---------------- */
.sidebar-link {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1rem; border-radius: .85rem;
  color: #cbd5e1; font-size: .875rem; font-weight: 500;
  transition: all .2s ease; position: relative;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(79,70,229,0.35));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.sidebar-link.active::before {
  content: ""; position: absolute; left: -1rem; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%; border-radius: 9999px;
  background: linear-gradient(180deg, var(--color-cyan), var(--color-fuchsia));
}

/* Light (admin) sidebar variant */
.sidebar-link-light { color: var(--color-text-muted); }
.sidebar-link-light:hover { background: rgba(124,58,237,0.06); color: var(--color-text); }
.sidebar-link-light.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(79,70,229,0.1));
  color: var(--color-primary-to);
  font-weight: 600;
}

/* ---------------- Modals ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-panel {
  background: #fff; border-radius: 1.5rem; max-width: 32rem; width: 100%;
  box-shadow: 0 30px 60px -12px rgba(15,23,42,0.35);
  animation: scaleIn .25s ease;
  max-height: 90vh; overflow-y: auto;
}

/* ---------------- Skeleton / shimmer ---------------- */
.skeleton {
  background: linear-gradient(90deg, #eef0f4 25%, #f7f8fa 37%, #eef0f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: .5rem;
}

/* ---------------- Floating decorative blobs ---------------- */
.blob {
  position: absolute; border-radius: 9999px; filter: blur(60px); opacity: .55;
  animation: float 8s ease-in-out infinite;
}

/* ---------------- Keyframes ---------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-24px) translateX(14px); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 8px 20px -6px rgba(79,70,229,0.5); }
  50% { box-shadow: 0 8px 34px -4px rgba(124,58,237,0.85); }
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-up { animation: fadeInUp .6s ease both; }
.animate-glow { animation: glowPulse 2.4s ease-in-out infinite; }
.animate-spin-slow { animation: spin 12s linear infinite; }

/* Stagger helper - pair with JS adding [data-stagger] and incremental delay */
[data-reveal] { opacity: 0; }
[data-reveal].revealed { animation: fadeInUp .6s ease both; }

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.35); border-radius: 9999px; }
::-webkit-scrollbar-track { background: transparent; }
