:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --bg-color: #f3f4f6;
    --danger-color: #ef4444;
    --success-color: #10b981;
    
    --preview-bg-color: #ffffff;
    --preview-text-color: #1f2937;
    --preview-accent-color: #2563eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: #333; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Navigation */
nav { background-color: white; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 1rem; display: flex; justify-content: space-between; align-items: center; z-index: 100; flex-shrink: 0; }
.brand { font-size: 1.2rem; font-weight: bold; color: var(--primary-color); display: flex; align-items: center; gap: 10px; }
.nav-links { display: flex; gap: 5px; }
.nav-links button { background: none; border: none; padding: 0.5rem 1rem; cursor: pointer; font-size: 0.9rem; color: #666; transition: 0.3s; border-radius: 6px; white-space: nowrap; }
.nav-links button:hover, .nav-links button.active { background-color: #eff6ff; color: var(--primary-color); font-weight: bold; }
.nav-links button.btn-logout { color: var(--danger-color); margin-left: 10px; }

/* Main Container */
main { flex: 1; padding: 1rem; overflow-y: auto; max-width: 1200px; margin: 0 auto; width: 100%; position: relative; }

/* Sections */
section { display: none; animation: fadeIn 0.3s ease-in-out; }
section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* UI Components */
.btn { padding: 0.6rem 1.2rem; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: var(--secondary-color); }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-success { background-color: var(--success-color); color: white; }
.btn-outline { border: 1px solid #ccc; background: white; color: #333; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }

.input-group { margin-bottom: 1rem; }
.input-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.85rem; }
.input-group input, .input-group select, .input-group textarea { width: 100%; padding: 0.7rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.95rem; }
.input-group input:focus { outline: none; border-color: var(--primary-color); }

/* Page: Search */
.search-container { text-align: center; margin-top: 2rem; }
.search-box { width: 100%; max-width: 700px; margin: 0 auto; position: relative; }
.search-box input { width: 100%; padding: 1.2rem 1.5rem 1.2rem 3rem; font-size: 1.1rem; border-radius: 50px; border: 2px solid #e5e7eb; box-shadow: 0 4px 6px rgba(0,0,0,0.05); outline: none; transition: 0.3s; }
.search-box input:focus { border-color: var(--primary-color); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.search-box i { position: absolute; left: 1.5rem; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: #9ca3af; }
.search-results { margin-top: 2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.user-card { background: white; padding: 1rem; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); cursor: pointer; transition: 0.2s; border-left: 5px solid transparent; display: flex; gap: 1rem; align-items: center; }
.user-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px rgba(0,0,0,0.1); border-left-color: var(--primary-color); }
.user-avatar { width: 50px; height: 50px; background: #e0e7ff; color: var(--primary-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: bold; flex-shrink: 0; }
.status-dot { height: 10px; width: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* Page: Preview Card */
.preview-wrapper { max-width: 450px; margin: 0 auto; perspective: 1000px; }
.id-card {
    background-color: var(--preview-bg-color); color: var(--preview-text-color);
    border-radius: 16px; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: flex; flex-direction: column; position: relative; border: 1px solid #eee;
}
.id-card-header { background-color: var(--preview-accent-color); color: white; padding: 1.5rem 2rem; text-align: center; }
.id-card-logo { max-height: 50px; object-fit: contain; background: white; padding: 5px; border-radius: 4px; margin-bottom: 0.5rem; display: none; }
.id-card h2.event-name { font-size: 1.2rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.id-card-body { padding: 1.5rem; flex: 1; }
.profile-row { display: flex; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 1rem; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(0,0,0,0.1); background: #ddd; }
.profile-details { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.profile-name { font-size: 1.3rem; font-weight: 700; line-height: 1.2; color: var(--preview-text-color); }
.profile-nik { font-size: 0.9rem; color: #666; font-family: monospace; margin-top: 4px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; font-size: 0.85rem; margin-bottom: 1.5rem; }
.info-item label { display: block; font-size: 0.75rem; color: #888; text-transform: uppercase; margin-bottom: 2px; }
.info-item span { font-weight: 600; }
.room-badge { background: rgba(0,0,0,0.05); padding: 0.8rem; border-radius: 8px; text-align: center; margin-bottom: 1.5rem; border: 1px dashed rgba(0,0,0,0.2); }
.room-number { font-size: 1.5rem; font-weight: 800; color: var(--preview-accent-color); display: block; }
.room-size { font-size: 1.25rem; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; }

.activity-log-container { margin-top: 1rem; background: rgba(0,0,0,0.03); padding: 0.8rem; border-radius: 8px; max-height: 120px; overflow-y: auto; }
.log-title { font-size: 0.75rem; font-weight: bold; color: #888; margin-bottom: 0.5rem; text-transform: uppercase; }
.log-item { font-size: 0.8rem; display: flex; justify-content: space-between; margin-bottom: 4px; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 2px; }

.preview-actions { margin-top: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.preview-actions button { width: 100%; justify-content: center; }

/* Page: Database */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.header-actions { display: flex; gap: 0.5rem; }
.table-container { overflow-x: auto; background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th, td { padding: 0.8rem; text-align: left; border-bottom: 1px solid #eee; font-size: 0.9rem; }
th { background-color: #f9fafb; font-weight: 600; color: #555; white-space: nowrap; }
tr:hover { background-color: #f8fafc; }

/* Page: Settings */
.settings-card { background: white; padding: 1.5rem; border-radius: 12px; height: fit-content; }
.preview-container { display: flex; align-items: center; justify-content: center; background: #e5e7eb; border-radius: 12px; padding: 2rem; }
.color-input { height: 40px; padding: 2px; width: 100%; }

/* Modals */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal.open { display: flex; }
.modal-content { background: white; padding: 2rem; border-radius: 12px; width: 100%; max-width: 500px; animation: slideDown 0.3s; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.modal-actions { margin-top: 1.5rem; display: flex; justify-content: flex-end; gap: 10px; }

/* Activity Grid */
.activity-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 1rem; }
.activity-option { padding: 10px; background: #f3f4f6; border: 1px solid #ddd; border-radius: 6px; cursor: pointer; text-align: center; transition: 0.2s; }
.activity-option:hover { background: #e5e7eb; border-color: #999; }

/* Login Overlay */
.login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #f3f4f6; z-index: 2000; display: flex; justify-content: center; align-items: center; }
.login-overlay.hidden { display: none; }
.login-box { background: white; padding: 2.5rem; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }
.brand-login { font-size: 1.5rem; color: var(--primary-color); margin-bottom: 2rem; font-weight: bold; display: flex; justify-content: center; align-items: center; gap: 10px; }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; padding: 1rem 1.5rem; background: #333; color: white; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); transform: translateY(100px); transition: 0.3s; z-index: 3000; font-weight: 500; }
.toast.show { transform: translateY(0); }
.toast.success { background: var(--success-color); }
.toast.error { background: var(--danger-color); }

/* Responsive */
@media (max-width: 768px) {
    nav { padding: 0.5rem 1rem; flex-direction: column; gap: 0.5rem; }
    .brand { font-size: 1rem; }
    .nav-links { width: 100%; overflow-x: auto; padding-bottom: 5px; -webkit-overflow-scrolling: touch; }
    .info-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .header-actions { width: 100%; overflow-x: auto; }
}