/* ============================================================
   MWSY — Light Glassmorphism theme
   Soft sky-gradient bg · frosted-glass cards · smooth motion
   ============================================================ */

:root {
  --bg-grad-1: #e0f2fe;   /* sky-100 */
  --bg-grad-2: #f0f9ff;   /* sky-50  */
  --bg-grad-3: #ecfeff;   /* cyan-50 */
  --bg-orb-1:  #7dd3fc;   /* sky-300 */
  --bg-orb-2:  #5eead4;   /* teal-300 */
  --bg-orb-3:  #c4b5fd;   /* violet-300 */

  --glass-bg:        rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-bg-hover:  rgba(255, 255, 255, 0.72);
  --glass-border:    rgba(255, 255, 255, 0.85);
  --glass-shadow:    0 8px 32px rgba(15, 23, 42, 0.08);
  --glass-shadow-hi: 0 12px 40px rgba(15, 23, 42, 0.12);

  --text:        #1e293b;    /* slate-800 */
  --text-strong: #0f172a;    /* slate-900 */
  --text-muted:  #64748b;    /* slate-500 */
  --text-dim:    #94a3b8;    /* slate-400 */

  --accent:      #0284c7;    /* sky-600 */
  --accent-2:    #7c3aed;    /* violet-600 */
  --accent-soft: #38bdf8;    /* sky-400 */
  --good:        #16a34a;
  --warn:        #d97706;
  --bad:         #dc2626;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  --ease:        cubic-bezier(.4, 0, .2, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 50%, var(--bg-grad-3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Floating ambient orbs */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: .55;
  pointer-events: none;
  animation: float 20s ease-in-out infinite;
}
body::before {
  width: 480px; height: 480px;
  background: var(--bg-orb-1);
  top: -120px; right: -120px;
}
body::after {
  width: 600px; height: 600px;
  background: var(--bg-orb-3);
  bottom: -160px; left: -160px;
  animation-delay: -10s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(40px, -30px); }
}

a { color: var(--accent); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--accent-2); }
.muted { color: var(--text-muted); }

/* -------- top bar -------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.04);
}
.topbar .brand strong {
  font-size: 20px;
  background: linear-gradient(135deg, #0369a1, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  letter-spacing: .02em;
}
.topbar .brand .muted { margin-left: 10px; font-size: 13px; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: all .25s var(--ease);
}
.topbar nav a:hover {
  background: var(--glass-bg);
  color: var(--text-strong);
  text-decoration: none;
}
.topbar nav a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
}

/* -------- containers -------- */
.container {
  max-width: 1320px;
  margin: 28px auto;
  padding: 0 22px;
}
.foot {
  text-align: center;
  padding: 30px 20px;
  font-size: 12px;
  color: var(--text-dim);
}

h1 {
  margin: 0 0 20px;
  font-size: 26px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -.01em;
}
h2 {
  margin: 22px 0 14px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-strong);
}

/* -------- card / glass -------- */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--glass-shadow);
  transition: transform .35s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
  animation: rise .5s var(--ease) backwards;
}
.card:hover { background: var(--glass-bg-hover); box-shadow: var(--glass-shadow-hi); }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* -------- KPI cards -------- */
.kpi {
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 140px; height: 140px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  opacity: .15;
  border-radius: 50%;
  transform: translate(40%, -40%);
}
.kpi .label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.kpi .value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-strong);
  margin-top: 6px;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi .sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}
.kpi.good .value  { color: #15803d; }
.kpi.warn .value  { color: #b45309; }
.kpi.bad  .value  { color: #b91c1c; }

/* -------- tables -------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}
table th, table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  text-align: left;
  color: var(--text);
}
table th {
  background: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
table tr { transition: background .15s var(--ease); }
table tr:hover td { background: rgba(255, 255, 255, 0.45); }
table.compact th, table.compact td { padding: 7px 10px; font-size: 13px; }
.r { text-align: right; }
.c { text-align: center; }

/* -------- buttons -------- */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .25s var(--ease);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
  color: #fff;
  text-decoration: none;
}
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: var(--glass-bg-strong);
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: var(--text-strong);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.btn.ghost:hover {
  background: #fff;
  transform: translateY(-1px);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.btn.danger { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25); }
.btn.danger:hover { box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35); }
.btn.sm { padding: 5px 12px; font-size: 12px; }

/* -------- forms -------- */
input, select, textarea {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-strong);
  width: 100%;
  transition: all .25s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
input::placeholder { color: var(--text-dim); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
select option { background: #fff; color: var(--text-strong); }
label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin: 0 0 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-row { margin-bottom: 14px; }

/* -------- badges -------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.badge.br      { background: rgba(59, 130, 246, .14);  color: #1d4ed8; border-color: rgba(59, 130, 246, .25); }
.badge.ap      { background: rgba(245, 158, 11, .14);  color: #b45309; border-color: rgba(245, 158, 11, .25); }
.badge.vip     { background: rgba(236, 72, 153, .14);  color: #9d174d; border-color: rgba(236, 72, 153, .25); }
.badge.dom     { background: rgba(22, 163, 74, .14);   color: #15803d; border-color: rgba(22, 163, 74, .25); }
.badge.com     { background: rgba(220, 38, 38, .14);   color: #b91c1c; border-color: rgba(220, 38, 38, .25); }
.badge.ok      { background: rgba(22, 163, 74, .14);   color: #15803d; border-color: rgba(22, 163, 74, .25); }
.badge.pending { background: rgba(148, 163, 184, .14); color: #475569; border-color: rgba(148, 163, 184, .25); }
.badge.verified{ background: rgba(59, 130, 246, .14);  color: #1d4ed8; border-color: rgba(59, 130, 246, .25); }
.badge.failed  { background: rgba(220, 38, 38, .14);   color: #b91c1c; border-color: rgba(220, 38, 38, .25); }

/* -------- alerts -------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  backdrop-filter: blur(16px);
  border: 1px solid;
  animation: rise .4s var(--ease) backwards;
}
.alert.success { background: rgba(22, 163, 74, .12);  color: #14532d; border-color: rgba(22, 163, 74, .3); }
.alert.error   { background: rgba(220, 38, 38, .12);  color: #7f1d1d; border-color: rgba(220, 38, 38, .3); }
.alert.warn    { background: rgba(245, 158, 11, .14); color: #78350f; border-color: rgba(245, 158, 11, .3); }
.alert.info    { background: rgba(59, 130, 246, .12); color: #1e3a8a; border-color: rgba(59, 130, 246, .3); }

/* -------- tabs (pill switcher) -------- */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  backdrop-filter: blur(16px);
  box-shadow: var(--glass-shadow);
}
.tabs a {
  padding: 7px 18px;
  border-radius: 99px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  transition: all .25s var(--ease);
}
.tabs a:hover { color: var(--text-strong); text-decoration: none; }
.tabs a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28);
}

/* -------- toolbar -------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 14px;
  flex-wrap: wrap;
}
.toolbar .left, .toolbar .right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* -------- dialog -------- */
dialog {
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(240, 249, 255, .96));
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 0;
  color: var(--text-strong);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
  animation: rise .3s var(--ease-bounce);
}
dialog::backdrop {
  background: rgba(15, 23, 42, .35);
  backdrop-filter: blur(6px);
}

/* -------- charts -------- */
canvas { max-width: 100%; }

/* -------- scrollbar -------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, .18);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, .3); }

/* -------- utilities -------- */
.fade-in { animation: rise .4s var(--ease); }

/* -------- print / PDF -------- */
.no-print   { }
.print-only { display: none !important; }
.print-section { }
@media print {
  @page { size: A4 portrait; margin: 14mm 12mm; }
  *, *::before, *::after { box-shadow: none !important; backdrop-filter: none !important; animation: none !important; transition: none !important; }
  body { background: #fff !important; font-size: 10.5pt; color: #111; }
  body::before, body::after { display: none; }

  /* Hide everything except print-sections and print-only elements */
  .topbar, .foot, .no-print, dialog,
  .card.kpi, canvas, .tabs, .alert,
  .toolbar, .grid.grid-4, .grid.grid-3:not(.print-section),
  .grid.grid-2:not(.print-section), h2:not(.print-h) { display: none !important; }

  .print-only  { display: block !important; }
  .print-section { display: block !important; }

  .print-header {
    display: block !important;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2.5px solid #000;
  }
  .print-header h2 { font-size: 15pt; margin: 0 0 4px; }
  .print-header p  { margin: 0; color: #555; font-size: 10pt; }

  .container { margin: 0; padding: 0; max-width: 100%; }

  /* Table styling for print */
  .print-section .card,
  .print-section table { display: block !important; }
  .card { background: #fff !important; border: none; border-radius: 0; padding: 0; margin: 0; }

  table { width: 100%; border-collapse: collapse; font-size: 9pt; margin-bottom: 6px; }
  table th {
    background: #e8e8e8 !important;
    color: #111;
    font-size: 8.5pt;
    padding: 5px 8px;
    border: 1px solid #bbb;
    text-align: left;
  }
  table td {
    padding: 4px 8px;
    border: 1px solid #ddd;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  table tr:nth-child(even) td { background: #f8f8f8; }
  tfoot td { background: #e8e8e8 !important; font-weight: 700; border: 1px solid #bbb; }

  .print-h { display: block !important; font-size: 11pt; font-weight: 700; margin: 14px 0 6px; color: #000; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
  .badge { border: 1px solid #aaa; background: #eee !important; color: #333 !important; padding: 1px 6px; font-size: 8pt; }
  .r { text-align: right; }
  .muted { color: #666; }
}
.shimmer {
  background: linear-gradient(90deg, transparent, rgba(15,23,42,.05), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
