/* ========================================
   TaskBot Admin Panel CSS
   ======================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0D1117;
    --bg2: #161B22;
    --bg3: #21262D;
    --bg4: #30363D;
    --border: #30363D;
    --text1: #E6EDF3;
    --text2: #8B949E;
    --text3: #6E7681;
    --accent: #238636;
    --accent2: #1f6feb;
    --danger: #da3633;
    --warning: #d29922;
    --success: #3fb950;
    --sidebar-w: 230px;
    --topbar-h: 56px;
    --radius: 8px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text1);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* ---- LOGIN ---- */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 20px;
}
.login-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-logo {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: rgba(35,134,54,0.15);
    color: var(--success);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.login-title {
    font-size: 22px; font-weight: 700; margin-bottom: 4px;
}
.login-sub {
    color: var(--text2); font-size: 13px; margin-bottom: 28px;
}
.login-field {
    text-align: left; margin-bottom: 16px;
}
.login-field label {
    display: block; font-size: 12px; font-weight: 500;
    color: var(--text2); margin-bottom: 6px; text-transform: uppercase;
    letter-spacing: 0.05em;
}
.login-field input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text1);
    font-size: 15px;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.2s;
}
.login-field input:focus {
    border-color: var(--accent2);
}
.login-error {
    background: rgba(218,54,51,0.1);
    border: 1px solid rgba(218,54,51,0.3);
    border-radius: var(--radius);
    color: #ff7b72;
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 14px;
}
.login-btn {
    width: 100%;
    background: var(--accent2);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 4px;
}
.login-btn:hover { opacity: 0.9; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- LAYOUT ---- */
.admin-app {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.adm-sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}
.adm-sidebar.collapsed {
    transform: translateX(-100%);
}
.adm-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 16px 16px;
    font-size: 15px; font-weight: 700;
    color: var(--text1);
    border-bottom: 1px solid var(--border);
}
.adm-logo svg { color: var(--success); flex-shrink: 0; }

.adm-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto;
}
.adm-nav-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text2);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.adm-nav-item:hover {
    background: var(--bg3);
    color: var(--text1);
}
.adm-nav-item.active {
    background: rgba(31,111,235,0.15);
    color: #58a6ff;
}
.adm-nav-item svg { flex-shrink: 0; }
.adm-badge {
    margin-left: auto;
    background: var(--bg4);
    color: var(--text2);
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
}
.adm-sidebar-foot {
    padding: 12px 8px 16px;
    border-top: 1px solid var(--border);
}
.adm-logout-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text2);
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.adm-logout-btn:hover {
    background: rgba(218,54,51,0.1);
    color: #ff7b72;
}

/* ---- MAIN ---- */
.adm-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s;
}
.adm-main.full { margin-left: 0; }

/* ---- TOPBAR ---- */
.adm-topbar {
    height: var(--topbar-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 50;
}
.adm-menu-btn {
    background: transparent; border: none;
    color: var(--text2); cursor: pointer;
    padding: 6px; border-radius: 6px;
    display: flex; align-items: center;
    transition: color 0.15s;
}
.adm-menu-btn:hover { color: var(--text1); }
.adm-page-title {
    font-size: 16px; font-weight: 600;
    flex: 1;
}
.adm-topbar-right {
    display: flex; align-items: center; gap: 12px;
}
.adm-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%,100%{opacity:1} 50%{opacity:0.5}
}
.adm-status-txt { font-size: 12px; color: var(--text2); }
.adm-refresh-btn {
    background: transparent; border: none;
    color: var(--text2); cursor: pointer;
    padding: 6px; border-radius: 6px;
    display: flex;
    transition: color 0.15s, transform 0.3s;
}
.adm-refresh-btn:hover { color: var(--text1); transform: rotate(180deg); }

/* ---- CONTENT ---- */
.adm-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}
.adm-page { display: none; }
.adm-page.active { display: block; }

/* ---- STAT CARDS ---- */
.adm-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.adm-stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 16px;
    display: flex; align-items: center; gap: 14px;
    transition: border-color 0.2s;
}
.adm-stat-card:hover { border-color: #484f58; }
.adm-stat-icon {
    width: 46px; height: 46px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.adm-stat-body { min-width: 0; }
.adm-stat-val {
    font-size: 26px; font-weight: 700;
    line-height: 1.1;
}
.adm-stat-lbl {
    font-size: 12px; color: var(--text2);
    margin-top: 2px;
}

/* ---- SECTIONS ---- */
.adm-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}
.adm-section-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.adm-section-header h3 {
    font-size: 14px; font-weight: 600;
}

/* ---- TOOLBAR ---- */
.adm-toolbar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.adm-search {
    flex: 1; min-width: 200px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text1);
    font-size: 14px;
    padding: 9px 14px;
    outline: none;
}
.adm-search:focus { border-color: var(--accent2); }
.adm-select {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text1);
    font-size: 13px;
    padding: 9px 12px;
    outline: none;
    cursor: pointer;
}
.adm-toolbar-right {
    display: flex; align-items: center; gap: 10px; margin-left: auto;
}
.adm-count-lbl {
    font-size: 12px; color: var(--text2);
}

/* ---- TABLE ---- */
.adm-table-wrap {
    overflow-x: auto;
}
.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.adm-table thead tr {
    border-bottom: 1px solid var(--border);
}
.adm-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: var(--bg2);
}
.adm-table td {
    padding: 11px 14px;
    border-bottom: 1px solid rgba(48,54,61,0.5);
    vertical-align: middle;
    white-space: nowrap;
}
.adm-table tbody tr:hover td {
    background: rgba(255,255,255,0.02);
}
.adm-table tbody tr:last-child td { border-bottom: none; }

/* cell variants */
.adm-tg-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text2);
}
.adm-username { color: #58a6ff; }
.adm-num { font-weight: 600; }
.adm-date { font-size: 12px; color: var(--text2); }

/* Status badges */
.adm-status {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.adm-status-new      { background:rgba(139,148,158,0.15); color:#8b949e; }
.adm-status-progress { background:rgba(245,158,11,0.15);  color:#f59e0b; }
.adm-status-review   { background:rgba(59,130,246,0.15);  color:#60a5fa; }
.adm-status-done     { background:rgba(63,185,80,0.15);   color:#3fb950; }
.adm-status-overdue  { background:rgba(218,54,51,0.15);   color:#ff7b72; }

.adm-priority-low    { color:#4ade80; font-size:11px; }
.adm-priority-medium { color:#facc15; font-size:11px; }
.adm-priority-high   { color:#fb923c; font-size:11px; }
.adm-priority-urgent { color:#f87171; font-size:11px; font-weight:700; }

.adm-active-dot {
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success); margin-right: 5px;
}
.adm-inactive-dot {
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text3); margin-right: 5px;
}

.adm-ban-badge {
    background: rgba(218,54,51,0.1);
    color: #ff7b72;
    font-size: 11px; font-weight: 600;
    padding: 2px 7px; border-radius: 20px;
}
.adm-ok-badge {
    background: rgba(63,185,80,0.1);
    color: #3fb950;
    font-size: 11px; font-weight: 600;
    padding: 2px 7px; border-radius: 20px;
}

/* ---- ACTION BUTTONS ---- */
.adm-ban-btn, .adm-unban-btn {
    display: inline-flex; align-items: center; gap: 5px;
    border: none; border-radius: 6px;
    font-size: 12px; font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
}
.adm-ban-btn:hover   { opacity: 0.85; transform: scale(0.97); }
.adm-unban-btn:hover { opacity: 0.85; transform: scale(0.97); }
.adm-ban-btn:disabled, .adm-unban-btn:disabled { cursor: not-allowed; }

.adm-ban-btn {
    background: rgba(218,54,51,0.12);
    color: #ff7b72;
    border: 1px solid rgba(218,54,51,0.25);
}
.adm-unban-btn {
    background: rgba(63,185,80,0.12);
    color: #3fb950;
    border: 1px solid rgba(63,185,80,0.25);
}

/* ---- EMPTY / LOADING ---- */
.adm-empty {
    text-align: center; padding: 40px;
    color: var(--text2); font-size: 14px;
}
.adm-loading {
    text-align: center; padding: 30px;
    color: var(--text2); font-size: 14px;
}

/* ---- TOAST ---- */
.adm-toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 9999;
    animation: slide-in 0.25s ease;
}
@keyframes slide-in {
    from { transform: translateY(20px); opacity:0; }
    to   { transform: translateY(0);    opacity:1; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .adm-sidebar {
        transform: translateX(-100%);
    }
    .adm-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }
    .adm-main { margin-left: 0; }
    .adm-content { padding: 14px; }
    .adm-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
.adm-sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.adm-sidebar-overlay.show { display: block; }
