/* =============================================
   ROOT VARIABLES
   ============================================= */
:root {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a2332;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --success: #00C853;
    --danger: #FF1744;
    --warning: #FFB300;
    --radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0f1621;
    --bg-secondary: #1a2332;
    --bg-card: #1e2840;
    --text-primary: #e8f4fd;
    --text-secondary: #b0c4de;
    --border-color: #2a3a4a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* =============================================
   RESET & GLOBAL
   ============================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    transition: var(--transition);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border: 1px solid var(--border-color);
}

.brand {
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.brand-mark {
    font-size: 1.8rem;
}

.navbar nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.navbar nav a {
    padding: 8px 18px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.navbar nav a:hover,
.navbar nav a.active {
    background: var(--primary);
    color: white;
}

.theme-toggle {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    font-size: 1.1rem;
}

.theme-toggle:hover {
    transform: rotate(30deg);
    background: var(--primary);
    color: white;
}

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

.stat-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.green { background: rgba(0, 200, 83, 0.15); color: var(--success); }
.stat-icon.blue { background: rgba(108, 99, 255, 0.15); color: var(--primary); }
.stat-icon.orange { background: rgba(255, 179, 0, 0.15); color: var(--warning); }
.stat-icon.red { background: rgba(255, 23, 68, 0.15); color: var(--danger); }

.stat-info small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2px;
}

/* =============================================
   HERO
   ============================================= */
.hero {
    text-align: center;
    padding: 40px 20px 30px;
    background: linear-gradient(135deg, var(--primary), #00D4FF);
    border-radius: var(--radius);
    margin-bottom: 30px;
    color: white;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* =============================================
   TOOLBAR
   ============================================= */
.toolbar {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.toolbar form {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    min-width: 280px;
}

.toolbar form input[type="text"],
.toolbar form input[type="date"] {
    flex: 1;
    min-width: 140px;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.toolbar form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.15);
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.btn-primary,
.btn {
    background: var(--primary);
    color: white;
}

.btn-primary:hover,
.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 99, 255, 0.3);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 2px dashed var(--border-color);
}

.empty .icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

/* =============================================
   GRID
   ============================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

/* =============================================
   CARD
   ============================================= */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.foto-wrap {
    position: relative;
    overflow: hidden;
    height: 220px;
    background: var(--bg-primary);
}

.foto-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.card:hover .foto-wrap img {
    transform: scale(1.05);
}

.meta {
    padding: 14px 18px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nama {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
    line-height: 32px;
}

.tanggal-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 4px 12px;
    border-radius: 20px;
}

.kesan {
    padding: 0 18px 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.hapus-link {
    color: var(--danger);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 8px;
    transition: var(--transition);
    background: rgba(255, 23, 68, 0.1);
}

.hapus-link:hover {
    background: var(--danger);
    color: white;
}

/* =============================================
   TOAST NOTIFICATION
   ============================================= */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease forwards;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =============================================
   FOOTER
   ============================================= */
footer {
    text-align: center;
    padding: 40px 20px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    body { padding: 12px; }
    
    .navbar {
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
    }
    
    .navbar nav {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }
    
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card { padding: 16px; }
    .stat-info h3 { font-size: 1.2rem; }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
    
    .toolbar form {
        flex-direction: column;
        min-width: 0;
    }
    
    .toolbar form input[type="text"],
    .toolbar form input[type="date"] {
        width: 100%;
        min-width: 0;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .foto-wrap { height: 180px; }
}

@media (max-width: 480px) {
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* =============================================
   MODAL HAPUS (Premium Style)
   ============================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 40px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Decorative circle di belakang */
.modal-box::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 23, 68, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.modal-icon {
    text-align: center;
    font-size: 56px;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.modal-icon .icon-wrapper {
    display: inline-block;
    background: rgba(255, 23, 68, 0.12);
    width: 88px;
    height: 88px;
    line-height: 88px;
    border-radius: 50%;
    color: var(--danger);
}

.modal-box h3 {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-box .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.modal-box .warning-text {
    text-align: center;
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 23, 68, 0.08);
    padding: 8px 16px;
    border-radius: 10px;
    margin: 12px 0 20px;
    display: inline-block;
    width: 100%;
}

/* Admin Key Input */
.admin-key-group {
    margin-bottom: 20px;
}

.admin-key-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.admin-key-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.admin-key-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.15);
}

.admin-key-group .key-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.modal-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 14px 20px;
    font-weight: 700;
    border-radius: 14px;
    font-size: 0.95rem;
}

.modal-actions .btn-cancel {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.modal-actions .btn-cancel:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.modal-actions .btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

.modal-actions .btn-danger:hover {
    background: #d50000;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 23, 68, 0.35);
}

.modal-actions .btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* =============================================
   RESPONSIVE MODAL
   ============================================= */
@media (max-width: 480px) {
    .modal-box {
        padding: 28px 20px;
    }
    
    .modal-icon .icon-wrapper {
        width: 64px;
        height: 64px;
        line-height: 64px;
        font-size: 28px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        padding: 12px;
    }
}