/* ==============================================================================
   P2KPT UBK - Admin Panel Styling (Modern, Clean, Elegant & Responsive)
   Consistent Header, Footer, Professional Inputs & Cross-Browser Buttons
   ============================================================================== */

:root {
    --maroon: #800000;
    --dark-maroon: #5b0000;
    --light-maroon: #9b1c1c;
    --gold: #d4af37;
    --gold-hover: #b89726;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-focus: #800000;
    --sidebar-width: 270px;
    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--maroon);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: var(--dark-maroon);
}

/* ==============================================================================
   LAYOUT WRAPPER, SIDEBAR & TOPBAR
   ============================================================================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #e2e8f0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    background: linear-gradient(135deg, var(--maroon) 0%, var(--dark-maroon) 100%);
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header img {
    height: 44px;
    width: auto;
    background: #fff;
    padding: 3px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sidebar-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: #fef08a;
    margin-top: 3px;
    font-weight: 500;
}

.sidebar-nav {
    padding: 16px 0;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 14px 20px 6px;
    font-weight: 700;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 4px solid transparent;
    transition: all 0.15s ease-in-out;
}

.sidebar-menu li a i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 10px;
    color: #94a3b8;
    transition: color 0.15s ease;
}

.sidebar-menu li a:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-menu li a:hover i {
    color: var(--gold);
}

.sidebar-menu li.active a {
    background-color: rgba(128, 0, 0, 0.35);
    color: #ffffff;
    border-left-color: var(--gold);
    font-weight: 600;
}

.sidebar-menu li.active a i {
    color: var(--gold);
}

.sidebar-footer {
    padding: 16px 20px;
    background-color: #0b0f17;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--maroon) 0%, var(--gold) 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Main Content Area */
.admin-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--bg-body);
}

/* Topbar */
.admin-topbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 4px;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--maroon);
    letter-spacing: -0.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.lang-switch {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.lang-btn {
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--maroon);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(128, 0, 0, 0.3);
}

.btn-view-site {
    background: #f1f5f9;
    color: #475569;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.btn-view-site:hover {
    background: #e2e8f0;
    color: var(--maroon);
}

/* Content Container */
.admin-content {
    padding: 28px;
    flex-grow: 1;
}

/* Consistent Footer (Poin 5) */
.admin-footer {
    padding: 16px 28px;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ==============================================================================
   FLASH ALERTS & WARNING BANNERS (Poin 7)
   ============================================================================== */
.flash-alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-alert.danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-alert.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-alert.info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Banner Peringatan Kata Sandi Default (Poin 7) */
.default-pass-warning {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1.5px solid #fdba74;
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: var(--shadow-md);
}

.default-pass-warning .icon-box {
    font-size: 2rem;
    color: #ea580c;
    flex-shrink: 0;
}

.default-pass-warning h4 {
    color: #9a3412;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.default-pass-warning p {
    color: #7c2d12;
    font-size: 0.88rem;
    margin: 0;
}

/* ==============================================================================
   METRIC KPI CARDS (Poin 5)
   ============================================================================== */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 22px;
    margin-bottom: 28px;
}

.metric-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--maroon);
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.metric-card.gold-border { border-left-color: var(--gold); }
.metric-card.blue-border { border-left-color: var(--info); }
.metric-card.green-border { border-left-color: var(--success); }

.metric-info h3 {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.metric-info .number {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 5px;
    line-height: 1.1;
}

.metric-icon {
    width: 52px;
    height: 52px;
    background: #f8fafc;
    color: var(--maroon);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

/* ==============================================================================
   CARD BOXES & PANELS
   ============================================================================== */
.card-box {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 26px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-box-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
}

.card-box-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark-maroon);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-box-body {
    padding: 24px;
}

/* ==============================================================================
   PROFESSIONAL TEXTBOXES & FORM INPUTS (Poin 8)
   ============================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group-admin {
    margin-bottom: 20px;
}

.form-group-admin label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
    color: #334155;
    font-size: 0.88rem;
    letter-spacing: -0.01em;
}

.form-group-admin label .required {
    color: var(--danger);
    margin-left: 2px;
}

/* Normalized, elegant, high-definition input styles */
.form-control-admin {
    width: 100%;
    height: 42px;
    padding: 8px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-family: inherit;
    transition: all 0.2s ease-in-out;
    background-color: #ffffff;
    color: var(--text-main);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

textarea.form-control-admin {
    height: auto;
    min-height: 100px;
    padding: 12px 14px;
    resize: vertical;
    line-height: 1.5;
}

select.form-control-admin {
    padding-right: 32px;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748B%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
}

.form-control-admin:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.12);
    background-color: #ffffff;
}

.form-control-admin::placeholder {
    color: #94a3b8;
    font-size: 0.88rem;
}

.form-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.4;
}

/* Custom Checkbox & Radio Styling */
.checkbox-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.checkbox-card:hover {
    background: #ffffff;
    border-color: var(--maroon);
}

.checkbox-card input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--maroon);
    cursor: pointer;
}

/* ==============================================================================
   CROSS-BROWSER CONSISTENT BUTTONS (Poin 14)
   ============================================================================== */
.btn-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    line-height: 1.25;
    white-space: nowrap;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    user-select: none;
}

.btn-admin:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--maroon);
    color: #ffffff !important;
    border-color: var(--maroon);
    box-shadow: 0 2px 4px rgba(128, 0, 0, 0.2);
}

.btn-primary:hover {
    background-color: var(--dark-maroon);
    border-color: var(--dark-maroon);
    color: #ffffff !important;
    box-shadow: 0 4px 8px rgba(128, 0, 0, 0.3);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #334155;
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
}

.btn-danger {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-danger:hover {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.btn-success {
    background-color: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

.btn-success:hover {
    background-color: #059669;
    color: #ffffff;
    border-color: #059669;
}

.btn-warning {
    background-color: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

.btn-warning:hover {
    background-color: #d97706;
    color: #ffffff;
    border-color: #d97706;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* ==============================================================================
   TABLES & BADGES
   ============================================================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 18px;
    border-bottom: 2px solid var(--border-color);
}

.admin-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background-color: #f8fafc;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ==============================================================================
   MODAL / POPUP DIALOG (Poin 15, 17)
   ============================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
}

.modal-header h3 {
    font-size: 1.15rem;
    color: var(--dark-maroon);
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==============================================================================
   QUILL EDITOR STYLING (Poin 9, 15, 17, 20)
   ============================================================================== */
.quill-wrapper {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    overflow: hidden;
    transition: border-color 0.2s;
}

.quill-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.12);
}

.ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: #f8fafc;
}

.ql-container.ql-snow {
    border: none !important;
    min-height: 180px;
    font-family: inherit !important;
    font-size: 0.92rem !important;
}

/* ==============================================================================
   LOGIN SCREEN (Poin 11: I'm Human Verification)
   ============================================================================== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #6b0000 0%, #111827 100%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-header {
    background: linear-gradient(135deg, var(--maroon) 0%, var(--dark-maroon) 100%);
    color: #ffffff;
    padding: 30px 24px;
    text-align: center;
}

.login-header img {
    height: 64px;
    background: #ffffff;
    padding: 5px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.login-header h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.login-header p {
    font-size: 0.88rem;
    color: #fef08a;
    margin-top: 2px;
}

.login-body-content {
    padding: 32px 28px;
}

/* "I'm Human" Verification Challenge Box (Poin 11) */
.human-verify-card {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.human-verify-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
}

.human-question-badge {
    display: inline-block;
    background: var(--maroon);
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    letter-spacing: 1px;
}

/* ==============================================================================
   TABS NAVIGATION (Poin 2: Tab Telegram & SMTP)
   ============================================================================== */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
    gap: 8px;
}

.tab-link {
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.tab-link:hover {
    color: var(--maroon);
}

.tab-link.active {
    color: var(--maroon);
    border-bottom-color: var(--maroon);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Responsive */
@media (max-width: 900px) {
    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -100%;
    }
    .admin-sidebar.show {
        left: 0;
    }
    .menu-toggle-btn {
        display: block;
    }
    .admin-content {
        padding: 18px;
    }
}
