/* ==========================================================
   Winggo Smart Salon — Admin Theme
   ========================================================== */

:root,
:root[data-theme="dark"] {
    --bg: #0d0f15;
    --surface: #151823;
    --surface-2: #1c2030;
    --surface-3: #262c40;
    --border: #272d40;
    --text: #e7e9f0;
    --text-muted: #8a91a8;

    --primary: #d946ef;
    --primary-soft: rgba(217, 70, 239, .14);
    --accent: #8b5cf6;
    --accent-soft: rgba(139, 92, 246, .16);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, .14);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, .14);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, .14);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, .14);

    --topbar-bg: rgba(13, 15, 21, .85);
    --shadow: 0 12px 32px rgba(0, 0, 0, .40);
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

:root[data-theme="light"] {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f2f3f8;
    --surface-3: #e7e9f1;
    --border: #e2e5ee;
    --text: #1a1d29;
    --text-muted: #6b7187;
    --primary-soft: rgba(217, 70, 239, .10);
    --accent-soft: rgba(139, 92, 246, .10);
    --topbar-bg: rgba(245, 246, 250, .85);
    --shadow: 0 12px 32px rgba(20, 24, 40, .10);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
[x-cloak] { display: none !important; }
.mb-18 { margin-bottom: 18px; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}
.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.brand-logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 16px;
    overflow: hidden; flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { min-width: 0; flex: 1; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; color: var(--text-muted); }
.sidebar-close { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 24px; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }

.nav-section {
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 12px 6px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link i { font-size: 17px; width: 20px; text-align: center; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-link.disabled { opacity: .55; cursor: default; }
.nav-link.disabled:hover { background: transparent; color: var(--text-muted); }
.nav-soon {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--surface-3);
    color: var(--text-muted);
}

.sidebar-backdrop { display: none; }

.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    position: sticky; top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    display: grid; place-items: center;
    cursor: pointer;
    font-size: 16px;
    transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.menu-toggle { display: none; }

.user-menu { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 4px 4px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
}
.user-btn img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.u-text { text-align: left; }
.u-name { display: block; font-weight: 600; font-size: 13px; line-height: 1.2; }
.u-role { display: block; font-size: 11px; color: var(--text-muted); }
.u-caret { font-size: 11px; color: var(--text-muted); }

.dropdown {
    position: absolute;
    right: 0; top: calc(100% + 8px);
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 6px;
    z-index: 50;
}
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown-head strong { display: block; font-size: 13px; }
.dropdown-head small { color: var(--text-muted); font-size: 12px; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--danger); }

.content { flex: 1; padding: 24px; }
.app-footer { padding: 16px 24px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); }

/* ---------- Page / Cards ---------- */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head p { color: var(--text-muted); margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

.grid { display: grid; gap: 18px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: 2fr 1fr; }

.stat-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 21px;
    flex-shrink: 0;
}
.stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.3; }

.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-accent  { background: var(--accent-soft);  color: var(--accent); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger); }
.tone-info    { background: var(--info-soft);    color: var(--info); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state > i { display: block; font-size: 40px; margin-bottom: 10px; opacity: .6; }
.empty-state h4 { color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 4px; }

/* ---------- Badges / Progress ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px; font-weight: 600;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-muted   { background: var(--surface-3);    color: var(--text-muted); }

.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 8px; transition: width .3s; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.checklist li:last-child { border-bottom: 0; }
.check-dot {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: grid; place-items: center;
    font-size: 13px;
    color: transparent;
    flex-shrink: 0;
}
.checklist li.done .check-dot { background: var(--success); border-color: var(--success); color: #fff; }
.checklist li.done span:last-child { color: var(--text-muted); text-decoration: line-through; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-control {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--text-muted); opacity: .8; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-control.is-invalid { border-color: var(--danger); }
textarea.form-control { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }
select.form-control { cursor: pointer; }
.invalid-feedback { color: var(--danger); font-size: 12.5px; margin-top: 5px; }

.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon .form-control { padding-left: 40px; }
.toggle-pass {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px;
    border: 0; background: none;
    color: var(--text-muted);
    cursor: pointer;
}
.input-icon .form-control[name="password"] { padding-right: 44px; }

.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit; font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, background .15s;
    white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .92; }
.btn-light { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-light:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
}
.alert-danger  { background: var(--danger-soft);  color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
    display: flex; flex-direction: column; justify-content: space-between;
    gap: 32px;
    padding: 48px;
    border-right: 1px solid var(--border);
    background:
        radial-gradient(circle at 15% 20%, rgba(217, 70, 239, .30), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(139, 92, 246, .30), transparent 45%),
        var(--surface);
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-hero h2 { font-size: 34px; line-height: 1.2; font-weight: 700; max-width: 440px; }
.auth-hero p { color: var(--text-muted); margin-top: 12px; max-width: 440px; font-size: 15px; }
.auth-features { list-style: none; display: grid; gap: 12px; margin-top: 28px; }
.auth-features li { display: flex; align-items: center; gap: 12px; }
.auth-features i {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
}
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; font-weight: 700; }
.auth-card .sub { color: var(--text-muted); margin: 6px 0 26px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px; }
.auth-foot { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 28px; }

/* ---------- SweetAlert2 theming ---------- */
.swal2-popup {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius) !important;
    font-family: var(--font) !important;
}
.swal2-title, .swal2-html-container { color: var(--text) !important; }
.swal2-styled.swal2-confirm { background: var(--primary) !important; border-radius: var(--radius-sm) !important; }
.swal2-styled.swal2-cancel  { background: var(--surface-3) !important; color: var(--text) !important; border-radius: var(--radius-sm) !important; }
.swal2-styled:focus { box-shadow: 0 0 0 3px var(--primary-soft) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
    .sidebar-close { display: grid; }
    .sidebar-backdrop.show {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 35;
    }
    .main { margin-left: 0; }
    .menu-toggle { display: grid; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
}

@media (max-width: 575px) {
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .u-text, .u-caret { display: none; }
    .user-btn { padding: 4px; }
    .page-head h1 { font-size: 19px; }
}