/* ============================================================
   BanHug Admin CSS
   ============================================================ */

/* --- Admin Layout --- */
.admin-body { background: var(--bg); overflow-x: hidden; }

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

/* ── Sidebar ─────────────────────────────────────────────────*/
.admin-sidebar {
    width: 250px;
    min-height: 100vh;
    background: rgba(7,7,26,.97);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 200;
    transition: transform .25s ease;
    overflow-y: auto;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(124,58,237,.3); }

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .65rem;
    text-decoration: none;
}
.sidebar-brand-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; flex-shrink: 0;
}
.sidebar-brand-text {
    font-weight: 800; font-size: 1rem;
    background: linear-gradient(135deg, var(--accent-lt), var(--cyan));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.sidebar-badge {
    font-size: .65rem;
    background: rgba(245,158,11,.2);
    border: 1px solid rgba(245,158,11,.35);
    color: #fcd34d;
    padding: .1rem .4rem; border-radius: 4px; margin-left: auto; flex-shrink: 0;
}

.sidebar-section-label {
    font-size: .65rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: rgba(255,255,255,.25);
    padding: 1rem 1.25rem .35rem;
}

.sidebar-nav { padding: .5rem .75rem; flex: 1; }

.sidebar-nav-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .75rem;
    border-radius: 10px;
    color: rgba(226,232,240,.6);
    text-decoration: none;
    font-size: .85rem; font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}
.sidebar-nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
}
.sidebar-nav-item.active {
    color: #fff;
    background: rgba(124,58,237,.18);
    border: 1px solid rgba(124,58,237,.3);
}
.sidebar-nav-item.active i { color: var(--accent-lt); }
.sidebar-nav-item i { font-size: 1rem; flex-shrink: 0; }

.sidebar-badge-count {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: .65rem; font-weight: 700;
    padding: .1rem .45rem; border-radius: 50px;
    min-width: 18px; text-align: center;
}

/* ── Main area ───────────────────────────────────────────────*/
.admin-main {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin .25s ease;
}

.admin-topbar {
    background: rgba(7,7,26,.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: .75rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 100;
}
.admin-topbar-title {
    font-weight: 700; font-size: 1rem; color: #fff;
    flex: 1;
}
.admin-content {
    flex: 1;
    padding: 1.5rem;
}

/* Sidebar toggle btn (mobile) */
.sidebar-toggle-btn {
    background: none; border: none; color: var(--text); cursor: pointer;
    padding: .2rem .4rem; border-radius: 6px; font-size: 1.2rem;
    display: none;
}
@media (max-width: 991px) {
    .sidebar-toggle-btn { display: block; }
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.show { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.5); }
    .admin-main { margin-left: 0; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }
    .sidebar-overlay.show { display: block; }
}

/* ── Admin Cards / Stats ─────────────────────────────────────*/
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
    transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-value { font-size: 1.6rem; font-weight: 800; color: #fff; line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Admin Table ─────────────────────────────────────────────*/
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-muted);
    padding: .65rem 1rem; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table td {
    padding: .8rem 1rem; border-bottom: 1px solid rgba(255,255,255,.04);
    font-size: .87rem; color: var(--text); vertical-align: middle;
}
.admin-table tbody tr:hover td { background: rgba(255,255,255,.025); }
.admin-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.admin-table-wrap .table-search-bar {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}

/* ── Admin Form Controls ─────────────────────────────────────*/
.admin-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.admin-form-card .section-heading {
    font-size: .8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--text-muted);
    padding-bottom: .75rem; margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.form-control-dark {
    background: rgba(0,0,0,.3) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-size: .875rem !important;
    transition: border-color .15s !important;
}
.form-control-dark:focus {
    border-color: rgba(124,58,237,.5) !important;
    box-shadow: 0 0 0 3px rgba(124,58,237,.1) !important;
    outline: none !important;
}
.form-control-dark::placeholder { color: rgba(255,255,255,.3) !important; }
.form-control-dark option { background: #0d0d27; }

.form-label-dark { font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.7); margin-bottom: .4rem; display: block; }

/* Quill editor dark */
.ql-toolbar { background: rgba(255,255,255,.04) !important; border-color: var(--border) !important; border-radius: 10px 10px 0 0 !important; }
.ql-toolbar .ql-stroke { stroke: rgba(255,255,255,.6) !important; }
.ql-toolbar .ql-fill { fill: rgba(255,255,255,.6) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: #fff !important; }
.ql-toolbar .ql-picker-label { color: rgba(255,255,255,.6) !important; }
.ql-container { background: rgba(0,0,0,.25) !important; border-color: var(--border) !important; border-radius: 0 0 10px 10px !important; min-height: 240px; }
.ql-editor { color: var(--text) !important; font-family: 'Noto Sans Thai', sans-serif !important; font-size: .875rem !important; }
.ql-editor.ql-blank::before { color: rgba(255,255,255,.25) !important; font-style: normal !important; }
.ql-snow .ql-picker-options { background: #0d0d27 !important; border-color: var(--border) !important; }
.ql-snow .ql-picker-item { color: var(--text) !important; }

/* Image preview */
.img-preview-wrap {
    width: 120px; height: 80px;
    border: 1px dashed var(--border);
    border-radius: 10px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.5rem;
    cursor: pointer; transition: var(--transition); flex-shrink: 0;
}
.img-preview-wrap:hover { border-color: var(--accent); }
.img-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }

/* Toggle switch */
.form-switch-custom { display: flex; align-items: center; gap: .6rem; cursor: pointer; user-select: none; }
.form-switch-custom input[type=checkbox] { display: none; }
.switch-track {
    width: 40px; height: 22px; border-radius: 11px;
    background: rgba(255,255,255,.1);
    border: 1px solid var(--border);
    position: relative; transition: var(--transition); flex-shrink: 0;
}
.switch-thumb {
    width: 16px; height: 16px; background: rgba(255,255,255,.5);
    border-radius: 50%; position: absolute; top: 2px; left: 2px;
    transition: var(--transition);
}
.form-switch-custom input:checked + .switch-track { background: rgba(124,58,237,.4); border-color: rgba(124,58,237,.5); }
.form-switch-custom input:checked + .switch-track .switch-thumb { transform: translateX(18px); background: var(--accent-lt); }

/* ── Admin Modal ─────────────────────────────────────────────*/
.modal-dark .modal-content {
    background: #0d0d27;
    border: 1px solid var(--border);
    border-radius: 20px;
}
.modal-dark .modal-header { border-color: var(--border); }
.modal-dark .modal-footer { border-color: var(--border); }
.modal-dark .modal-title { color: #fff; font-size: 1rem; font-weight: 700; }

/* ── Admin page header ───────────────────────────────────────*/
.admin-page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
    margin-bottom: 1.5rem;
}
.admin-page-title { font-size: 1.2rem; font-weight: 700; color: #fff; }
.admin-page-subtitle { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Quick action btns ───────────────────────────────────────*/
.btn-icon { background: rgba(255,255,255,.06); border: 1px solid var(--border); color: var(--text); width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; cursor: pointer; transition: var(--transition); text-decoration: none; }
.btn-icon:hover { color: #fff; border-color: var(--border-hover); background: rgba(255,255,255,.1); }
.btn-icon.btn-edit:hover { border-color: rgba(6,182,212,.4); color: var(--cyan); }
.btn-icon.btn-delete:hover { border-color: rgba(239,68,68,.4); color: var(--red); }
.btn-icon.btn-view:hover { border-color: rgba(124,58,237,.4); color: var(--accent-lt); }

/* thumbnail in table */
.table-thumb { width: 44px; height: 32px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.table-thumb-placeholder { width: 44px; height: 32px; background: rgba(255,255,255,.06); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.2); font-size: .75rem; }

/* ── Outline cyan button (settings test buttons) ─────────────*/
.btn-outline-cyan { background: transparent; border: 1px solid var(--cyan); color: var(--cyan); border-radius: 8px; padding: .35rem .9rem; font-size: .82rem; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.btn-outline-cyan:hover { background: rgba(6,182,212,.15); color: var(--cyan); }
