/* ============================================================
   VideoSaaS — Main Stylesheet (Mobile-First)
   ============================================================ */

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:     #6c47ff;
    --color-primary-dk:  #5535e0;
    --color-accent:      #00d4aa;
    --color-danger:      #e53e3e;
    --color-warn:        #f6ad55;
    --color-success:     #38a169;
    --color-info:        #3182ce;
    --color-bg:          #0f0f1a;
    --color-surface:     #1a1a2e;
    --color-surface2:    #252540;
    --color-border:      #2d2d4e;
    --color-text:        #e2e8f0;
    --color-muted:       #94a3b8;
    --radius:            10px;
    --radius-lg:         16px;
    --shadow:            0 4px 24px rgba(0,0,0,.4);
    --font:              'Inter', system-ui, -apple-system, sans-serif;
    --transition:        .2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; }

/* ── Layout ───────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.page-wrap  { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; padding: 24px 0; }

/* ── Alerts / Flash messages ─────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: .9rem;
    border-left: 4px solid;
}
.alert--success { background: rgba(56,161,105,.15); border-color: var(--color-success); color: #9ae6b4; }
.alert--error   { background: rgba(229,62,62,.15);  border-color: var(--color-danger);  color: #fc8181; }
.alert--info    { background: rgba(49,130,206,.15); border-color: var(--color-info);    color: #90cdf4; }
.alert--warning { background: rgba(246,173,85,.15); border-color: var(--color-warn);    color: #fbd38d; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--color-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: .95rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(108,71,255,.25); }
.form-control::placeholder { color: var(--color-muted); opacity: .7; }
.form-hint { font-size: .8rem; color: var(--color-muted); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--color-danger); margin-top: 4px; }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px;
    border: none; border-radius: var(--radius);
    font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: background var(--transition), transform .1s, opacity var(--transition);
    text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dk); text-decoration: none; }
.btn-accent    { background: var(--color-accent); color: #0f0f1a; }
.btn-accent:hover { background: #00bfa0; text-decoration: none; }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #c53030; text-decoration: none; }
.btn-ghost     { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-ghost:hover { background: var(--color-surface2); text-decoration: none; }
.btn-sm        { padding: 7px 14px; font-size: .85rem; }
.btn-lg        { padding: 14px 28px; font-size: 1.05rem; }
.btn-block     { display: flex; width: 100%; }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #2f855a; text-decoration: none; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}
.card-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--color-border); }
.card-title  { font-size: 1.1rem; font-weight: 700; }
.card-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-border); }

/* ── Auth layout ──────────────────────────────────────────── */
.auth-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px 16px;
    background: radial-gradient(ellipse at 20% 50%, rgba(108,71,255,.15) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(0,212,170,.08) 0%, transparent 50%),
                var(--color-bg);
}
.auth-box { width: 100%; max-width: 440px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-text { font-size: 1.6rem; font-weight: 800; color: var(--color-text); }
.auth-logo .logo-text span { color: var(--color-primary); }
.auth-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.auth-title { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-sub   { font-size: .9rem; color: var(--color-muted); text-align: center; margin-bottom: 24px; }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 16px;
    position: sticky; top: 0; z-index: 100;
}
.navbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; height: 60px; gap: 16px; }
.navbar-brand { font-size: 1.1rem; font-weight: 800; color: var(--color-text); }
.navbar-brand span { color: var(--color-primary); }
.navbar-nav   { display: flex; gap: 4px; list-style: none; margin-left: auto; }
.navbar-nav a { padding: 6px 12px; border-radius: var(--radius); color: var(--color-muted); font-size: .9rem; transition: color var(--transition), background var(--transition); }
.navbar-nav a:hover, .navbar-nav a.active { color: var(--color-text); background: var(--color-surface2); text-decoration: none; }
.navbar-wallet { background: rgba(108,71,255,.2); color: var(--color-primary); padding: 5px 12px; border-radius: 20px; font-size: .85rem; font-weight: 700; }

/* ── Sidebar (admin) ──────────────────────────────────────── */
.admin-wrap { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 16px 0;
    position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar-section { padding: 8px 16px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--color-muted); font-weight: 700; }
.sidebar-nav { list-style: none; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px;
    color: var(--color-muted); font-size: .9rem;
    transition: color var(--transition), background var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active { color: var(--color-text); background: var(--color-surface2); text-decoration: none; }
.sidebar-nav a.active { border-right: 3px solid var(--color-primary); color: var(--color-primary); }
.admin-content { flex: 1; padding: 24px; min-width: 0; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { background: var(--color-surface2); padding: 12px 14px; text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--color-muted); font-weight: 700; white-space: nowrap; }
tbody tr { border-top: 1px solid var(--color-border); }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody td { padding: 12px 14px; vertical-align: middle; }

/* ── Badges ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-success  { background: rgba(56,161,105,.2);  color: #9ae6b4; }
.badge-danger   { background: rgba(229,62,62,.2);   color: #fc8181; }
.badge-warning  { background: rgba(246,173,85,.2);  color: #fbd38d; }
.badge-info     { background: rgba(49,130,206,.2);  color: #90cdf4; }
.badge-muted    { background: rgba(148,163,184,.15);color: var(--color-muted); }
.badge-primary  { background: rgba(108,71,255,.2);  color: #b794f4; }

/* ── KPI cards ────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 20px; }
.kpi-label { font-size: .78rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 8px; }
.kpi-value { font-size: 1.8rem; font-weight: 800; color: var(--color-text); line-height: 1; }
.kpi-sub   { font-size: .8rem; color: var(--color-muted); margin-top: 4px; }

/* ── Page header ──────────────────────────────────────────── */
.page-header { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title  { font-size: 1.4rem; font-weight: 800; }
.page-sub    { font-size: .9rem; color: var(--color-muted); margin-top: 2px; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius);
    font-size: .85rem; font-weight: 600; border: 1px solid var(--color-border);
    color: var(--color-muted); transition: all var(--transition);
}
.pagination a:hover { background: var(--color-surface2); color: var(--color-text); text-decoration: none; }
.pagination .active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ── Divider ──────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 20px 0; }

/* ── Utility ──────────────────────────────────────────────── */
.text-muted   { color: var(--color-muted); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-primary { color: var(--color-primary); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: .85rem; }
.fw-bold      { font-weight: 700; }
.mt-1 { margin-top: 4px;  } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 16px; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.overflow-hidden { overflow: hidden; }

/* ── Toast notifications ──────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999;
                   display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 14px 18px;
    font-size: .88rem; font-weight: 600; color: var(--color-text);
    box-shadow: var(--shadow); min-width: 220px; max-width: 340px;
    animation: slideIn .25s ease;
}
.toast.success { border-left: 4px solid var(--color-success); }
.toast.error   { border-left: 4px solid var(--color-danger); }
.toast.info    { border-left: 4px solid var(--color-info); }
@keyframes slideIn { from { transform: translateX(120%); opacity:0; } to { transform:none; opacity:1; } }

/* ── Mobile hamburger menu ────────────────────────────────── */
.hamburger {
    display: none; flex-direction: column; gap: 5px; cursor: pointer;
    padding: 6px; border: none; background: transparent;
}
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: var(--color-text); border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
    display: none; position: fixed; inset: 60px 0 0 0;
    background: var(--color-surface); z-index: 200;
    padding: 20px 16px; overflow-y: auto;
    border-top: 1px solid var(--color-border);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
    display: block; padding: 13px 12px;
    border-radius: var(--radius); color: var(--color-muted);
    font-size: 1rem; font-weight: 600; margin-bottom: 4px;
    transition: background var(--transition), color var(--transition);
}
.mobile-nav a:hover, .mobile-nav a.active {
    background: var(--color-surface2); color: var(--color-text); text-decoration: none;
}
.mobile-nav .nav-wallet {
    background: rgba(108,71,255,.15); color: var(--color-primary);
    padding: 12px; border-radius: var(--radius); margin-bottom: 16px;
    font-weight: 700; text-align: center;
}

/* ── Loading spinner ──────────────────────────────────────── */
.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%;
    animation: spin .6s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state .empty-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.empty-state .empty-sub   { color: var(--color-muted); font-size: .9rem; }

/* ── Sticky table header ──────────────────────────────────── */
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar        { display: none; }
    .admin-wrap     { flex-direction: column; }
    .admin-content  { padding: 16px; }
    .kpi-grid       { grid-template-columns: 1fr 1fr; }
    .page-header    { flex-direction: column; align-items: flex-start; }
    .navbar-nav     { display: none; }
    .hamburger      { display: flex; margin-left: auto; }
    .navbar-wallet  { display: none; }
    .auth-card      { padding: 24px 20px; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .btn-lg   { padding: 12px 20px; font-size: .95rem; }
    .card     { padding: 16px; }
}
