/* ===============================================================
   ADMIN.CSS - DASHBOARD SISTEM INFORMASI MI TANWIRUL AFKAR
   Desain Admin Panel Modern, Bersih, Kelas Dunia
   Hak Cipta (c) 2026 Anton Maghfiron - A.D.A COMPUTER
   =============================================================== */

.admin-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f1f5f9;
}

/* ---------------- SIDEBAR ---------------- */
.admin-sidebar {
    width: 260px;
    background: #064e3b;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition);
    z-index: 1000;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.sidebar-brand h2 {
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.sidebar-brand p {
    font-size: 0.72rem;
    color: #a7f3d0;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: var(--transition);
}

.nav-item-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.nav-item-btn.active {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.nav-item-btn .nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ---------------- MAIN CONTENT AREA ---------------- */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.admin-topbar {
    background: white;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
}

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

.page-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-dark);
}

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

/* Status Badges */
.wa-gateway-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
}
.wa-gateway-status-badge.status-online {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}
.wa-gateway-status-badge.status-offline {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}
.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.admin-content {
    flex: 1;
    padding: 28px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ---------------- DASHBOARD METRIC STATS ---------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 22px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-info h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-info .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-icon.gold { background: #fef3c7; color: #b45309; }
.stat-icon.blue { background: #e0f2fe; color: #0369a1; }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }

/* ---------------- DATA TABLES & PANELS ---------------- */
.content-card {
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 30px;
}

.card-toolbar {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.toolbar-title h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-dark);
}
.toolbar-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.modern-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 12px 18px;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.modern-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

.modern-table th.col-receipt,
.modern-table td.col-receipt,
.col-receipt {
    white-space: nowrap !important;
    min-width: 175px !important;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    color: #064e3b !important;
    letter-spacing: 0.5px;
}

.nowrap {
    white-space: nowrap !important;
}

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

.table-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gold { background: #fef3c7; color: #92400e; }
.badge-blue { background: #e0f2fe; color: #075985; }

/* ---------------- ACTION BUTTONS ---------------- */
.btn-sm {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-sm-primary { background: var(--primary); color: white; }
.btn-sm-primary:hover { background: var(--primary-light); }

.btn-sm-outline { background: white; border: 1px solid #cbd5e1; color: #334155; }
.btn-sm-outline:hover { background: #f8fafc; border-color: var(--primary); }

.btn-sm-danger { background: #fee2e2; color: #dc2626; }
.btn-sm-danger:hover { background: #fecaca; }

/* ---------------- MODALS ---------------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-dark);
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #64748b;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.1);
}

/* Responsive Admin */
#toggle-sidebar {
    display: none;
}

@media (max-width: 900px) {
    #toggle-sidebar {
        display: inline-flex !important;
    }
    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .admin-sidebar.open {
        left: 0;
    }
}
