* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
}

.header {
    background: linear-gradient(135deg, #0F75BF 0%, #69DFE3 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-outline:hover {
    background: white;
    color: #667eea;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Estilos para alerta de acceso público */
.public-access-alert {
    background: linear-gradient(135deg, #4475BA 0%, #69DFE3 100%);
    color: white;
    margin: 20px auto 30px auto;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
    max-width: 1400px;
    overflow: hidden;
}

.alert-content {
    padding: 30px;
    text-align: center;
}

.alert-content h3 {
    margin: 0 0 15px 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.alert-content p {
    margin: 0 0 25px 0;
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.5;
}

.alert-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.alert-actions .btn {
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    min-width: 140px;
}

.alert-actions .btn-primary {
    background: white;
    color: #667eea;
    border: 2px solid white;
}

.alert-actions .btn-primary:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.alert-actions .btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.alert-actions .btn-secondary:hover {
    background: white;
    color: #667eea;
    transform: translateY(-2px);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.date-selector input[type="date"] {
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
}

.legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.calendar-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    border: 1px solid #e1e5e9;
}

.calendar-table th,
.calendar-table td {
    border: 1px solid #e1e5e9;
    text-align: center;
    vertical-align: middle;
}

.calendar-table th {
    background: #667eea;
    color: white;
    padding: 15px 8px;
    font-weight: 600;
    border-right: 1px solid #5a6fd8;
    border-bottom: 2px solid #5a6fd8;
}

.calendar-table th:last-child {
    border-right: none;
}

.time-cell {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    width: 80px;
    padding: 15px 8px;
    border-right: 2px solid #667eea;
    border-bottom: 1px solid #e1e5e9;
}

.court-cell {
    height: 50px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
    padding: 5px;
    min-width: 120px;
    border: 2px solid #e1e5e9;
    border-right: 1px solid #e1e5e9;
    border-bottom: 1px solid #e1e5e9;
}

.court-cell:last-child {
    border-right: none;
}

.court-cell:hover {
    transform: scale(1.02);
    z-index: 10;
}

/* Estados de las canchas con colores mejorados */
.disponible {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.court-cell.disponible::after {
    content: 'DISPONIBLE';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: bold;
    text-align: center;
}

.disponible:hover {
    background: #c3e6cb;
    border: 2px solid #1e7e34;
}

.ocupada {
    background: #f8d7da;
    color: #721c24;
    cursor: not-allowed;
    border: 2px solid #dc3545;
}

.ocupada:hover {
    background: #f5c6cb;
}

.torneo {
    background: #fff3cd;
    color: #856404;
    cursor: not-allowed;
    position: relative;
    border: 2px solid #ffc107;
}

.entrenamiento {
    background: #cce5ff;
    color: #004085;
    cursor: not-allowed;
    position: relative;
    border: 2px solid #007bff;
}

/* Estilo modificado para admin - solo color verde sin texto */
.admin {
    background: #28a745;
    border: 2px solid #1e7e34;
    cursor: pointer;
}

.admin:hover {
    background: #218838;
    border: 2px solid #1c7430;
}

.bloqueada {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    position: relative;
    border: 2px solid #495057;
}

.mantenimiento {
    background: #e2e3e5;
    color: #495057;
    cursor: not-allowed;
    position: relative;
    border: 2px solid #6c757d;
}

/* Estado especial con texto centrado */
.state-text {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.recargo-nocturno {
    border: 3px solid #ffc107;
    box-shadow: inset 0 0 0 1px white;
}

.reservation-info {
    font-size: 0.8rem;
    font-weight: 500;
}

.time-separator {
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #69DFE3 100%);
    border: none;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 20px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #69DFE3);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Estilos para el selector de duración */
.duration-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
    font-size: 0.9rem;
    color: #0056b3;
}

/* ESTILOS PARA BUSCADOR DE SOCIOS */
.socio-search-container {
    position: relative;
}

.socio-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.socio-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.socio-result-item:hover {
    background: #f8f9fa;
}

.socio-result-item:last-child {
    border-bottom: none;
}

.socio-result-name {
    font-weight: 600;
    color: #333;
}

.socio-result-email {
    font-size: 0.9rem;
    color: #666;
    margin-top: 2px;
}

.socio-selected {
    background: #d4edda;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 10px 15px;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.socio-selected button {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.socio-selected button:hover {
    background: #c82333;
}

.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

.socio-loading {
    padding: 12px 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.socio-no-results {
    padding: 12px 15px;
    text-align: center;
    color: #999;
}

/* Efectos hover para estados especiales */
.torneo:hover,
.entrenamiento:hover,
.bloqueada:hover,
.mantenimiento:hover {
    transform: none;
    filter: brightness(0.9);
}

/* Animación para cambios de estado */
@keyframes stateChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.state-changing {
    animation: stateChange 0.5s ease-in-out;
}

/* Menú hamburguesa para móvil */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: white;
    z-index: 9999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    background: linear-gradient(135deg, #667eea 0%, #69DFE3 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-content {
    padding: 20px;
}

.mobile-menu-item {
    display: block;
    padding: 15px 0;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
    font-weight: 500;
}

.mobile-menu-item:hover {
    color: #667eea;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}

.mobile-overlay.active {
    display: block;
}

/* Mejorar hover en diferentes dispositivos */
@media (hover: hover) {
    .court-cell:hover {
        transform: scale(1.02);
        z-index: 10;
    }
}

@media (hover: none) {
    .court-cell:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu {
        display: block;
    }

    .user-info {
        display: none;
    }

    .header-content {
        justify-content: space-between;
    }

    .logo h1 {
        font-size: 1.2rem;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 15px;
    }

    .date-selector {
        justify-content: center;
    }

    .legend {
        justify-content: center;
        font-size: 0.85rem;
        gap: 10px;
    }

    .legend-color {
        width: 18px;
        height: 18px;
    }

    .calendar-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
    }

    .calendar-table {
        min-width: 700px;
        font-size: 0.8rem;
    }

    .calendar-table th {
        padding: 12px 6px;
        font-size: 0.75rem;
        min-width: 100px;
    }

    .court-cell {
        min-width: 100px;
        height: 60px;
        padding: 4px;
        font-size: 0.7rem;
    }

    .court-cell.disponible::after {
        font-size: 0.55rem;
    }

    .time-cell {
        width: 80px;
        padding: 10px 6px;
        font-size: 0.75rem;
        min-width: 80px;
    }

    .reservation-info {
        font-size: 0.65rem;
        line-height: 1.2;
    }

    .state-text {
        font-size: 0.65rem;
    }

    .main-content {
        padding: 15px 5px;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
        max-width: 95%;
        max-height: 90vh;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    /* Estilos para alerta pública en móvil */
    .public-access-alert {
        margin: 15px 10px 25px 10px;
        border-radius: 10px;
    }
    
    .alert-content {
        padding: 20px;
    }
    
    .alert-content h3 {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }
    
    .alert-content p {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .alert-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .alert-actions .btn {
        width: 100%;
        padding: 15px 20px;
    }

    /* Scroll horizontal indicator */
    .calendar-container::after {
        content: "← Desliza horizontalmente para ver más canchas →";
        display: block;
        text-align: center;
        padding: 12px;
        background: #f8f9fa;
        color: #666;
        font-size: 0.8rem;
        border-top: 1px solid #e1e5e9;
        font-weight: 500;
    }
}

@media (max-width: 480px) {
    .calendar-table {
        min-width: 600px;
    }
    
    .court-cell {
        min-width: 85px;
        height: 55px;
    }
    
    .time-cell {
        width: 70px;
        font-size: 0.7rem;
    }
    
    .court-cell.disponible::after {
        content: 'DISP';
        font-size: 0.5rem;
    }
    
    .state-text {
        font-size: 0.55rem;
    }

    .socio-results {
        max-height: 150px;
    }

    .socio-result-item {
        padding: 8px 10px;
    }

    .main-content {
        padding: 10px 2px;
    }

    .controls {
        margin: 0 -2px 20px -2px;
        padding: 12px;
    }

    .alert-content h3 {
        font-size: 1.2rem;
    }
    
    .alert-content p {
        font-size: 0.9rem;
    }
}