:root {
    /* Prompt: "Modern, fresco, colores cálidos" */
    --primary: #f97316;
    /* Orange 500 */
    --primary-hover: #ea580c;
    /* Orange 600 */
    --primary-light: #ffedd5;
    /* Orange 100 */

    --secondary: #eab308;
    /* Yellow 500 */

    --bg-body: #fdfbf7;
    /* Warm off-white */
    --bg-card: #ffffff;
    --bg-sidebar: #1e1e1e;
    /* Dark sidebar for contrast */

    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-light: #f3f4f6;

    --border: #e5e7eb;
    --radius: 0.75rem;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    --occupied: #ef4444;
    /* Red 500 */
    --mine: #3b82f6;
    /* Blue 500 */
    --available: #22c55e;
    /* Green 500 */
    --disabled: #d1d5db;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layouts */
.app-container {
    display: flex;
    height: 100%;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: transform 0.3s;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-light), white);
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2rem;
}

p {
    color: var(--text-muted);
    line-height: 1.5;
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-hover);
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
}

.btn-danger:hover {
    background: #fecaca;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
}

.input-control:focus {
    border-color: var(--primary);
    ring: 2px solid var(--primary-light);
}

/* Booking Grid */
.booking-grid {
    display: grid;
    grid-template-columns: 100px repeat(auto-fit, minmax(100px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.grid-header {
    background: var(--bg-body);
    padding: 1rem;
    font-weight: 600;
    text-align: center;
}

.grid-cell {
    background: white;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.85rem;
}

.grid-cell:hover:not(.disabled) {
    background: var(--primary-light);
}

.cell-mine {
    background: var(--mine) !important;
    color: white;
}

.cell-taken {
    background: var(--occupied) !important;
    color: white;
    cursor: not-allowed;
}

.cell-disabled {
    background: var(--disabled);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Sidebar */
.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.logo-area img {
    height: 50px;
}

/* UCM Shield */
.logo-area div {
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1.2;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #9ca3af;
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Admin Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-user {
    background: #f3f4f6;
    color: #374151;
}

/* Utilities */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.text-danger {
    color: #dc2626;
}

.mt-4 {
    margin-top: 1rem;
}

.w-full {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Base Menu Toggle (Hidden on Desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
    margin-right: 0.5rem;
}

/* Base Menu Toggle (Hidden on Desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        position: relative;
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100%;
        z-index: 50;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        width: 100%;
        padding: 1rem;
    }

    /* Mobile Header adjustments */
    .main-content h1 {
        font-size: 1.5rem;
    }

    .flex.justify-between.items-center {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .flex.justify-between.items-center>.flex.gap-4 {
        width: 100%;
        justify-content: space-between;
    }

    /* Scrollable Grid Table */
    .booking-grid {
        min-width: 800px;
        /* Force scroll */
    }

    #gridContainerWrapper {
        overflow-x: auto;
        border-radius: var(--radius);
        border: 1px solid var(--border);
    }

    /* Fix border duplication */
    .booking-grid {
        border: none;
        border-radius: 0;
    }

    /* Menu Toggle */
    .menu-toggle {
        display: block !important;
    }

    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }
}