/* ============================================================
   Magic Star Global Concept — Design System
   Primary: #C62828 | Font: Inter + Plus Jakarta Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --ms-red:        #C62828;
  --ms-red-dark:   #A81E1E;
  --ms-red-light:  #FFEBEE;
  --ms-dark:       #0D1117;
  --ms-sidebar:    #111827;
  --ms-sidebar-hover: #1F2937;
  --ms-bg:         #F3F4F8;
  --ms-white:      #FFFFFF;
  --ms-border:     #E5E7EB;
  --ms-text:       #111827;
  --ms-muted:      #6B7280;
  --ms-green:      #059669;
  --ms-green-bg:   #ECFDF5;
  --ms-amber:      #D97706;
  --ms-amber-bg:   #FFFBEB;
  --ms-blue:       #2563EB;
  --ms-blue-bg:    #EFF6FF;
  --ms-shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --ms-shadow:     0 4px 12px rgba(0,0,0,.08);
  --ms-shadow-lg:  0 10px 30px rgba(0,0,0,.1);
  --ms-radius:     12px;
  --ms-radius-lg:  16px;
  --sidebar-width: 260px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--ms-bg);
  color: var(--ms-text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 99px; }

/* ============================================================
   LAYOUT
   ============================================================ */

.ms-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.ms-sidebar {
  width: var(--sidebar-width);
  background: var(--ms-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  overflow: hidden;
}

.ms-sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.ms-logo-mark {
  width: 40px; height: 40px;
  background: var(--ms-red);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; font-size: 15px;
  color: #fff; flex-shrink: 0;
}

.ms-logo-text { line-height: 1.2; }
.ms-logo-text strong { display: block; color: #fff; font-size: 13px; font-weight: 700; }
.ms-logo-text span   { color: #9CA3AF; font-size: 11px; }

.ms-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.ms-nav-label {
  color: #4B5563; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 8px 8px 4px; margin-top: 8px;
}

.ms-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: #9CA3AF; font-size: 13.5px; font-weight: 500;
  text-decoration: none; transition: all .15s ease;
  margin-bottom: 2px; white-space: nowrap;
}
.ms-nav-link:hover  { background: var(--ms-sidebar-hover); color: #E5E7EB; }
.ms-nav-link.active { background: rgba(198,40,40,.18); color: #FC8181; }
.ms-nav-link.active .ms-nav-icon { color: var(--ms-red); }
.ms-nav-link .badge {
  margin-left: auto; background: var(--ms-red);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px; min-width: 18px; text-align: center;
}

.ms-nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.ms-sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}

.ms-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ms-red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.ms-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.ms-user-info { flex: 1; min-width: 0; }
.ms-user-info strong { display: block; font-size: 12.5px; color: #E5E7EB; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-user-info span   { font-size: 11px; color: #6B7280; }

/* ── Main Content ── */
.ms-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin .25s ease;
}

/* ── Topnav ── */
.ms-topnav {
  background: var(--ms-white);
  border-bottom: 1px solid var(--ms-border);
  height: 64px;
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}

.ms-topnav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--ms-muted); padding: 6px;
}

.ms-search {
  flex: 1; max-width: 380px;
  background: var(--ms-bg); border: 1px solid var(--ms-border);
  border-radius: 8px; padding: 8px 14px;
  display: flex; align-items: center; gap: 8px;
  color: var(--ms-muted); font-size: 13.5px;
}
.ms-search input {
  border: none; background: none; outline: none;
  font-size: 13.5px; color: var(--ms-text); width: 100%;
}
.ms-search input::placeholder { color: var(--ms-muted); }

.ms-topnav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.ms-icon-btn {
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--ms-muted); position: relative;
  transition: background .15s;
}
.ms-icon-btn:hover { background: var(--ms-bg); color: var(--ms-text); }

.ms-notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: var(--ms-red);
  border-radius: 50%; border: 2px solid var(--ms-white);
}

.ms-topnav-divider { width: 1px; height: 28px; background: var(--ms-border); }

.ms-topnav-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
  transition: background .15s;
}
.ms-topnav-user:hover { background: var(--ms-bg); }
.ms-topnav-user .name { font-size: 13.5px; font-weight: 600; color: var(--ms-text); }
.ms-topnav-user .role { font-size: 11px; color: var(--ms-muted); }

/* ── Page Content ── */
.ms-content { padding: 28px; flex: 1; }

.ms-page-header { margin-bottom: 24px; }
.ms-page-header h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px; font-weight: 700; color: var(--ms-text);
}
.ms-page-header p { color: var(--ms-muted); font-size: 14px; margin-top: 2px; }
.ms-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ms-muted); margin-bottom: 6px; }
.ms-breadcrumb a  { color: var(--ms-muted); text-decoration: none; }
.ms-breadcrumb a:hover { color: var(--ms-red); }

/* ============================================================
   CARDS
   ============================================================ */

.ms-card {
  background: var(--ms-white);
  border-radius: var(--ms-radius);
  border: 1px solid var(--ms-border);
  box-shadow: var(--ms-shadow-sm);
  padding: 24px;
}

.ms-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.ms-card-title { font-size: 15px; font-weight: 600; color: var(--ms-text); }
.ms-card-subtitle { font-size: 12.5px; color: var(--ms-muted); margin-top: 1px; }

/* Stat Cards */
.ms-stat-card {
  background: var(--ms-white);
  border-radius: var(--ms-radius);
  border: 1px solid var(--ms-border);
  padding: 22px 24px;
  box-shadow: var(--ms-shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.ms-stat-card:hover { box-shadow: var(--ms-shadow); transform: translateY(-2px); }

.ms-stat-card .label  { font-size: 12px; font-weight: 500; color: var(--ms-muted); text-transform: uppercase; letter-spacing: .04em; }
.ms-stat-card .amount {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 26px; font-weight: 700; color: var(--ms-text);
  margin: 8px 0 4px; line-height: 1;
}
.ms-stat-card .change { font-size: 12px; font-weight: 500; }
.ms-stat-card .change.up   { color: var(--ms-green); }
.ms-stat-card .change.down { color: #DC2626; }

.ms-stat-icon {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* Hero Wallet Card */
.ms-wallet-card {
  background: linear-gradient(135deg, #B71C1C 0%, #C62828 50%, #E53935 100%);
  border-radius: var(--ms-radius-lg); padding: 28px;
  color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(198,40,40,.35);
}
.ms-wallet-card::before {
  content: ''; position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.06); border-radius: 50%;
}
.ms-wallet-card::after {
  content: ''; position: absolute;
  bottom: -60px; right: 40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.04); border-radius: 50%;
}
.ms-wallet-card .wc-label { font-size: 13px; opacity: .75; font-weight: 500; }
.ms-wallet-card .wc-amount {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 36px; font-weight: 800;
  margin: 8px 0; line-height: 1; position: relative; z-index: 1;
}
.ms-wallet-card .wc-sub { font-size: 12.5px; opacity: .6; }

/* ============================================================
   BUTTONS
   ============================================================ */

.ms-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 20px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: none; outline: none; text-decoration: none;
  transition: all .15s ease; white-space: nowrap; line-height: 1;
}
.ms-btn:disabled { opacity: .6; cursor: not-allowed; }

.ms-btn-primary { background: var(--ms-red); color: #fff; }
.ms-btn-primary:hover { background: var(--ms-red-dark); box-shadow: 0 4px 12px rgba(198,40,40,.35); }

.ms-btn-outline { background: transparent; color: var(--ms-red); border: 1.5px solid var(--ms-red); }
.ms-btn-outline:hover { background: var(--ms-red-light); }

.ms-btn-ghost { background: transparent; color: var(--ms-muted); border: 1.5px solid var(--ms-border); }
.ms-btn-ghost:hover { background: var(--ms-bg); color: var(--ms-text); }

.ms-btn-success { background: var(--ms-green); color: #fff; }
.ms-btn-success:hover { background: #047857; }

.ms-btn-sm { padding: 6px 14px; font-size: 12.5px; border-radius: 6px; }
.ms-btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 10px; }
.ms-btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 8px; }

/* Quick action buttons */
.ms-quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px; background: var(--ms-bg); border-radius: 12px;
  border: 1.5px solid var(--ms-border); cursor: pointer;
  transition: all .15s; text-decoration: none;
}
.ms-quick-btn:hover { background: var(--ms-red-light); border-color: var(--ms-red); }
.ms-quick-btn:hover .ms-quick-icon { background: var(--ms-red); color: #fff; }
.ms-quick-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  color: var(--ms-red); box-shadow: var(--ms-shadow-sm); transition: all .15s;
}
.ms-quick-btn span { font-size: 12px; font-weight: 600; color: var(--ms-text); }

/* ============================================================
   FORMS
   ============================================================ */

.ms-form-group { margin-bottom: 18px; }
.ms-label { display: block; font-size: 13px; font-weight: 600; color: var(--ms-text); margin-bottom: 6px; }
.ms-label .required { color: var(--ms-red); }
.ms-input, .ms-select, .ms-textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--ms-border); border-radius: 8px;
  background: var(--ms-white); color: var(--ms-text);
  font-size: 14px; font-family: 'Inter', sans-serif;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.ms-input:focus, .ms-select:focus, .ms-textarea:focus {
  border-color: var(--ms-red);
  box-shadow: 0 0 0 3px rgba(198,40,40,.1);
}
.ms-input::placeholder { color: #9CA3AF; }
.ms-input-icon { position: relative; }
.ms-input-icon .ms-input { padding-left: 42px; }
.ms-input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ms-muted); }
.ms-hint  { font-size: 12px; color: var(--ms-muted); margin-top: 4px; }
.ms-error { font-size: 12px; color: #DC2626; margin-top: 4px; }
.ms-input.error { border-color: #DC2626; }

/* ============================================================
   TABLE
   ============================================================ */

.ms-table-wrap { overflow-x: auto; }
.ms-table { width: 100%; border-collapse: collapse; }
.ms-table th {
  padding: 11px 16px; text-align: left;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ms-muted);
  background: #FAFAFA; border-bottom: 1px solid var(--ms-border);
  white-space: nowrap;
}
.ms-table td {
  padding: 14px 16px; border-bottom: 1px solid #F3F4F6;
  font-size: 13.5px; color: var(--ms-text);
}
.ms-table tr:last-child td { border-bottom: none; }
.ms-table tbody tr { transition: background .1s; }
.ms-table tbody tr:hover { background: #FAFAFA; }

/* ============================================================
   BADGES
   ============================================================ */

.ms-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
}

/* ============================================================
   PROGRESS
   ============================================================ */

.ms-progress-bar {
  width: 100%; height: 6px;
  background: var(--ms-border); border-radius: 99px; overflow: hidden;
}
.ms-progress-fill {
  height: 100%; background: var(--ms-red); border-radius: 99px;
  transition: width .5s ease;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#ms-toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.ms-toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--ms-white); border-radius: 10px;
  padding: 14px 16px; min-width: 300px; max-width: 420px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  border-left: 4px solid var(--ms-blue);
  animation: toastIn .3s ease;
  pointer-events: all;
}
.ms-toast.success { border-color: var(--ms-green); }
.ms-toast.error   { border-color: #DC2626; }
.ms-toast.warning { border-color: var(--ms-amber); }
.ms-toast-title   { font-size: 13.5px; font-weight: 600; }
.ms-toast-msg     { font-size: 12.5px; color: var(--ms-muted); margin-top: 2px; }
.ms-toast-close   { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--ms-muted); font-size: 16px; line-height: 1; padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ============================================================
   MODAL
   ============================================================ */

.ms-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ms-modal {
  background: var(--ms-white); border-radius: 16px;
  width: 100%; max-width: 520px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.ms-modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--ms-border);
  display: flex; align-items: center; justify-content: space-between;
}
.ms-modal-title { font-size: 16px; font-weight: 700; }
.ms-modal-body  { padding: 24px; }
.ms-modal-footer { padding: 16px 24px; border-top: 1px solid var(--ms-border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   SKELETON LOADER
   ============================================================ */

.ms-skeleton {
  background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite ease-in-out;
  border-radius: 6px;
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   AUTH LAYOUT
   ============================================================ */

.ms-auth-wrap {
  min-height: 100vh; display: flex;
  background: var(--ms-white);
}
.ms-auth-brand {
  width: 420px; flex-shrink: 0;
  background: linear-gradient(145deg, #9B1B1B 0%, #C62828 60%, #E53935 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 40px; position: relative; overflow: hidden;
}
.ms-auth-brand::before {
  content: ''; position: absolute;
  top: -80px; left: -80px; width: 350px; height: 350px;
  border-radius: 50%; background: rgba(255,255,255,.06);
}
.ms-auth-brand::after {
  content: ''; position: absolute;
  bottom: -60px; right: -60px; width: 280px; height: 280px;
  border-radius: 50%; background: rgba(255,255,255,.05);
}
.ms-auth-form-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
}
.ms-auth-form-inner { width: 100%; max-width: 420px; }
.ms-auth-logo-mark {
  width: 64px; height: 64px; background: rgba(255,255,255,.15);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800;
  color: #fff; margin: 0 auto 24px; position: relative; z-index: 1;
}
.ms-auth-brand h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 26px; font-weight: 800; color: #fff;
  text-align: center; position: relative; z-index: 1; margin-bottom: 12px;
}
.ms-auth-brand p {
  font-size: 14px; color: rgba(255,255,255,.7);
  text-align: center; position: relative; z-index: 1; line-height: 1.6;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.ms-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
}
.ms-empty svg { color: #D1D5DB; margin-bottom: 16px; }
.ms-empty h3  { font-size: 16px; font-weight: 600; color: var(--ms-text); }
.ms-empty p   { font-size: 14px; color: var(--ms-muted); margin: 6px 0 20px; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */

.ms-sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
}
.ms-sidebar-overlay.show { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .ms-sidebar { transform: translateX(-100%); }
  .ms-sidebar.open { transform: translateX(0); }
  .ms-main { margin-left: 0; }
  .ms-topnav-toggle { display: flex; }
  .ms-auth-brand { display: none; }
  .ms-auth-form-wrap { padding: 32px 24px; }
}

@media (max-width: 640px) {
  .ms-content { padding: 16px; }
  .ms-wallet-card .wc-amount { font-size: 28px; }
  .ms-stat-card .amount { font-size: 22px; }
}
