@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    
    --shift-1-bg: #e0e7ff;
    --shift-1-color: #4338ca;
    --shift-2-bg: #ccfbf1;
    --shift-2-color: #115e59;
    --shift-3-bg: #fef3c7;
    --shift-3-color: #92400e;
    --shift-4-bg: #fee2e2;
    --shift-4-color: #991b1b;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition: all 0.25s ease;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    padding: 0.5rem; /* Menor padding para móviles */
}

@media (min-width: 640px) {
    body {
        padding: 1.5rem 1rem;
    }
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header - Responsive */
header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

@media (min-width: 640px) {
    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1.25rem;
    }
}

.logo-section h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.025em;
    text-align: center;
}

@media (min-width: 640px) {
    .logo-section h1 {
        text-align: left;
    }
}

.user-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .user-nav {
        justify-content: flex-end;
    }
}

.lang-selector {
    display: flex;
    background: #f1f5f9;
    padding: 0.2rem;
    border-radius: var(--radius-sm);
}

.lang-btn {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    transition: var(--transition);
}

.lang-btn.active {
    color: var(--primary);
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.btn-danger {
    background: #fee2e2;
    color: #ef4444;
}

.btn-danger:hover {
    background: #ef4444;
    color: #ffffff;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .card {
        padding: 1.5rem;
    }
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 0.5rem;
}



.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.dashboard-grid > * {
    min-width: 0;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 3fr 2fr;
    }
}

/* Calendar Component */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: capitalize;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px; /* Reducido para pantallas ultra-pequeñas */
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .calendar-grid {
        gap: 6px;
    }
}

.calendar-day-name {
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    text-transform: uppercase;
}

.calendar-cell {
    aspect-ratio: 1;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 0.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
    cursor: pointer;
    min-height: 40px; /* Reducido para móviles pequeños */
    transition: var(--transition);
}

@media (min-width: 640px) {
    .calendar-cell {
        padding: 0.35rem;
        min-height: 60px;
    }
}

.calendar-cell:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.calendar-cell.other-month {
    background: #f1f5f9;
    color: #cbd5e1;
    cursor: default;
}

.calendar-cell.other-month:hover {
    border-color: var(--card-border);
    background: #f1f5f9;
}

.calendar-cell.today {
    border: 2px solid var(--primary);
    font-weight: 700;
}

.day-number {
    font-size: 0.75rem;
    font-weight: 500;
}

@media (min-width: 640px) {
    .day-number {
        font-size: 0.9rem;
    }
}

/* Indicators in cells */
.cell-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 1px;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

@media (min-width: 640px) {
    .indicator {
        width: 10px;
        height: 10px;
    }
}

.indicator-1 { background-color: var(--shift-1-color); }
.indicator-2 { background-color: var(--shift-2-color); }
.indicator-3 { background-color: var(--shift-3-color); }
.indicator-4 { background-color: var(--shift-4-color); }

/* Legend list */
.legend-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1rem;
}

@media (min-width: 768px) {
    .legend-list {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}

.legend-item .indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Modal Dialog - Fullscreen on Mobile */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 0; /* Sin padding en móvil */
}

@media (min-width: 640px) {
    .modal-backdrop {
        padding: 1rem;
    }
}

.modal-backdrop.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    height: 100%; /* Ocupa todo el alto en móvil */
    max-height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease-out;
}

@media (min-width: 640px) {
    .modal-content {
        border: 1px solid var(--card-border);
        border-radius: var(--radius-lg);
        height: auto;
        max-width: 500px;
        max-height: 90vh;
    }
}

@keyframes modalIn {
    from { transform: scale(0.98); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    font-size: 1.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
}

.modal-body {
    padding: 1.25rem;
    flex: 1; /* Ocupa el espacio restante para permitir scroll interno */
    overflow-y: auto;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.75rem; /* Inputs ligeramente más grandes para facilidad táctil */
    background: #ffffff;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1.25rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem 0; /* Mayor espacio de clic */
}

.checkbox-label input {
    accent-color: var(--primary);
    width: 1.2rem;
    height: 1.2rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-1 { background-color: var(--shift-1-bg); color: var(--shift-1-color); }
.badge-2 { background-color: var(--shift-2-bg); color: var(--shift-2-color); }
.badge-3 { background-color: var(--shift-3-bg); color: var(--shift-3-color); }
.badge-4 { background-color: var(--shift-4-bg); color: var(--shift-4-color); }

/* Tables / Booking List */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.booking-table {
    width: 100%;
    border-collapse: collapse;
}

.booking-table th, .booking-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.85rem;
}

.booking-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

/* Login specific layout */
.login-container {
    max-width: 400px;
    margin: 2rem auto;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.alert-danger {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    color: #92400e;
}

.past-booking {
    opacity: 0.55;
    background-color: #f1f5f9;
}

/* Custom Select Dropdown */
.custom-select-container {
    position: relative;
    user-select: none;
    cursor: pointer;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    font-weight: 500;
    transition: var(--transition);
}

.custom-select-trigger:hover {
    border-color: var(--primary);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 10;
    max-height: 250px;
    overflow-y: auto;
}

.custom-select-container.open .custom-select-options {
    display: block;
}

.custom-select-option {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    transition: var(--transition);
}

.custom-select-option:hover {
    filter: brightness(0.95);
}

.custom-select-option[data-value="1"] { background-color: var(--shift-1-bg); color: var(--shift-1-color); font-weight: 600; }
.custom-select-option[data-value="2"] { background-color: var(--shift-2-bg); color: var(--shift-2-color); font-weight: 600; }
.custom-select-option[data-value="3"] { background-color: var(--shift-3-bg); color: var(--shift-3-color); font-weight: 600; }
.custom-select-option[data-value="4"] { background-color: var(--shift-4-bg); color: var(--shift-4-color); font-weight: 600; }

.custom-select-arrow {
    font-size: 0.8rem;
    transition: var(--transition);
}

.custom-select-container.open .custom-select-arrow {
    transform: rotate(180deg);
}

/* Mobile responsive fixes (Task 2) */
@media (max-width: 640px) {
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0.25rem;
        overflow-x: hidden;
    }
    .card {
        width: 100%;
        max-width: 100%;
        padding: 0.75rem !important;
        margin-bottom: 1rem;
    }
    .calendar-grid {
        width: 100%;
        max-width: 100%;
        gap: 2px;
    }
    .calendar-cell {
        min-width: 0;
        aspect-ratio: 1;
        min-height: auto;
    }
    .calendar-day-name {
        font-size: 0.7rem;
    }
    .booking-table th, .booking-table td {
        padding: 0.4rem 0.25rem !important;
        font-size: 0.75rem !important;
    }
}


