/* ReferralOS Admin — premium SaaS theme · LootMart navy+gold identity */
:root {
  --brand: #071B3A;
  --brand-2: #0d2c56;
  --gold: #C9A45C;
  --gold-soft: #F4E7C1;
  --brand-soft: #eef0fe;
  --ink: #101828;
  --muted: #667085;
  --faint: #98a2b3;
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #eaecf0;
  --success: #039855;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fff6e6;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --info: #0ea5e9;
  --sidebar-w: 264px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
  --shadow-sm: 0 2px 10px rgba(16,24,40,.06);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.12);
}
* { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  background: var(--bg); color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: .9rem; line-height: 1.5; letter-spacing: -.005em;
}
h1,h2,h3,h4,h5,h6 { letter-spacing: -.02em; }

a { text-decoration: none; color: var(--brand); }
a:hover { color: var(--brand-2); }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: #0f172a; color: #cbd5e1;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 0 0 2rem;
}
.app-sidebar .brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.25rem; color: #fff; font-weight: 700; font-size: 1.1rem; }
.app-sidebar .brand img { height: 34px; width: auto; border-radius: 8px; }
.app-sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #64748b; padding: 1rem 1.25rem .35rem; }
.app-sidebar .nav-link {
  color: #cbd5e1; padding: .55rem 1.25rem; display: flex; align-items: center; gap: .65rem;
  font-size: .875rem; border-left: 3px solid transparent;
}
.app-sidebar .nav-link i { width: 1.2rem; text-align: center; font-size: 1rem; }
.app-sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.04); }
.app-sidebar .nav-link.active { color: #fff; background: rgba(99,102,241,.18); border-left-color: var(--brand); }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: .65rem 1.5rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 1020;
}
.app-content { padding: 1.5rem; }

/* Cards & stats */
.card { border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; }
.stat-card { display: flex; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem; }
.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: #fff; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--muted); font-size: .78rem; }

/* Badges */
.badge-soft-success { background: rgba(22,163,74,.12); color: var(--success); }
.badge-soft-danger { background: rgba(220,38,38,.1); color: var(--danger); }
.badge-soft-warning { background: rgba(245,158,11,.14); color: #b45309; }
.badge-soft-info { background: rgba(14,165,233,.12); color: var(--info); }
.badge-soft-secondary { background: rgba(100,116,139,.12); color: var(--muted); }

/* Tables */
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { vertical-align: middle; }

/* Buttons */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

/* Forms */
.form-label { font-weight: 500; font-size: .82rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(79,70,229,.12); }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 2.2rem; box-shadow: 0 24px 60px rgba(2,6,23,.35); }

/* Toasts */
#toastZone { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; }
.app-toast { min-width: 260px; max-width: 360px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 10px; padding: .75rem 1rem; box-shadow: 0 10px 30px rgba(2,6,23,.12); display: flex; gap: .6rem; align-items: flex-start; animation: slideIn .25s ease; }
.app-toast.success { border-left-color: var(--success); }
.app-toast.error { border-left-color: var(--danger); }
.app-toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Skeletons */
.skeleton { position: relative; overflow: hidden; background: #e9edf5; border-radius: 8px; min-height: 1rem; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Empty states */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; margin-bottom: .75rem; display: block; }

/* ===== Premium refinement layer ===== */

/* Depth: soft borders + single subtle shadow instead of heavy elevation */
.card { border-radius: var(--radius); box-shadow: var(--shadow-xs); transition: box-shadow .18s ease, transform .18s ease; }
.card:hover { box-shadow: var(--shadow-sm); }

/* Stat cards: soft tinted icon chips, tighter hierarchy */
.stat-card { border-radius: var(--radius); }
.stat-card .stat-icon { border-radius: var(--radius-sm); box-shadow: none; }
.stat-card .stat-value { font-weight: 800; letter-spacing: -.02em; }

/* Sidebar: premium dark navy with gold accents */
.app-sidebar { background: linear-gradient(180deg, #041226 0%, #071B3A 100%); }
.app-sidebar .nav-link { border-left: none; border-radius: 8px; margin: 1px 10px; padding: .5rem .8rem; transition: background .15s ease; }
.app-sidebar .nav-link.active { background: rgba(201,164,92,.16); border-left: none; color: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(201,164,92,.25); }
.app-sidebar .nav-link.active i { color: var(--gold); }
.app-sidebar .nav-section { padding-left: 1.4rem; }
.app-sidebar .brand span { letter-spacing: .02em; }

/* Tables: airy rows, quiet headers, hover affordance */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-weight: 600; letter-spacing: .07em; padding: .7rem .9rem; background: #fcfcfd; position: sticky; top: 0; }
.table tbody td { padding: .8rem .9rem; border-color: var(--border); color: var(--ink); }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #f9fafc; }

/* Badges: solid-soft, uppercase, consistent */
[class*="badge-soft"] { font-weight: 600; font-size: .68rem; letter-spacing: .04em; padding: .32em .7em; border-radius: 999px; text-transform: uppercase; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 600; transition: transform .08s ease, box-shadow .15s ease; }
.btn:active { transform: translateY(1px); }
.btn-brand { background: linear-gradient(135deg, #071B3A, #0d2c56); border-color: #071B3A; color: #fff; box-shadow: 0 4px 12px rgba(7,27,58,.3); }
.btn-brand:hover { background: #0d2c56; border-color: #0d2c56; color: var(--gold-soft); box-shadow: 0 6px 18px rgba(7,27,58,.4); }
.btn-outline-brand { color: #071B3A; border-color: #c9d4e5; }
.btn-outline-brand:hover { background: #071B3A; border-color: #071B3A; color: var(--gold-soft); }
.btn-light { border: 1px solid var(--border); }

/* Focus rings: accessible and branded */
.form-control:focus, .form-select:focus, .btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(79,70,229,.18); outline: none;
}

/* Page header rhythm */
.page-title { font-weight: 800; letter-spacing: -.02em; }
.page-sub { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.breadcrumb { font-size: .8rem; margin-bottom: .25rem; }

/* Modals & dropdowns */
.modal-content { border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom-color: var(--border); }
.modal-footer { border-top-color: var(--border); }
.dropdown-menu { border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .4rem; }
.dropdown-item { border-radius: 8px; font-size: .86rem; padding: .45rem .7rem; }

/* Empty states */
.empty-state i {
  width: 64px; height: 64px; line-height: 64px; margin: 0 auto .9rem;
  border-radius: 50%; background: rgba(201,164,92,.14); color: var(--gold); font-size: 1.6rem;
}

/* Number emphasis in stat values */
.stat-value .trend-up { color: var(--success); font-size: .75rem; font-weight: 700; margin-left: .4rem; }
.stat-value .trend-down { color: var(--danger); font-size: .75rem; font-weight: 700; margin-left: .4rem; }

/* Smooth scrollbar (WebKit) */
.app-sidebar::-webkit-scrollbar, .app-content::-webkit-scrollbar { width: 8px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

/* Misc */
.avatar-circle { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.progress-thin { height: 6px; border-radius: 3px; }
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.chip { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: rgba(79,70,229,.1); color: var(--brand); }
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 150px; }

@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; z-index: 1040; left: -280px; transition: left .25s ease; }
  .app-sidebar.open { left: 0; }
  .app-content { padding: 1rem; }
}

/* ===================== Creative Studio ===================== */
.canvas-wrap {
  background:
    repeating-conic-gradient(#f0f2f6 0% 25%, #ffffff 0% 50%) 0 0/24px 24px,
    #ffffff;
  border: 1px solid var(--border); border-radius: 14px;
  display: flex; justify-content: center; padding: 18px;
  max-height: 70vh; overflow: auto;
}
.creative-canvas {
  position: relative; width: 360px; aspect-ratio: 1080 / 1350;
  border-radius: 10px; overflow: hidden; box-shadow: 0 10px 34px rgba(4,18,38,.28);
  container-type: inline-size; touch-action: none; user-select: none;
}
.creative-canvas[data-format="instagram_post"] { aspect-ratio: 1; }
.ce-element {
  position: absolute; cursor: grab; border: 1px dashed transparent; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ce-element:active { cursor: grabbing; }
.ce-element.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,164,92,.35); }
.ce-element .ce-badge { padding: .2em .9em; border-radius: 999px; font-size: .8rem; font-weight: 700; letter-spacing: .08em; }
.ce-element .ce-divider { width: 100%; height: 2px; background: rgba(201,164,92,.8); }
.ce-qr { background: #fff; color: #071B3A; }
.ce-qr i { font-size: 3.2rem; }
.creative-option:hover { border-color: var(--gold); background: rgba(201,164,92,.06); }
.creative-thumb img { display: block; }

/* Club settings / stat tweak: gold icon chips */
.stat-card .stat-icon[style*="#C9A45C"] { color: #071B3A; }

/* Nav pills on request screens */
.nav-pills .nav-link { border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.nav-pills .nav-link.active { background: #071B3A; color: var(--gold-soft); }

/* Data-dense tables keep premium headers */
.table thead th { background: #fbfbfd; }

/* LootMart Creative Editor — interaction controls */
.creative-canvas { overflow: hidden; }
.ce-element { box-sizing: border-box; min-width: 12px; min-height: 12px; }
.ce-element.selected { z-index: 9999 !important; }
.ce-element img { width:100%; height:100%; object-fit:contain; display:block; pointer-events:none; }
.ce-image-placeholder { width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.14);color:#fff;font-size:12px;letter-spacing:.08em; }
.ce-element-label { position:absolute; left:4px; top:-1px; max-width:calc(100% - 8px); padding:2px 5px; border-radius:4px; background:rgba(7,27,58,.86); color:#fff; font:600 9px/1.2 system-ui,sans-serif; pointer-events:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ce-handle { position:absolute; width:10px; height:10px; background:#fff; border:2px solid #071B3A; border-radius:50%; z-index:10000; box-sizing:border-box; }
.ce-handle-nw { left:-5px;top:-5px;cursor:nwse-resize; }
.ce-handle-n { left:calc(50% - 5px);top:-5px;cursor:ns-resize; }
.ce-handle-ne { right:-5px;top:-5px;cursor:nesw-resize; }
.ce-handle-e { right:-5px;top:calc(50% - 5px);cursor:ew-resize; }
.ce-handle-se { right:-5px;bottom:-5px;cursor:nwse-resize; }
.ce-handle-s { left:calc(50% - 5px);bottom:-5px;cursor:ns-resize; }
.ce-handle-sw { left:-5px;bottom:-5px;cursor:nesw-resize; }
.ce-handle-w { left:-5px;top:calc(50% - 5px);cursor:ew-resize; }
.ce-qr { background:#fff; color:#071B3A; border:2px solid #071B3A !important; }
.ce-qr-inner { width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px; }
.qr-mini { width:58%;aspect-ratio:1;background:repeating-conic-gradient(#071B3A 0 8%,#fff 0 16%);border:7px solid #fff;box-shadow:0 0 0 1px #071B3A; }
.ce-qr-inner b { font-size:10px;letter-spacing:.08em; }
.ce-qr-inner small { font-size:8px;opacity:.65; }
