/* =============================================
   admin.css — Admin Dashboard Standalone CSS
   Mengikuti warna utama Teal (#0d9488)
   Font: Plus Jakarta Sans (sama dengan user)
   ============================================= */

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

/* ─── CSS Variables ─── */
:root {
    --primary:         #0d9488;
    --primary-dark:    #0b7a70;
    --primary-darker:  #0a6560;
    --primary-light:   #d0f5f1;
    --primary-xlight:  #f0fdfb;
    --gold:            #d4af37;
    --bg:              #f4f7f9;
    --surface:         #ffffff;
    --border:          #e2e8f0;
    --text-primary:    #0f172a;
    --text-secondary:  #64748b;
    --text-muted:      #94a3b8;
    --sidebar-width:   260px;
    --topbar-height:   64px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.07);
    --shadow-md:  0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:  0 10px 30px rgba(0,0,0,.10);
    --danger:     #ef4444;
    --warning:    #f59e0b;
    --success:    #10b981;
    --info:       #3b82f6;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.6;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ─── LOGIN SCREEN ─── */
.admin-login-screen {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 100%);
    z-index: 9999;
    overflow: auto;
}
.admin-login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 420px; width: 100%;
    box-shadow: 0 24px 64px rgba(0,0,0,.25);
    animation: fadeUp .4s ease;
}
.admin-login-card .brand-icon {
    width: 56px; height: 56px; border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-darker), var(--primary));
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
    color: #fff; font-size: 1.5rem;
}
.admin-login-card h2 { font-weight: 800; font-size: 1.5rem; text-align: center; color: var(--text-primary); }
.admin-login-card p  { text-align: center; color: var(--text-secondary); font-size: .875rem; margin-top: 4px; }
.admin-login-card .form-group { margin-bottom: 1rem; }
.admin-login-card label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.admin-login-card input {
    width: 100%; padding: 11px 14px; border-radius: 10px;
    border: 1.5px solid var(--border); font-size: .9rem;
    font-family: inherit; outline: none; transition: border .2s;
    color: var(--text-primary);
}
.admin-login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
.admin-login-card .btn-login {
    width: 100%; padding: 12px; border-radius: 10px; border: 0;
    background: linear-gradient(135deg, var(--primary-darker), var(--primary));
    color: #fff; font-weight: 700; font-size: .95rem; cursor: pointer;
    transition: opacity .2s, transform .2s; margin-top: .5rem;
    font-family: inherit;
}
.admin-login-card .btn-login:hover { opacity: .9; transform: translateY(-1px); }
.admin-login-card .btn-login:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.admin-login-card .back-link { display: block; text-align: center; margin-top: 1rem; color: var(--text-muted); font-size: .82rem; text-decoration: none; }
.admin-login-card .back-link:hover { color: var(--primary); }
.admin-login-error { background: #fee2e2; color: #b91c1c; border-radius: 8px; padding: 10px 14px; font-size: .85rem; margin-bottom: 1rem; display: none; }
.admin-login-error.show { display: block; }

/* ─── SHELL LAYOUT ─── */
.admin-shell { display: flex; height: 100vh; width: 100%; }

/* ─── SIDEBAR ─── */
.admin-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-darker) 0%, #0a6560 50%, #085753 100%);
    display: flex; flex-direction: column;
    height: 100vh; position: fixed; top: 0; left: 0;
    z-index: 200; overflow: hidden;
    transition: transform .3s ease;
}
.sidebar-header {
    padding: 0 1.25rem;
    height: var(--topbar-height);
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
}
.sidebar-header .s-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
}
.sidebar-header .s-title { font-weight: 800; color: #fff; font-size: .95rem; line-height: 1.2; }
.sidebar-header .s-title span { display: block; font-size: .7rem; font-weight: 400; color: rgba(255,255,255,.6); }

.sidebar-profile {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.sidebar-profile .s-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.sidebar-profile .s-name { font-weight: 700; color: #fff; font-size: .85rem; }
.sidebar-profile .s-role { font-size: .7rem; color: rgba(255,255,255,.6); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem; }
.sidebar-nav::-webkit-scrollbar { width: 0; }
.sidebar-section-label {
    font-size: .65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: rgba(255,255,255,.35);
    padding: .65rem .75rem .3rem;
}
.sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: .6rem .85rem; border-radius: 10px;
    cursor: pointer; color: rgba(255,255,255,.75);
    font-size: .855rem; font-weight: 600;
    margin-bottom: 2px; border: none; background: transparent;
    width: 100%; text-align: left; text-decoration: none;
    transition: all .2s ease;
}
.sidebar-item .material-icons { font-size: 1.1rem; opacity: .75; transition: opacity .2s; flex-shrink: 0; }
.sidebar-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-item:hover .material-icons { opacity: 1; }
.sidebar-item.active { background: rgba(255,255,255,.15); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar-item.active .material-icons { opacity: 1; color: var(--gold); }

.sidebar-footer {
    padding: .75rem;
    border-top: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
}
.sidebar-logout {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: .65rem .85rem; border-radius: 10px;
    background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.25);
    color: #fca5a5; font-weight: 600; font-size: .855rem;
    cursor: pointer; transition: all .2s ease; font-family: inherit;
}
.sidebar-logout:hover { background: rgba(239,68,68,.28); color: #fff; }
.sidebar-logout .material-icons { font-size: 1.1rem; }

/* ─── MAIN AREA ─── */
.admin-main {
    margin-left: var(--sidebar-width);
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
}

/* ─── TOPBAR ─── */
.admin-topbar {
    height: var(--topbar-height); flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky; top: 0; z-index: 100;
}
.admin-topbar .topbar-title { font-weight: 800; font-size: 1rem; }
.admin-topbar .topbar-right { display: flex; align-items: center; gap: .75rem; }
.admin-topbar .admin-avatar {
    width: 34px; height: 34px; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-darker), var(--primary));
    color: #fff; font-weight: 700; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
}

/* ─── PAGE CONTENT ─── */
.admin-content {
    flex: 1; overflow-y: auto;
    padding: 1.75rem;
}

/* ─── PAGE LOADER ─── */
.admin-page-loader {
    display: flex; align-items: center; justify-content: center;
    padding: 80px 0;
}
.admin-page-loader .spinner {
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    animation: spin .7s linear infinite;
}

/* ─── STAT CARDS ─── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.admin-stat-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    cursor: default;
}
.admin-stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.admin-stat-card.primary { background: linear-gradient(135deg, var(--primary-darker), var(--primary)); border: none; color: #fff; }
.admin-stat-card .stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .65; margin-bottom: .4rem; }
.admin-stat-card .stat-value { font-size: 2.2rem; font-weight: 900; line-height: 1; margin-bottom: .25rem; }
.admin-stat-card .stat-sub { font-size: .78rem; opacity: .6; }
.admin-stat-card .stat-icon {
    position: absolute; bottom: -8px; right: -4px;
    font-size: 4rem; opacity: .08;
}
.admin-stat-card.primary .stat-icon { opacity: .15; color: #fff; }

/* ─── CARDS ─── */
.admin-card {
    background: var(--surface);
    border-radius: 14px; border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden; margin-bottom: 1.25rem;
}
.admin-card-header {
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: .9rem;
}
.admin-card-body { padding: 1.25rem; }

/* ─── TABLE ─── */
.admin-table { width: 100%; border-collapse: collapse; font-size: .855rem; }
.admin-table thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); font-weight: 700;
    padding: .75rem 1rem; border-bottom: 1px solid var(--border);
    background: var(--bg); white-space: nowrap;
}
.admin-table tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr.clickable { cursor: pointer; transition: background .15s; }
.admin-table tbody tr.clickable:hover { background: var(--primary-xlight); }
.admin-table .text-mono { font-family: 'Courier New', monospace; }

/* ─── BADGES ─── */
.badge-pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 99px;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .02em;
}
.badge-enable   { background: #d1fae5; color: #065f46; }
.badge-banned   { background: #fee2e2; color: #991b1b; }
.badge-suspend  { background: #fef3c7; color: #92400e; }
.badge-warning  { background: #ffedd5; color: #9a3412; }
.badge-admin    { background: #e0e7ff; color: #3730a3; }
.badge-user     { background: #f1f5f9; color: #475569; }
.badge-open     { background: #dbeafe; color: #1e40af; }
.badge-closed   { background: #f1f5f9; color: #475569; }
.badge-used     { background: #fee2e2; color: #991b1b; }
.badge-available{ background: #d1fae5; color: #065f46; }

/* ─── BUTTONS ─── */
.btn-primary-admin {
    background: var(--primary); color: #fff;
    border: none; padding: 8px 16px; border-radius: 8px;
    font-size: .855rem; font-weight: 600; cursor: pointer;
    transition: background .2s, transform .15s; font-family: inherit;
}
.btn-primary-admin:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline-admin {
    background: transparent; color: var(--primary);
    border: 1.5px solid var(--primary); padding: 7px 14px; border-radius: 8px;
    font-size: .855rem; font-weight: 600; cursor: pointer;
    transition: all .2s; font-family: inherit;
}
.btn-outline-admin:hover { background: var(--primary); color: #fff; }
.btn-neutral-admin {
    background: #f1f5f9; color: #475569;
    border: none; padding: 8px 16px; border-radius: 8px;
    font-size: .855rem; font-weight: 600; cursor: pointer;
    transition: background .2s, transform .15s; font-family: inherit;
}
.btn-neutral-admin:hover { background: #e2e8f0; transform: translateY(-1px); }
.btn-sm-admin { padding: 5px 12px; font-size: .78rem; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-family: inherit; transition: all .15s; }
.btn-success-sm { background: #d1fae5; color: #065f46; }
.btn-success-sm:hover { background: #a7f3d0; }
.btn-danger-sm  { background: #fee2e2; color: #991b1b; }
.btn-danger-sm:hover  { background: #fecaca; }
.btn-warning-sm { background: #fef3c7; color: #92400e; }
.btn-warning-sm:hover { background: #fde68a; }
.btn-neutral-sm { background: #f1f5f9; color: #475569; }
.btn-neutral-sm:hover { background: #e2e8f0; }

/* ─── FORMS ─── */
.admin-input {
    width: 100%; padding: 9px 12px; border-radius: 8px;
    border: 1.5px solid var(--border); font-size: .875rem;
    font-family: inherit; outline: none; background: var(--surface);
    color: var(--text-primary); transition: border .2s;
}
.admin-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.1); }
.admin-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); margin-bottom: 5px; display: block; }

/* ─── SEARCH BAR ─── */
.admin-search {
    position: relative; flex: 1; max-width: 280px;
}
.admin-search input { padding-left: 2.25rem; }
.admin-search .search-icon {
    position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 1rem; pointer-events: none;
}

/* ─── PAGINATION ─── */
.admin-pagination { display: flex; gap: 4px; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.admin-pagination button {
    min-width: 34px; height: 34px; border-radius: 8px;
    border: 1.5px solid var(--border); background: var(--surface);
    color: var(--text-secondary); font-size: .82rem; font-weight: 600;
    cursor: pointer; transition: all .15s; font-family: inherit;
}
.admin-pagination button:hover { border-color: var(--primary); color: var(--primary); }
.admin-pagination button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── TOAST ─── */
.admin-toast {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    padding: 12px 20px; border-radius: 10px; color: #fff;
    font-weight: 600; font-size: .875rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    opacity: 0; transform: translateY(-10px);
    transition: opacity .25s, transform .25s;
    display: flex; align-items: center; gap: 8px;
    pointer-events: none;
}
.admin-toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.admin-toast.success { background: var(--primary); }
.admin-toast.error   { background: var(--danger); }
.admin-toast.warning { background: var(--warning); color: #1c1a02; }
.admin-toast .material-icons { font-size: 1.1rem; }

/* ─── TICKET CHAT ─── */
.ticket-bubble {
    max-width: 80%; padding: .7rem 1rem; border-radius: 12px;
    font-size: .875rem; line-height: 1.5; margin-bottom: .75rem;
}
.ticket-bubble.user { background: #f1f5f9; border-bottom-left-radius: 2px; align-self: flex-start; }
.ticket-bubble.admin { background: var(--primary-light); border-bottom-right-radius: 2px; align-self: flex-end; }
.ticket-bubble .bubble-meta { font-size: .7rem; color: var(--text-muted); margin-top: 4px; }
.ticket-chat { display: flex; flex-direction: column; padding: 1rem; max-height: 400px; overflow-y: auto; }

/* ─── EMPTY STATE ─── */
.admin-empty {
    text-align: center; padding: 3rem 1rem; color: var(--text-muted);
}
.admin-empty .material-icons { font-size: 3rem; opacity: .35; display: block; margin-bottom: .75rem; }
.admin-empty p { font-size: .875rem; }

/* ─── PAGE HEADER ─── */
.admin-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.admin-page-header h1 { font-size: 1.35rem; font-weight: 800; margin: 0; }

/* ─── BREADCRUMB ─── */
.admin-back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: .82rem; cursor: pointer; margin-bottom: .75rem; border: none; background: none; font-family: inherit; padding: 0; transition: color .15s; }
.admin-back:hover { color: var(--primary); }
.admin-back .material-icons { font-size: 1rem; }

/* ─── DETAIL GRID ─── */
.detail-kv { display: flex; flex-direction: column; gap: .1rem; margin-bottom: .75rem; }
.detail-kv .dk-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--text-muted); }
.detail-kv .dk-value { font-size: .9rem; color: var(--text-primary); font-weight: 600; }

/* ─── ACTION PANEL ─── */
.action-group { margin-bottom: 1rem; }
.action-group .action-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: .5rem; }
.action-group .action-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ─── MOBILE OVERLAY ─── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 190; }
.sidebar-overlay.active { display: block; }
.btn-sidebar-toggle { display: none; }

/* ─── RESPONSIVE ─── */
@media (max-width: 767px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .admin-main { margin-left: 0; }
    .btn-sidebar-toggle { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; }
    .admin-content { padding: 1rem; }
    .admin-page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── MODAL OVERLAY ─── */
.admin-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 500; display: none;
    align-items: flex-start; justify-content: center;
    padding: 2rem 1rem; overflow-y: auto;
}
.admin-modal-content {
    background: var(--surface); border-radius: 14px;
    box-shadow: var(--shadow-lg); width: 100%;
    margin: auto;
    animation: fadeUp .2s ease;
}
.admin-modal-header {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: .95rem;
}
.admin-modal-close { cursor: pointer; color: var(--text-muted); transition: color .15s; user-select: none; }
.admin-modal-close:hover { color: var(--text-primary); }
.admin-modal-body { padding: 1.25rem; }
.admin-select { appearance: none; cursor: pointer; }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeUp .35s ease both; }
