/* ==================== RESET & APPLE-LIKE BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --apple-bg: #F5F5F7;
    --apple-surface: rgba(255, 255, 255, 0.7);
    --apple-text: #1D1D1F;
    --apple-muted: #86868B;
    --apple-blue: #0066CC;
    --apple-blue-hover: #0077ED;
    --apple-border: rgba(0, 0, 0, 0.08);
    --apple-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    --glass-blur: blur(20px);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: var(--apple-bg); 
    color: var(--apple-text); 
    overflow-x: hidden; 
    -webkit-font-smoothing: antialiased;
}

/* ==================== LOGIN PAGE (MODERN) ==================== */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; background: #E8ECEF; }
.login-bg { position: absolute; width: 100%; height: 100%; z-index: 0; }
.blur-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6; animation: float 10s infinite alternate; }
.orb-1 { width: 400px; height: 400px; background: #ff9a9e; top: -10%; left: -10%; }
.orb-2 { width: 500px; height: 500px; background: #a1c4fd; bottom: -20%; right: -10%; animation-delay: -5s; }

@keyframes float { 
    0% { transform: translateY(0) scale(1); } 
    100% { transform: translateY(30px) scale(1.1); } 
}

.login-card { 
    position: relative; z-index: 1; width: 400px; max-width: 90%; 
    padding: 50px 40px; border-radius: 24px; text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    animation: scaleIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-effect {
    background: var(--apple-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.login-logo { font-size: 48px; color: var(--apple-blue); margin-bottom: 20px; }
.login-header h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; }
.login-header p { color: var(--apple-muted); font-size: 15px; margin-bottom: 40px; }

.modern-form .form-group { margin-bottom: 20px; }
.modern-form input { 
    width: 100%; padding: 16px 20px; font-size: 15px; background: rgba(255,255,255,0.8);
    border: 1px solid var(--apple-border); border-radius: 14px; transition: var(--transition);
}
.modern-form input:focus { outline: none; border-color: var(--apple-blue); box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15); background: #fff; }

.btn-apple-primary { 
    width: 100%; padding: 16px; background: var(--apple-blue); color: white; border: none; 
    border-radius: 14px; font-size: 16px; font-weight: 600; cursor: pointer; transition: var(--transition); margin-top: 10px;
}
.btn-apple-primary:hover { background: var(--apple-blue-hover); transform: scale(1.02); }

.login-footer { margin-top: 30px; font-size: 14px; }
.login-footer a { color: var(--apple-blue); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.login-footer a:hover { text-decoration: underline; }

/* ==================== TOP NAVIGATION (NEW LAYOUT) ==================== */
.apple-topnav {
    position: fixed; top: 0; left: 0; width: 100%; height: 60px; z-index: 1000;
    border-bottom: 1px solid var(--apple-border);
}
.topnav-container {
    max-width: 1200px; margin: 0 auto; height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.nav-brand { font-size: 18px; font-weight: 700; color: var(--apple-text); display: flex; align-items: center; gap: 8px; }
.nav-brand i { color: var(--apple-blue); }

.nav-menu ul { display: flex; gap: 25px; list-style: none; }
.nav-menu a { 
    text-decoration: none; color: var(--apple-text); font-size: 13px; font-weight: 500; 
    opacity: 0.8; transition: var(--transition); display: flex; align-items: center; gap: 6px;
}
.nav-menu a i { font-size: 14px; }
.nav-menu a:hover, .nav-menu a.active { opacity: 1; color: var(--apple-text); font-weight: 600; }

.nav-profile { display: flex; align-items: center; gap: 15px; }
.user-pill { font-size: 13px; font-weight: 600; background: rgba(0,0,0,0.05); padding: 6px 12px; border-radius: 20px; }
.btn-icon { background: none; border: none; font-size: 18px; color: var(--apple-text); cursor: pointer; opacity: 0.7; transition: var(--transition); }
.btn-icon:hover { opacity: 1; color: #ff3b30; }
.mobile-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }

/* ==================== MAIN CONTENT & HERO ==================== */
.main-content { padding-top: 60px; min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
.page-hero { width: 100%; max-width: 1200px; padding: 60px 20px 40px; text-align: left; }
.hero-title { font-size: 48px; font-weight: 700; letter-spacing: -1px; margin-bottom: 10px; animation: slideUp 0.8s ease forwards; }
.current-date { font-size: 16px; color: var(--apple-muted); font-weight: 500; animation: slideUp 1s ease forwards; opacity: 0; }

.content-area { width: 100%; max-width: 1200px; padding: 0 20px 60px; }

/* Menambahkan animasi mulus saat JS mereplace innerHTML */
.content-area > * {
    animation: fadeScale 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==================== UI COMPONENTS DARI JS (Diperbarui gaya Apple) ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card { 
    background: #fff; border-radius: 24px; padding: 30px; box-shadow: var(--apple-shadow);
    display: flex; flex-direction: column; gap: 15px; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.stat-icon { width: 50px; height: 50px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: white; }
.stat-icon.blue { background: var(--apple-blue); }
.stat-icon.green { background: #34C759; }
.stat-icon.orange { background: #FF9500; }
.stat-icon.red { background: #FF3B30; }
.stat-info h3 { font-size: 36px; font-weight: 700; color: var(--apple-text); line-height: 1; margin-bottom: 5px; }
.stat-info p { font-size: 14px; color: var(--apple-muted); font-weight: 500; }

.table-container { 
    background: #fff; border-radius: 24px; box-shadow: var(--apple-shadow); 
    overflow: hidden; margin-bottom: 30px; padding: 20px;
}
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding: 0 10px; flex-wrap: wrap; gap:15px; }
.table-header h3 { font-size: 20px; font-weight: 600; }

/* Table Styling Clean */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { padding: 15px 20px; text-align: left; font-size: 13px; color: var(--apple-muted); font-weight: 600; border-bottom: 1px solid var(--apple-border); }
td { padding: 18px 20px; font-size: 14px; color: var(--apple-text); border-bottom: 1px solid var(--apple-border); }
/* Efek Transisi Baris Tabel */
tbody tr td {
    transition: all 0.25s ease;
}

/* 1. Efek Hover untuk Tabel Biasa (Manajemen Pengguna, Ruangan, Peminjaman) */
tbody tr:not(.jadwal-row):hover td { 
    background: #EBF3FC !important; 
    color: #004499; 
}

/* 2. KHUSUS TABEL JADWAL RUANGAN: Hover hanya boleh mengubah Kolom Pertama & Sel Kosong */
tr.jadwal-row:hover td:first-child,
tr.jadwal-row:hover td[style*="#f8f9fa"] {
    background: #EBF3FC !important;
    color: #004499;
}

/* Membuat sudut melengkung halus di ujung kiri baris saat di-hover */
tbody tr:hover td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

/* Membuat sudut melengkung halus di ujung kanan baris saat di-hover */
tbody tr:hover td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}
tbody tr:last-child td { border-bottom: none; }

/* Buttons */
.btn { 
    padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: 600; 
    cursor: pointer; transition: var(--transition); border: none; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--apple-blue); color: #fff; }
.btn-primary:hover { background: var(--apple-blue-hover); transform: scale(1.03); }
.btn-success { background: #34C759; color: #fff; }
.btn-danger { background: #FF3B30; color: #fff; }
.btn-info { background: #5AC8FA; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 12px; }

/* Inputs in JS UI */
input[type="text"], input[type="date"], input[type="tel"], input[type="number"], select, textarea {
    padding: 12px 16px; border: 1px solid var(--apple-border); border-radius: 12px;
    font-size: 14px; background: #F5F5F7; transition: var(--transition); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; background: #fff; border-color: var(--apple-blue); box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }

/* Badges */
.badge { padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 600; display: inline-block; }
.badge-success { background: #E5F9EB; color: #248A3D; }
.badge-warning { background: #FFF4E5; color: #B26800; }
.badge-danger { background: #FFEBEA; color: #C92A23; }
.badge-secondary { background: #F0F0F2; color: #666; }

/* Modals */
.modal-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.4); z-index: 2000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-content { width: 500px; max-width: 90%; border-radius: 24px; overflow: hidden; animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-header { padding: 25px 30px 15px; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 22px; font-weight: 600; }
.modal-close { background: #E8ECEF; border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.modal-close:hover { background: #D1D5D9; }
.modal-body { padding: 0 30px 30px; max-height: 70vh; overflow-y: auto; }

/* Animations */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeScale { 0% { opacity: 0; transform: scale(0.98) translateY(10px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes scaleIn { 0% { opacity: 0; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } }

/* Responsiveness */
@media (max-width: 768px) {
    .nav-menu { display: none; /* In a real app, bind this to mobile toggle logic */ }
    .mobile-toggle { display: block; }
    .hero-title { font-size: 32px; }
    .page-hero { padding-top: 40px; }
}

/* ==================== FORM PINJAM RUANGAN MODERN (RESPONSIVE) ==================== */
.booking-modern-wrapper {
    animation: fadeScale 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.booking-modern-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* Kolom kiri lebih luas */
    gap: 40px;
    align-items: start;
}

.section-header { margin-bottom: 20px; }
.section-header h3 { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.5px; }
.section-header p { color: var(--apple-muted); font-size: 14px; margin: 0; }

/* Grid Kartu Ruangan (Desktop) */
.room-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.apple-room-card {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    cursor: pointer;
    transition: var(--transition);
}
.apple-room-card:hover { transform: translateY(-4px); box-shadow: 0 12px 25px rgba(0,0,0,0.08); }
.apple-room-card.active { border-color: var(--apple-blue); box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15); }

.room-img-placeholder {
    height: 110px;
    background: linear-gradient(135deg, #e8ecef, #f5f5f7);
    display: flex; align-items: center; justify-content: center;
    font-size: 35px; color: #c1c5c8;
    transition: var(--transition);
}
.apple-room-card.active .room-img-placeholder { 
    background: linear-gradient(135deg, #e0f0ff, #cce4ff); 
    color: var(--apple-blue); 
}

.room-card-body { padding: 16px; }
.room-card-body h4 { font-size: 16px; margin-bottom: 4px; font-weight: 600; color: var(--apple-text); }
.room-card-body p { font-size: 12px; color: var(--apple-muted); margin: 0; }

/* Detail Pemesan Box */
.modern-detail-box {
    background: #fff;
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--apple-shadow);
}

.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--apple-muted); }
.input-with-icon input { padding-left: 48px !important; }

/* Sticky Right Column (Schedule) */
.schedule-sticky-box {
    position: sticky;
    top: 90px; /* Jarak dari Top Navigation Bar */
    padding: 30px;
    border-radius: 24px;
    background: var(--apple-surface);
}

.large-modern-input {
    font-size: 16px !important;
    padding: 16px 20px !important;
    font-weight: 600;
    color: var(--apple-text);
    background: #fff !important;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.time-selector-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }

.booking-summary {
    background: rgba(0,0,0,0.03);
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.05);
}
.summary-label { font-size: 11px; color: var(--apple-muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; margin-bottom: 6px;}


/* ==================== MEDIA QUERIES (WORST CASE SCENARIOS) ==================== */

/* Tablet & Laptop Layar Kecil (Stack Layout Vertikal) */
@media (max-width: 1024px) {
    .booking-modern-grid { grid-template-columns: 1fr; gap: 40px; }
    .schedule-sticky-box { position: static; /* Matikan sticky agar tidak memotong layar */ }
}

/* HP Biasa (Korsel Scroll Horizontal untuk Ruangan) */
@media (max-width: 768px) {
    .modern-detail-box, .schedule-sticky-box { padding: 20px; }
    
    /* Ubah list grid menjadi Scroll Horizontal di HP (Seperti App Store) */
    .room-cards-container {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 15px;
        margin: 0 -20px; /* Buat konten tembus ujung layar HP */
        padding-left: 20px;
        padding-right: 20px;
        -webkit-overflow-scrolling: touch;
    }
    .room-cards-container::-webkit-scrollbar { display: none; /* Sembunyikan scrollbar di HP */ }
    
    .apple-room-card {
        min-width: 200px; /* Ukuran pas untuk layar HP */
        max-width: 220px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
    
    .time-selector-row { grid-template-columns: 1fr; /* Jam mulai & selesai atas bawah */ }
}

/* ==================== FILTER RUANGAN MODERN ==================== */
.room-filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    background: #fff;
    padding: 15px;
    border-radius: 20px;
    box-shadow: var(--apple-shadow);
}

.modern-select {
    padding: 12px 16px;
    border: 1px solid var(--apple-border);
    border-radius: 12px;
    background: #F5F5F7;
    font-size: 14px;
    color: var(--apple-text);
    outline: none;
    transition: var(--transition);
    cursor: pointer;
    min-width: 150px;
}

.modern-select:focus {
    background: #fff;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

/* Responsif untuk Filter di HP */
@media (max-width: 768px) {
    .room-filter-bar {
        flex-direction: column;
        gap: 10px;
    }
}

/* ==================== FORM LAYOUT & SPACING FIX ==================== */
.form-group {
    margin-bottom: 24px; /* Memberikan ruang napas antar input */
    width: 100%;
}

.form-group label {
    display: block; /* Memaksa label berada di atas input */
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--apple-text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px; /* Jarak antar kolom kiri dan kanan */
    width: 100%;
}

/* Pastikan semua input konsisten memenuhi ruangannya */
.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
}

/* Responsif: Tumpuk kolom ke bawah saat dibuka di HP/Tablet */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0; /* Gap dinolkan karena margin-bottom dari form-group sudah bekerja */
    }
}

/* ==================== PREMIUM FEATURE ICONS ==================== */
/* Mengubah ikon menu atas menjadi bergaya Apple SF Symbols */
.nav-menu a i {
    background: rgba(0, 102, 204, 0.08); /* Latar belakang biru transparan */
    color: var(--apple-blue);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px; /* Sudut melengkung */
    transition: var(--transition);
}

.nav-menu a:hover i, .nav-menu a.active i {
    background: var(--apple-blue);
    color: white;
    transform: scale(1.1); /* Sedikit membesar saat disorot */
}

/* Mempercantik ikon di dalam Stat Card (Dashboard) */
.stat-icon {
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 18px !important; /* Membuat sudut ikon metrik lebih melengkung */
    background-image: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
}

/* ==================== QUICK ACTIONS (APPLE WIDGET STYLE) ==================== */
.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.action-card {
    background: #fff;
    border: 1px solid var(--apple-border);
    border-radius: 20px;
    padding: 24px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    border-color: rgba(0, 102, 204, 0.2);
}

.action-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px; /* Squircle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: var(--transition);
}

.action-card:hover .action-icon {
    transform: scale(1.1) rotate(5deg); /* Efek interaktif saat disorot */
}

.action-card span {
    font-size: 14px;
    font-weight: 600;
    color: var(--apple-text);
    text-align: center;
}