/* ===========================
   CSS VARIABLES & RESET (SOFT CLOUD THEME)
   =========================== */
:root {
    --bg-start:      #eef2ff;  
    --bg-end:        #e2e8f0;  
    --primary:       #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.12);
    --accent:        #7c3aed;
    --success:       #059669;
    --danger:        #dc2626;
    --warning:       #d97706;
    --text-main:     #1e293b;  
    --text-muted:    #475569;
    --glass-bg:      rgba(255, 255, 255, 0.65); 
    --glass-border:  rgba(255, 255, 255, 0.8);
    --card-shadow:   0 10px 30px rgba(0, 0, 0, 0.04);
    --input-bg:      rgba(255, 255, 255, 0.85);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
}

.app-wrapper { max-width: 1260px; margin: 0 auto; }

/* HEADER */
.app-header {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px 30px; margin-bottom: 24px;
    box-shadow: var(--card-shadow);
}

.header-left { display: flex; align-items: center; gap: 16px; }
.hotel-logo svg { width: 48px; height: 48px; filter: drop-shadow(0 4px 12px rgba(79,70,229,0.25)); }
.hotel-title {
    font-size: 1.7rem; font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.1;
}
.hotel-subtitle { font-size: 0.8rem; color: var(--text-muted); letter-spacing: 0.5px; margin-top: 2px; }

.header-stats { display: flex; align-items: center; gap: 12px; }
.stat-chip { background: white; border: 1px solid rgba(79,70,229,0.15); border-radius: 12px; padding: 10px 20px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.stat-num { display: block; font-size: 1.6rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.5px; display: block; margin-top: 3px; }

/* TABS */
.tab-nav { display: flex; gap: 10px; margin-bottom: 20px; }
.tab-btn {
    flex: 1; padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--glass-border);
    background: var(--glass-bg); color: var(--text-muted); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all 0.25s ease; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tab-btn:hover { background: white; color: var(--primary); border-color: rgba(79,70,229,0.2); }
.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent)); border-color: transparent;
    color: white; box-shadow: 0 4px 20px rgba(79,70,229,0.25);
}

.tab-content { animation: fadeIn 0.3s ease; }
.tab-content.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* CARDS */
.glass-card {
    background: var(--glass-bg); backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: 30px; box-shadow: var(--card-shadow); margin-bottom: 20px;
}
.card-heading h2 { font-size: 1.3rem; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.card-heading p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 24px; }

/* FORMS */
.form-section-title {
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--primary); margin: 24px 0 14px; padding-bottom: 8px; border-bottom: 1px solid rgba(79,70,229,0.15);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } .span-2 { grid-column: span 1; } }
.form-group { display: flex; flex-direction: column; }
.span-2 { grid-column: span 2; }
label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.req { color: #dc2626; }

input, select, textarea {
    width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
    background: var(--input-bg); border: 1px solid #cbd5e1;
    color: var(--text-main); font-family: 'Inter', sans-serif; font-size: 0.9rem; outline: none; transition: all 0.25s ease;
}
input::placeholder, select::placeholder { color: #94a3b8; }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); background: white;
}
select option { background: white; color: var(--text-main); }

/* BUTTONS */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent)); color: white;
    border: none; border-radius: var(--radius-sm); padding: 12px 24px; font-size: 0.92rem;
    font-weight: 600; cursor: pointer; transition: all 0.25s ease; box-shadow: 0 4px 15px rgba(79,70,229,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79,70,229,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-lg { width: 100%; padding: 15px; font-size: 1rem; margin-top: 28px; border-radius: var(--radius-md); }
.btn-danger-sm {
    padding: 8px 16px; border-radius: var(--radius-sm); background: rgba(220,38,38,0.1);
    border: 1px solid rgba(220,38,38,0.2); color: #dc2626; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-danger-sm:hover { background: rgba(220,38,38,0.15); }

/* TABLE */
.records-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.records-header h2 { font-size: 1.3rem; color: var(--text-main); }
.records-actions { display: flex; align-items: center; gap: 10px; }
.search-input { width: 280px; padding: 9px 14px; font-size: 0.85rem; }
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); background: white; border: 1px solid #e2e8f0; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead tr { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
th { padding: 13px 14px; text-align: left; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.status-in { background: rgba(5,150,105,0.1); color: #059669; border: 1px solid rgba(5,150,105,0.2); }
.status-res { background: rgba(217, 119, 6, 0.1); color: #d97706; border: 1px solid rgba(217, 119, 6, 0.2); }
.status-out { background: #f1f5f9; color: var(--text-muted); border: 1px solid #e2e8f0; }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.act-btn { padding: 5px 11px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; border: none; cursor: pointer; transition: all 0.2s; }
.act-checkout { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.act-checkout:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(79,70,229,0.3); }
.act-bill { background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.2); color: var(--accent); }
.act-bill:hover { background: rgba(124,58,237,0.15); }
.act-delete { background: rgba(220,38,38,0.1); border: 1px solid rgba(220,38,38,0.2); color: #dc2626; }
.act-delete:hover { background: rgba(220,38,38,0.15); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; }

/* MODAL & INVOICE */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; overflow-y: auto; }
.modal-container { width: 100%; max-width: 720px; max-height: 90vh; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.25); animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.invoice-paper { flex: 1; overflow-y: auto; background: white; color: #0f172a; padding: 36px 40px; font-family: 'Inter', sans-serif; }

.modal-action-bar { display: flex; align-items: center; justify-content: space-between; background: #f8fafc; border-top: 1px solid #e2e8f0; padding: 14px 24px; gap: 12px; flex-shrink: 0; }
.modal-action-label { font-size: 1rem; font-weight: 700; color: var(--primary); letter-spacing: 0.3px; white-space: nowrap; }
.modal-action-btns { display: flex; gap: 12px; }
.modal-btn-print { display: flex; align-items: center; gap: 8px; padding: 12px 28px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; border: none; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.22s ease; box-shadow: 0 4px 15px rgba(79,70,229,0.3); }
.modal-btn-print:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79,70,229,0.4); }
.modal-btn-close { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 10px; background: white; border: 2px solid #e2e8f0; color: var(--text-muted); font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.22s ease; }
.modal-btn-close:hover { background: #f1f5f9; border-color: #cbd5e1; color: var(--text-main); transform: translateY(-2px); }

/* INVOICE DETAILS */
.invoice-letterhead { text-align: center; border-bottom: 3px double #4f46e5; padding-bottom: 16px; margin-bottom: 20px; }
.inv-hotel-name { font-size: 1.8rem; font-weight: 800; color: #4338ca; letter-spacing: 2px; margin-bottom: 4px; }
.inv-hotel-addr { font-size: 0.8rem; color: #64748b; margin-bottom: 12px; }
.inv-title-bar { background: #4338ca; color: white; padding: 6px 20px; border-radius: 20px; display: inline-block; font-size: 0.82rem; font-weight: 700; letter-spacing: 2px; }
.inv-meta { display: flex; justify-content: space-between; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 18px; margin-bottom: 18px; font-size: 0.83rem; color: #475569; gap: 10px; flex-wrap: wrap; }
.inv-meta-item strong { color: #1e293b; display: block; font-size: 0.75rem; }
.inv-guest-info { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; background: #f1f5f9; border-left: 4px solid #4f46e5; padding: 14px 18px; border-radius: 6px; margin-bottom: 20px; font-size: 0.83rem; color: #334155; }
.inv-guest-row { display: flex; flex-direction: column; }
.inv-guest-row strong { font-size: 0.72rem; color: #64748b; font-weight: 600; text-transform: uppercase; }
.inv-guest-row span { color: #1e293b; font-weight: 500; }
.inv-items-header { display: grid; grid-template-columns: 3fr 1fr 1.5fr 1.5fr; gap: 12px; background: #4338ca; color: white; padding: 9px 14px; border-radius: 6px 6px 0 0; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.inv-item-row { display: grid; grid-template-columns: 3fr 1fr 1.5fr 1.5fr; gap: 12px; padding: 9px 14px; border-bottom: 1px solid #e2e8f0; font-size: 0.85rem; color: #334155; align-items: center; }
.inv-item-row:nth-child(even) { background: #f8fafc; }
.inv-item-row .del-item { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 1rem; padding: 0 4px; display: inline; vertical-align: middle; }
.add-item-row { display: flex; gap: 8px; padding: 10px 14px; background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 0 0 6px 6px; align-items: center; flex-wrap: wrap; }
.add-item-row input { background: white; border: 1px solid #cbd5e1; color: #1e293b; padding: 7px 10px; font-size: 0.82rem; border-radius: 6px; flex: 1; min-width: 100px; }
.btn-add-item { padding: 7px 14px; background: #4338ca; color: white; border: none; border-radius: 6px; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.2s; }
.inv-totals { margin-top: 16px; border-top: 2px solid #e2e8f0; padding-top: 14px; }
.inv-total-row { display: flex; justify-content: flex-end; gap: 80px; font-size: 0.88rem; color: #334155; margin-bottom: 6px; padding: 0 14px; }
.inv-grand-total-row { display: flex; justify-content: flex-end; gap: 80px; font-size: 1.1rem; font-weight: 800; color: #4338ca; margin-top: 8px; padding: 10px 14px; background: #eef2ff; border-radius: 8px; }
.inv-footer { margin-top: 28px; text-align: center; border-top: 1px solid #e2e8f0; padding-top: 16px; font-size: 0.78rem; color: #64748b; line-height: 1.6; }

/* DIALOG */
.cd-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 99999; }
.cd-box { background: white; border: 1px solid #e2e8f0; border-radius: 18px; padding: 40px 36px; max-width: 420px; width: 90%; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.15); animation: cdPop 0.2s ease; }
@keyframes cdPop { from { transform: scale(0.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cd-icon { font-size: 2.8rem; margin-bottom: 14px; }
.cd-msg { font-size: 1rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 28px; }
.cd-msg strong { color: var(--text-main); }
.cd-btns { display: flex; gap: 14px; justify-content: center; }
.cd-btn-cancel { padding: 11px 30px; border-radius: 9px; background: white; border: 1px solid #cbd5e1; color: #64748b; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.cd-btn-cancel:hover { background: #f1f5f9; color: var(--text-main); }
.cd-btn-ok { padding: 11px 30px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; border: none; font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 14px rgba(79,70,229,0.3); }
.cd-btn-ok:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79,70,229,0.4); }

.hidden { display: none !important; }

/* PRINT MEDIA */
@media print {
    @page { size: A4 portrait; margin: 15mm 15mm 15mm 15mm; }
    body { background: white !important; margin: 0 !important; padding: 0 !important; font-size: 11pt !important; color: #000 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .no-print, .app-wrapper, .modal-controls, .modal-overlay::before { display: none !important; }
    .modal-overlay { position: static !important; background: none !important; backdrop-filter: none !important; display: block !important; padding: 0 !important; overflow: visible !important; }
    .modal-container { width: 100% !important; max-width: 100% !important; box-shadow: none !important; border-radius: 0 !important; animation: none !important; overflow: visible !important; }
    .invoice-paper { width: 100% !important; padding: 0 !important; margin: 0 !important; background: white !important; color: #000 !important; font-size: 11pt !important; line-height: 1.5 !important; page-break-inside: avoid; }
    .invoice-letterhead { border-bottom: 3px double #4338ca !important; padding-bottom: 10pt !important; margin-bottom: 12pt !important; text-align: center; }
    .inv-hotel-name { font-size: 22pt !important; font-weight: 900 !important; color: #4338ca !important; letter-spacing: 3px !important; }
    .inv-hotel-addr { font-size: 9pt !important; color: #555 !important; margin-bottom: 6pt !important; }
    .inv-title-bar { background: #4338ca !important; color: white !important; padding: 4pt 16pt !important; border-radius: 20pt !important; font-size: 9pt !important; font-weight: 700 !important; letter-spacing: 2px !important; display: inline-block !important; }
    .inv-meta { background: #f8fafc !important; border: 1px solid #cbd5e1 !important; border-radius: 6pt !important; padding: 8pt 12pt !important; margin-bottom: 10pt !important; font-size: 9.5pt !important; display: flex !important; justify-content: space-between !important; flex-wrap: wrap !important; gap: 6pt !important; color: #333 !important; }
    .inv-guest-info { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 5pt 16pt !important; background: #f1f5f9 !important; border-left: 4pt solid #4338ca !important; padding: 10pt 14pt !important; border-radius: 4pt !important; margin-bottom: 14pt !important; font-size: 9.5pt !important; color: #222 !important; }
    .inv-items-section { margin-bottom: 14pt !important; }
    .inv-items-header { display: grid !important; grid-template-columns: 3fr 1fr 1.5fr 1.5fr !important; background: #4338ca !important; color: white !important; padding: 7pt 10pt !important; border-radius: 4pt 4pt 0 0 !important; font-size: 8.5pt !important; font-weight: 700 !important; text-transform: uppercase !important; }
    .inv-item-row { display: grid !important; grid-template-columns: 3fr 1fr 1.5fr 1.5fr !important; padding: 7pt 10pt !important; border-bottom: 1pt solid #e2e8f0 !important; font-size: 9.5pt !important; color: #222 !important; page-break-inside: avoid !important; }
    .inv-item-row:nth-child(even) { background: #f8fafc !important; }
    .add-item-row, .btn-add-item, .del-item, .no-print { display: none !important; }
    .inv-totals { margin-top: 10pt !important; border-top: 1.5pt solid #cbd5e1 !important; padding-top: 8pt !important; }
    .inv-total-row { display: flex !important; justify-content: flex-end !important; gap: 60pt !important; font-size: 10pt !important; color: #444 !important; margin-bottom: 4pt !important; padding: 0 10pt !important; }
    .inv-grand-total-row { display: flex !important; justify-content: flex-end !important; gap: 60pt !important; font-size: 13pt !important; font-weight: 800 !important; color: #4338ca !important; margin-top: 6pt !important; padding: 8pt 10pt !important; background: #eef2ff !important; border-radius: 6pt !important; }
    .inv-footer { margin-top: 20pt !important; text-align: center !important; border-top: 1pt solid #cbd5e1 !important; padding-top: 10pt !important; font-size: 8.5pt !important; color: #666 !important; line-height: 1.6 !important; }
    .inv-footer-note { font-style: italic !important; margin-top: 4pt !important; }
}

/* ===========================
   ROOM DASHBOARD
   =========================== */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.room-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.room-number {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.room-status {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 12px;
}

.room-guest-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-weight: 500;
}

.room-available { border-color: rgba(16, 185, 129, 0.4); }
.room-available .room-status { background: rgba(16, 185, 129, 0.1); color: #059669; }

.room-occupied { border-color: rgba(79, 70, 229, 0.4); }
.room-occupied .room-status { background: rgba(79, 70, 229, 0.1); color: var(--primary); }

.room-reserved { border-color: rgba(245, 158, 11, 0.4); }
.room-reserved .room-status { background: rgba(245, 158, 11, 0.1); color: #d97706; }

.room-category {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
    margin-top: 2px;
}

.room-rate {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}