/* ============================================
   BOT MANAGER · TROYARYA
   Font: Rubik · Modern Admin Panel
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(15,23,42,.05);
    --shadow-md: 0 4px 16px rgba(15,23,42,.08);
    --shadow-lg: 0 12px 32px rgba(15,23,42,.1);
    --font: 'Rubik', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
}

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* =============== TOPBAR =============== */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand .brand-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    display: grid; place-items: center;
    font-size: 22px;
}
.topbar-brand strong { display: block; font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.topbar-brand small { color: var(--muted); font-size: 12px; font-weight: 500; }

.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-name { color: var(--muted); font-size: 14px; font-weight: 500; }

/* =============== CONTAINER =============== */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 120px;
}

.page-head { margin-bottom: 24px; }
.page-head h1 {
    font-size: 26px; font-weight: 700; color: var(--text);
    letter-spacing: -.02em; margin-bottom: 4px;
}
.page-head p { color: var(--muted); font-size: 14px; }

/* =============== TABS =============== */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 22px;
    background: var(--surface);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.tab {
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: all .2s;
}
.tab:hover { color: var(--primary); background: var(--primary-soft); }
.tab.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

/* =============== CARD =============== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.card-head {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #fbfdff, var(--surface));
}
.card-head h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
}
.card-body { padding: 22px 24px; }

.badge {
    padding: 4px 12px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
}

/* =============== FORM =============== */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
    display: block;
    margin-bottom: 6px;
}
.form-group label strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}
.form-group label small {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text);
    background: #fbfdff;
    transition: all .15s;
    resize: vertical;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37,99,235,.1);
}
textarea {
    min-height: 88px;
    font-family: inherit;
}
textarea.mono, input.mono, .mono {
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.65;
}

.input-pw { position: relative; }
.toggle-pw {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    font-size: 16px; cursor: pointer;
    padding: 4px 8px;
    opacity: .5;
    transition: opacity .15s;
}
.toggle-pw:hover { opacity: 1; }

/* =============== BUTTONS =============== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .18s;
    letter-spacing: -.005em;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.28);
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37,99,235,.38);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.btn-ghost {
    background: transparent;
    color: var(--text-soft);
    border: 1.5px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg); border-color: var(--muted); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 16px; font-size: 13px; }

/* =============== STICKY ACTIONS =============== */
.sticky-actions {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    z-index: 90;
    box-shadow: 0 -4px 20px rgba(15,23,42,.06);
}

/* =============== LOGIN PAGE =============== */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(ellipse at top left, rgba(37,99,235,.1), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(16,185,129,.08), transparent 50%),
        linear-gradient(135deg, #f8fafc, #eef2ff);
    padding: 24px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px 32px;
    box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-icon {
    width: 72px; height: 72px;
    margin: 0 auto 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    display: grid; place-items: center;
    font-size: 36px;
    box-shadow: 0 12px 24px rgba(37,99,235,.18);
}
.login-brand h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
    margin-bottom: 4px;
}
.login-brand p { color: var(--muted); font-size: 14px; }

.login-card form { margin-top: 20px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.login-card input { background: #fbfdff; }

.login-footer {
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* =============== ALERT =============== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* =============== BACKUP LIST =============== */
.backup-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.backup-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--mono);
    color: var(--text-soft);
}
.backup-list li small {
    color: var(--muted);
    font-family: var(--font);
    font-size: 12.5px;
}

/* =============== TOAST =============== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: var(--text);
    color: #fff;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all .35s cubic-bezier(.34,1.56,.64,1);
    z-index: 200;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* =============== RESPONSIVE =============== */
@media (max-width: 720px) {
    .container { padding: 20px 16px 130px; }
    .topbar { padding: 12px 16px; }
    .user-name { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .card-head { padding: 16px 18px; }
    .card-body { padding: 18px; }
    .sticky-actions { padding: 12px 16px; }
    .sticky-actions .btn { flex: 1; justify-content: center; }
    .page-head h1 { font-size: 22px; }
}

/* =============== SETTINGS PAGE =============== */
.pw-strength {
    margin-top: 8px;
}
.pw-strength-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}
.pw-strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #ef4444;
    border-radius: 999px;
    transition: all .3s ease;
}
.pw-strength small {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.info-list li {
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-soft);
}
.info-list code {
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 12.5px;
}
.info-list strong {
    color: var(--text);
    font-weight: 600;
    margin-right: 4px;
}

@media (max-width: 720px) {
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
}

/* =============== MODAL ELEGAN =============== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all .3s ease;
    z-index: 9999;
}
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #fff;
    border-radius: 20px;
    padding: 36px 32px 28px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.2),
        0 0 0 1px rgba(255,255,255,0.05);
    transform: scale(0.9) translateY(20px);
    transition: all .35s cubic-bezier(.34, 1.56, .64, 1);
}
.modal-overlay.show .modal-box {
    transform: scale(1) translateY(0);
}

.modal-icon-success {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: pulseSuccess .6s ease-out;
}
.modal-icon-success svg {
    width: 36px;
    height: 36px;
    color: #059669;
}
@keyframes pulseSuccess {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
    margin-bottom: 8px;
}
.modal-message {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 24px;
}
.modal-box .btn {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: 12px;
}

.toast { z-index: 10000 !important; }

/* Modal Error Icon */
.modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: pulseSuccess .6s ease-out;
}
.modal-icon svg {
    width: 36px;
    height: 36px;
}
.modal-icon-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
}
.modal-icon-error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239,68,68,.28);
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* =============== FLASH MESSAGE =============== */
.flash {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 15px;
    font-weight: 500;
    animation: flashIn .4s ease;
}
.flash-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}
.flash-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1.5px solid #a7f3d0;
}
.flash-success .flash-icon {
    background: #10b981;
    color: #fff;
}
.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1.5px solid #fecaca;
}
.flash-error .flash-icon {
    background: #ef4444;
    color: #fff;
}
@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE OVERRIDE — Fix tampilan desktop, tablet, HP
   ============================================================ */

/* === TABLET (768px - 991px) === */
@media (max-width: 991px) {
    .container {
        padding: 24px 20px 120px;
        max-width: 100%;
    }
    .topbar { padding: 12px 20px; }
    .card-head { padding: 16px 20px; }
    .card-body { padding: 20px; }
}

/* === HP BESAR (481px - 767px) === */
@media (max-width: 767px) {
    body { font-size: 14.5px; }

    .container {
        padding: 16px 14px 100px;
    }

    /* TOPBAR — compact */
    .topbar {
        padding: 10px 14px;
        gap: 8px;
    }
    .topbar-brand {
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    .topbar-brand .brand-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 10px;
    }
    .topbar-brand strong { font-size: 14px; }
    .topbar-brand small { font-size: 11px; }

    .topbar-user {
        gap: 6px;
        flex-shrink: 0;
    }
    .topbar-user .user-name { display: none; }
    .topbar-user .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }

    /* PAGE HEAD */
    .page-head { margin-bottom: 16px; }
    .page-head h1 { font-size: 20px; }
    .page-head p { font-size: 13px; }

    /* TABS — scroll horizontal */
    .tabs {
        padding: 4px;
        gap: 4px;
        margin-bottom: 16px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab {
        padding: 8px 14px;
        font-size: 13px;
        flex-shrink: 0;
    }

    /* CARD */
    .card {
        border-radius: 14px;
        margin-bottom: 14px;
    }
    .card-head {
        padding: 14px 16px;
    }
    .card-head h2 { font-size: 14.5px; }
    .card-body { padding: 16px; }

    .badge { font-size: 11px; padding: 3px 10px; }

    /* FORM — font-size minimal 16px biar iOS tidak auto-zoom */
    input[type="text"],
    input[type="password"],
    textarea {
        font-size: 16px;
        padding: 12px 14px;
    }
    .form-group { margin-bottom: 14px; }
    .form-group label strong { font-size: 13.5px; }
    .form-group label small { font-size: 12px; }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* STICKY ACTIONS */
    .sticky-actions {
        padding: 10px 14px;
        gap: 8px;
    }
    .sticky-actions .btn {
        padding: 12px 16px;
        font-size: 14px;
        flex: 1;
        justify-content: center;
        white-space: nowrap;
    }

    /* MODAL */
    .modal-box {
        padding: 28px 22px 22px;
        border-radius: 16px;
    }
    .modal-title { font-size: 18px; }
    .modal-message { font-size: 14px; }

    /* FLASH */
    .flash {
        padding: 12px 16px;
        font-size: 14px;
        gap: 10px;
    }
    .flash-icon { width: 28px; height: 28px; font-size: 14px; }

    /* LOGIN */
    .login-card { padding: 32px 22px 26px; }
    .login-brand h1 { font-size: 20px; }
    .login-icon { width: 60px; height: 60px; font-size: 30px; }
}

/* === HP KECIL (max 480px) === */
@media (max-width: 480px) {
    body { font-size: 14px; }
    .container { padding: 12px 10px 100px; }

    /* TOPBAR — super compact */
    .topbar { padding: 8px 10px; }
    .topbar-brand .brand-icon { width: 32px; height: 32px; font-size: 16px; }
    .topbar-brand strong { font-size: 13px; }
    .topbar-brand small { font-size: 10px; }
    .topbar-user .btn-sm {
        padding: 6px 8px;
        font-size: 11px;
    }

    .page-head h1 { font-size: 18px; }
    .page-head p { font-size: 12.5px; }

    .tabs { padding: 3px; }
    .tab { padding: 7px 12px; font-size: 12.5px; }

    .card { border-radius: 12px; }
    .card-head { padding: 12px 14px; }
    .card-head h2 { font-size: 14px; }
    .card-body { padding: 14px; }

    input[type="text"],
    input[type="password"],
    textarea {
        font-size: 16px;
        padding: 11px 12px;
    }

    .sticky-actions { padding: 8px 10px; }
    .sticky-actions .btn {
        font-size: 13px;
        padding: 11px 12px;
    }

    .modal-box { padding: 24px 18px; }
    .modal-title { font-size: 17px; }
    .login-card { padding: 26px 18px 22px; }
}

/* === DESKTOP BESAR (min 1200px) — jaga tidak terlalu lebar === */
@media (min-width: 1200px) {
    .container {
        max-width: 1080px;
        margin: 0 auto;
    }
}

/* === FIX iOS — cegah auto-zoom saat focus input === */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    textarea {
        font-size: 16px !important;
    }
}

/* ============================================================
   TOPBAR — Perbesar Font (override responsive yang terlalu kecil)
   ============================================================ */

/* === DESKTOP & TABLET === */
@media (min-width: 768px) {
    .topbar {
        padding: 18px 32px;
    }
    .topbar-brand .brand-icon {
        width: 48px;
        height: 48px;
        font-size: 26px;
        border-radius: 14px;
    }
    .topbar-brand strong {
        font-size: 19px;
        font-weight: 700;
    }
    .topbar-brand small {
        font-size: 13.5px;
    }
    .topbar-user .user-name {
        font-size: 15px;
    }
    .topbar-user .btn-sm {
        padding: 9px 18px;
        font-size: 14px;
    }
}

/* === HP BESAR (481-767px) === */
@media (max-width: 767px) {
    .topbar {
        padding: 12px 16px;
    }
    .topbar-brand .brand-icon {
        width: 40px;
        height: 40px;
        font-size: 22px;
        border-radius: 12px;
    }
    .topbar-brand strong {
        font-size: 16px;
    }
    .topbar-brand small {
        font-size: 12px;
    }
    .topbar-user .btn-sm {
        padding: 8px 14px;
        font-size: 13.5px;
    }
}

/* === HP KECIL (max 480px) === */
@media (max-width: 480px) {
    .topbar {
        padding: 10px 12px;
    }
    .topbar-brand .brand-icon {
        width: 38px;
        height: 38px;
        font-size: 20px;
        border-radius: 10px;
    }
    .topbar-brand strong {
        font-size: 15.5px;
    }
    .topbar-brand small {
        font-size: 11.5px;
    }
    .topbar-user .btn-sm {
        padding: 7px 12px;
        font-size: 12.5px;
    }
}

/* =============== BACKUP LIST — TOMBOL HAPUS =============== */
.backup-list li {
    position: relative;
    padding-right: 52px;
}
.backup-delete-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    opacity: .5;
    transition: all .2s;
}
.backup-delete-btn:hover {
    opacity: 1;
    background: #fef2f2;
    transform: translateY(-50%) scale(1.1);
}
.backup-delete-btn:disabled {
    opacity: .3;
    cursor: not-allowed;
}
