/* ==========================================================================
   PHOTOREX GLOBAL STYLESHEET
   Tema: Cyberpunk Glassmorphism
========================================================================== */

:root {
    /* --- VARIABEL WARNA UTAMA (Ubah di sini untuk Rebranding) --- */
    --primary: #FF2E93;
    --secondary: #00F0FF;
    
    /* --- VARIABEL BACKGROUND & KARTU (TEMA GELAP) --- */
    --bg-dark: #0B0F19;
    --bg-darker: #05070A;
    --bg-card: rgba(255, 255, 255, 0.05);
    
    /* --- VARIABEL TEKS (TEMA GELAP) --- */
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* --- VARIABEL STATUS --- */
    --success: #10b981; 
    --warning: #f59e0b;
    --danger: #ef4444;

    /* --- VARIABEL DASHBOARD ADMIN --- */
    --sidebar-width: 260px;
    --header-height: 70px;
    --sidebar-text: #ffffff;
    --sidebar-muted: #9ca3af;
    --bg-light: #f4f7f6;
    --text-dark: #333333;
}

/* --- BASE STYLES --- */
body { 
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
}

/* --- CUSTOM SCROLLBAR GLOBAL --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* --- REUSABLE UTILITY CLASSES --- */
.gradient-text {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glow-btn {
    box-shadow: 0 0 20px rgba(255, 46, 147, 0.5);
    transition: all 0.3s ease;
}
.glow-btn:hover {
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.6);
    transform: translateY(-2px);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

/* --- DEKORASI BACKGROUND (GLOWING ORBS) --- */
.bg-glow-1 {
    position: fixed; top: -10%; left: -10%; width: 50vw; height: 50vw;
    background: var(--primary); border-radius: 50%; mix-blend-mode: screen;
    filter: blur(150px); opacity: 0.15; pointer-events: none; z-index: 0;
}
.bg-glow-2 {
    position: fixed; bottom: -10%; right: -10%; width: 50vw; height: 50vw;
    background: var(--secondary); border-radius: 50%; mix-blend-mode: screen;
    filter: blur(150px); opacity: 0.15; pointer-events: none; z-index: 0;
}

/* ==========================================================================
   DASHBOARD ADMIN STYLES (TEMA TERANG PADA KONTEN UTAMA)
========================================================================== */
.admin-body { 
    background: var(--bg-light); 
    color: var(--text-dark);
    display: flex; 
    height: 100vh; /* Fallback untuk browser lawas */
    height: 100dvh; /* FIX 1: Mengatasi Bug Tinggi Layar pada Tablet & Mobile Safari/Chrome */
    overflow: hidden; 
}

/* Custom scrollbar khusus area Admin (Terang) */
.admin-body ::-webkit-scrollbar-track { background: #e9ecef; }
.admin-body ::-webkit-scrollbar-thumb { background: var(--primary); }

/* --- MEMAKSA SEMUA JUDUL DI ADMIN MENJADI WARNA GELAP --- */
.admin-body h1, .admin-body h2, .admin-body h3, .admin-body h4, .admin-body h5, .admin-body h6 {
    color: var(--text-dark);
    font-weight: 800;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    height: 100%;
    position: fixed;
    left: 0; top: 0;
    box-shadow: 5px 0 20px rgba(0,0,0,0.5);
}

.brand {
    height: var(--header-height);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 800; 
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 2px;
    background: rgba(0,0,0,0.2);
    color: white; 
}

.menu { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
.menu-title { font-size: 0.75rem; text-transform: uppercase; color: var(--secondary); padding: 20px 20px 5px; font-weight: 800; letter-spacing: 1px; opacity: 0.8; }
.menu-item { padding: 0; margin: 2px 10px; }

.menu-link {
    display: flex; align-items: center;
    padding: 12px 15px;
    color: var(--sidebar-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.menu-link:hover, .menu-link.active {
    background: linear-gradient(90deg, rgba(255,46,147,0.15) 0%, transparent 100%);
    color: var(--sidebar-text);
    box-shadow: inset 3px 0 0 var(--primary);
}

.menu-icon { width: 30px; font-size: 1.1rem; text-align: center; margin-right: 10px; transition: 0.3s; }
.menu-link:hover .menu-icon, .menu-link.active .menu-icon { color: var(--secondary); text-shadow: 0 0 10px rgba(0,240,255,0.5); }

.user-panel {
    padding: 20px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--sidebar-muted);
}
.user-name { color: white; font-weight: 800; display: block; margin-bottom: 8px; font-size: 1rem; }

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex; flex-direction: column;
    height: 100%;
    overflow: hidden; /* FIX 2: Wajib ditambahkan agar anak (content-area) tidak bisa membuat layar melar / tertahan */
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: calc(100% - var(--sidebar-width));
}

/* HEADER / TOP BAR */
.top-bar {
    height: var(--header-height);
    background: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 25px;
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    flex-shrink: 0; /* Pastikan top-bar tidak ikut menyusut */
}

.toggle-btn { font-size: 1.5rem; cursor: pointer; color: var(--sidebar-text); background: none; border: none; transition: 0.2s; }
.toggle-btn:hover { color: var(--secondary); text-shadow: 0 0 10px rgba(0,240,255,0.5); }

.branch-badge { 
    background: rgba(0, 240, 255, 0.1); 
    color: var(--secondary); 
    padding: 8px 18px; 
    border-radius: 50px; 
    font-size: 0.9rem; 
    font-weight: 800; 
    border: 1px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 15px rgba(0,240,255,0.1);
}

.profile-link { text-decoration: none; cursor: pointer; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 8px; }
.profile-link:hover { background: rgba(0, 240, 255, 0.2); box-shadow: 0 0 20px rgba(0,240,255,0.3); transform: translateY(-2px); }

/* SCROLLABLE AREA */
.content-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* FIX 3: Agar scroll di iPad/iOS terasa mulus dan responsif */
    position: relative;
    background: var(--bg-light);
}

/* COMPONENTS (TERANG) */
.admin-body .card { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 2px 15px rgba(0,0,0,0.03); margin-bottom: 20px; border: 1px solid #eee; }

.admin-body label { display: block; margin: 15px 0 5px; font-weight: 600; color: #555; }
.admin-body input[type="text"], .admin-body input[type="tel"], .admin-body input[type="number"], .admin-body select, .admin-body input[type="password"] { 
    width: 100%; padding: 12px 15px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; font-size: 1rem; font-family: 'Plus Jakarta Sans', sans-serif;
    background: white; color: #333; transition: 0.2s;
}
.admin-body input:focus, .admin-body select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(255,46,147,0.15); }

.admin-body button.btn-primary, .admin-body a.btn-primary { 
    width: 100%; padding: 12px 20px; background: var(--primary); color: white; border: none; border-radius: 6px; font-size: 1rem; font-weight: bold; margin-top: 20px; cursor: pointer; transition: 0.2s; 
    text-align: center; display: inline-block; box-sizing: border-box; text-decoration: none;
}
.admin-body button.btn-primary:hover, .admin-body a.btn-primary:hover { background: #e01b7a; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(255,46,147,0.3); }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    #sidebar-overlay {
        display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); z-index: 900;
    }
    #sidebar-overlay.active { display: block; }
    .content-area { padding: 20px 15px; }
}

.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }

/* --- STANDARISASI INPUT PENCARIAN & FILTER --- */
.search-box { display: flex; gap: 10px; flex: 1; max-width: 600px; flex-wrap: wrap; align-items: center; }
.search-box input[type="text"], 
.search-box input[type="date"], 
.search-box select { 
    flex: 1; min-width: 150px; padding: 0 15px; border: 1px solid #ddd; border-radius: 5px; 
    font-family: inherit; font-size: 0.95rem; box-sizing: border-box; height: 42px; color: #333; outline: none; transition: 0.2s;
}
.search-box input[type="text"]:focus, 
.search-box input[type="date"]:focus, 
.search-box select:focus {
    border-color: var(--primary);
}

/* --- STANDARISASI TOMBOL FORM (SEBARIS DENGAN INPUT) --- */
.btn-form {
    padding: 0 20px;
    height: 42px; /* Sama persis dengan input (42px) */
    border-radius: 5px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border: none;
    transition: 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.btn-form-search { background: #007bff; color: white; }
.btn-form-search:hover { background: #0056b3; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,123,255,0.3); }

.btn-form-reset { background: #dc3545; color: white; padding: 0 15px; }
.btn-form-reset:hover { background: #c82333; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(220,53,69,0.3); }

.btn-form-add { background: #28a745; color: white; }
.btn-form-add:hover { background: #218838; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(40,167,69,0.3); }

table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
th, td { padding: 15px 12px; text-align: left; border-bottom: 1px solid #eee; vertical-align: middle; }
th { background: #f8f9fa; color: #555; font-weight: 600; text-transform: uppercase; font-size: 0.85rem; }
tr.row-active { background: #e8f5e9; border-left: 5px solid #28a745; }
tr.row-queued { background: #fff3cd; border-left: 5px solid #ffc107; }
tr:hover { background: #f1f1f1; }

.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; }
.badge-active { background: #28a745; color: white; animation: pulse 2s infinite; }
.badge-queued { background: #ffc107; color: #333; }
.badge-completed { background: #eee; color: #888; }
.badge-paid { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge-unpaid { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

.timer-badge { font-family: monospace; font-size: 1rem; font-weight: bold; color: #333; display: inline-block; margin-left: 5px; }
.timer-warning { color: #dc3545; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }

.btn-action { padding: 6px 12px; border-radius: 4px; border: none; cursor: pointer; color: white; font-size: 0.85rem; margin-right: 5px; margin-bottom: 5px; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.btn-stop { background: #dc3545; }
.btn-start { background: #007bff; }
.btn-pay { background: #28a745; font-weight:bold; }
.btn-rincian { background: #17a2b8; }
.btn-cancel { background: #6c757d; }
.btn-delete { background: #dc3545; justify-content: center; width: 32px; }
.btn-delete:hover { background: #c82333; }
.btn-edit-data { background: #ffc107; color: #333; font-weight: 600; }
.btn-edit-data:hover { background: #e0a800; }

.btn-revisit { background: #28a745; font-weight: bold; }
.btn-revisit:hover { background: #218838; }

.photo-grid { display: flex; gap: 5px; flex-wrap: wrap; }
.thumb-img { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; cursor: pointer; transition: transform 0.2s; position: relative; }
.thumb-img:hover { transform: scale(1.5); z-index: 10; border-color: #007bff; }
.edit-indicator { position: absolute; top: -5px; right: -5px; background: #9c27b0; color: white; font-size: 0.6rem; padding: 2px 4px; border-radius: 3px; font-weight: bold; z-index: 12; pointer-events: none; }

/* Modal Styles */
.modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; }
.modal-content { background: white; width: 500px; max-width: 90%; padding: 25px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.3); position: relative; }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; color: #aaa; background: none; border: none; }

#img-modal { background: rgba(0,0,0,0.9); flex-direction: column; overflow-y: auto; padding: 20px 0; align-items: center; cursor: pointer; }
#img-modal .modal-content { background: transparent; box-shadow: none; width: 800px; display: flex; flex-direction: column; align-items: center; cursor: default; }
#modal-img { max-width: 100%; max-height: 60vh; border: 5px solid white; box-shadow: 0 0 20px rgba(0,0,0,0.5); margin-bottom: 20px; }

/* GDrive Cloud Placeholder di Modal */
#cloud-placeholder { width: 100%; height: 300px; display: none; align-items: center; justify-content: center; flex-direction: column; color: white; background: rgba(255,255,255,0.1); border-radius: 10px; margin-bottom: 20px; text-align:center; }

.modal-actions { display: flex; gap: 10px; margin-bottom: 20px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 600px) {
    .modal-actions .btn-modal {
        flex: 1 1 calc(50% - 10px);
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}
.btn-modal { padding: 10px 20px; border-radius: 50px; text-decoration: none; color: white; font-weight: bold; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.btn-modal-wa { background: #25D366; }
.btn-modal-wa-manual { background: #128C7E; }
.btn-modal-wa-manual:hover { background: #0d6b5e; }
.btn-modal-dl { background: #007bff; }
.btn-modal-hapus { background: #dc3545; }
.btn-modal-hapus:hover { background: #bd2130; }
.btn-modal-close { background: #dc3545; position: absolute; top: -15px; right: -15px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; font-size: 1.2rem; border: 2px solid white; color: white; cursor: pointer; z-index: 100; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }

.pagination-container { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-bottom: 40px; }
.page-info { font-size: 0.9rem; color: #666; text-align: center; }
.pagination { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; align-items: center; }
.page-link { padding: 8px 12px; border: 1px solid #ddd; background: white; text-decoration: none; color: #333; border-radius: 5px; transition: 0.2s; }
.page-link.active { background: #007bff; color: white; border-color: #007bff; }

@media (max-width: 1024px) {
    .content-wrapper { padding-bottom: 120px !important; } 
    .pagination-container { padding-bottom: 40px; }
}

@media (max-width: 576px) {
    .btn-prev-next { display: none !important; }
}

/* RESPONSIVE TABLE KHUSUS HP */
@media (max-width: 768px) {
    table, thead, tbody, th, td, tr { display: block; width: 100%; box-sizing: border-box; }
    thead tr { display: none; }
    table { background: transparent; box-shadow: none; }
    
    tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas: 
            "info status"
            "tagihan aksi"
            "foto foto";
        gap: 10px;
        padding: 15px !important;
        margin-bottom: 15px;
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border: 1px solid #eee;
    }
    
    tr.row-active { border-left: 5px solid #28a745; }
    tr.row-queued { border-left: 5px solid #ffc107; }
    
    td { padding: 0 !important; border: none !important; }
    td:nth-child(1) { grid-area: info; }
    td:nth-child(2) { grid-area: status; text-align: right; }
    td:nth-child(3) { grid-area: tagihan; border-top: 1px dashed #eee; padding-top: 10px !important; }
    td:nth-child(5) { grid-area: aksi; display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; align-content: flex-start; border-top: 1px dashed #eee; padding-top: 10px !important; }
    td:nth-child(4) { grid-area: foto; margin-top: 5px; border-top: 1px dashed #ddd; padding-top: 10px !important; }
    
    .photo-grid { flex-wrap: nowrap !important; overflow-x: auto; padding-bottom: 8px; gap: 10px; -webkit-overflow-scrolling: touch; }
    .photo-grid::-webkit-scrollbar { height: 6px; }
    .photo-grid::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
    .photo-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
    .btn-action { margin-right: 0; font-size: 0.8rem; padding: 8px 12px; }

    #img-modal { justify-content: flex-start; padding-top: 30px; }
    #modal-img { max-height: 45vh !important; }
    .raw-grid { flex-wrap: nowrap !important; justify-content: flex-start !important; overflow-x: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; }
    .raw-item { flex-shrink: 0; }
    .raw-grid::-webkit-scrollbar { height: 6px; }
    .raw-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.1); border-radius: 10px; }
    .raw-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.4); border-radius: 10px; }
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; box-sizing: border-box; }

.raw-section { width: 100%; background: rgba(255,255,255,0.1); border-radius: 10px; padding: 15px; text-align: center; margin-top: 10px; }
.raw-title { color: #aaa; font-size: 0.9rem; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.raw-grid { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.raw-item { position: relative; display: block; transition: transform 0.2s; }
.raw-item:hover { transform: scale(1.1); }
.raw-thumb { width: 70px; height: 70px; object-fit: cover; border: 2px solid #555; border-radius: 5px; }
.raw-dl-icon { position: absolute; bottom: -5px; right: -5px; background: #28a745; color: white; width: 24px; height: 24px; border-radius: 50%; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle-password {
    position: absolute;
    right: 16px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 0.9rem;
}

.toggle-password:hover {
    color: var(--secondary);
}