:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --panel-bg: rgba(255, 255, 255, 0.05);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.glass-layer {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
}

/* Layout */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
}

.hidden {
    display: none !important;
}

/* Login */
#login-screen {
    justify-content: center;
    align-items: center;
}

.login-box {
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo {
    margin-bottom: 30px;
}
.logo i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

.input-group i, .input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.input-group input, .input-group select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}
.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.btn-primary, .btn-success, .btn-danger {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.btn-primary { background: var(--primary-color); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }

/* Dashboard Layout */
.sidebar {
    width: 250px;
    height: calc(100vh - 40px);
    margin: 20px;
    display: flex;
    flex-direction: column;
}

.logo-small {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 800;
    border-bottom: 1px solid var(--panel-border);
}

.nav-menu {
    flex: 1;
    padding: 20px 0;
}

.nav-btn {
    width: 100%;
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-align: left;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-btn:hover, .nav-btn.active {
    color: white;
    background: rgba(255,255,255,0.05);
    border-left: 4px solid var(--primary-color);
}

.user-info {
    padding: 20px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.avatar i { font-size: 2rem; color: var(--text-muted); }
.details { flex: 1; display: flex; flex-direction: column; }
#current-user-name { font-weight: 600; }
.badge { font-size: 0.75rem; background: var(--primary-color); padding: 2px 6px; border-radius: 4px; display: inline-block; margin-top:4px;}
#logout-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; }
#logout-btn:hover { color: var(--danger); }

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 20px 20px 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.glass-btn {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.red { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.status-dot.green { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* Views */
.view {
    flex: 1;
    overflow-y: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.stat-card i {
    font-size: 2.5rem;
    padding: 15px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
}
.icon-blue { color: #60a5fa; }
.icon-green { color: #34d399; }
.icon-orange { color: #fbbf24; }
.stat-card h3 { color: var(--text-muted); font-size: 0.9rem; font-weight: 400; margin-bottom: 5px; }
.stat-card p { font-size: 1.8rem; font-weight: 800; }

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-title h2 { font-size: 1.4rem; }
.section-title .btn-primary { width: auto; padding: 10px 20px; }

/* Tables */
.table-container {
    padding: 20px;
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--panel-border);
}
.data-table th { color: var(--text-muted); font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }

/* Box View */
.box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
    margin-bottom: 30px;
}
.box-info p { color: var(--text-muted); margin-top: 10px; font-size: 1.1rem; }
.box-actions { display: flex; gap: 15px; }
.box-actions button { width: auto; padding: 12px 24px; }

/* Modals */
.modal {
    position: fixed;
    z-index: 1000;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: 0.3s;
}
.modal.active { opacity: 1; pointer-events: all; }
.modal-content {
    width: 100%; max-width: 500px; padding: 30px; position: relative;
    transform: scale(0.95); transition: 0.3s;
}
.modal.active .modal-content { transform: scale(1); }
.modal-content h2 { margin-bottom: 20px; border-bottom: 1px solid var(--panel-border); padding-bottom: 15px; }
.close { position: absolute; top: 20px; right: 20px; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.close:hover { color: white; }

/* Animations */
.fade-in { animation: fadeIn 0.5s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}
.room-card {
    padding: 20px; text-align: center; cursor: pointer; transition: 0.3s;
}
.room-card:hover { transform: translateY(-5px); border-color: var(--primary-color); }
.room-card.ocupada { border-left: 4px solid var(--danger); }
.room-card.disponible { border-left: 4px solid var(--success); }
.room-card.limpieza { border-left: 4px solid var(--warning); background-color: rgba(245, 158, 11, 0.05); }
.room-card.limpieza i { color: var(--warning); zoom:1.5; margin-bottom:10px; display:block; }
.room-card h3 { font-size: 1.5rem; margin-bottom: 5px; }
.room-card p { color: var(--text-muted); font-size: 0.9rem; }

.flex-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--panel-border);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        width: 260px;
        height: 100vh;
        margin: 0;
        z-index: 999;
        transition: left 0.3s ease;
        border-radius: 0;
        background: rgba(15, 23, 42, 0.98); /* Solid dark so it floats nicely */
        backdrop-filter: blur(16px);
    }

    .sidebar.active { left: 0; }
    
    .menu-toggle { display: block; }
    
    .main-content { padding: 15px; width: 100vw; }

    .topbar { flex-direction: column; align-items: flex-start; gap: 15px; }

    .stats-grid { grid-template-columns: 1fr; }

    .box-header, .section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-title h2 { font-size: 1.2rem; }
    .section-title button { width: 100%; }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .flex-row { flex-direction: column; gap: 0; }
}

/* Calendar Grid */
.calendar-grid { display: flex; flex-direction: column; min-width: 800px; }
.calendar-row { display: flex; border-bottom: 1px solid var(--panel-border); }
.calendar-row:last-child { border-bottom: none; }
.calendar-header { background: rgba(0,0,0,0.2); font-weight: 600; }
.calendar-cell { flex: 1; min-width: 60px; padding: 10px 5px; text-align: center; border-right: 1px solid var(--panel-border); font-size: 0.85rem; position: relative; }
.calendar-cell.room-name { flex: 0 0 100px; font-weight: bold; text-align: left; padding-left: 10px; }
.calendar-cell:last-child { border-right: none; }
.calendar-event {
    position: absolute; top: 5px; bottom: 5px; left: 2px;
    background: var(--primary-color); color: white; font-size: 0.75rem; padding: 4px;
    border-radius: 6px; opacity: 0.95; z-index: 10;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); font-weight: bold;
}
.calendar-event.status-check_in { background: var(--danger); }
.calendar-event.status-reservada { background: var(--primary-color); }
