/**
 * ESTILOS OSCUROS PARA MODAL DE CALENDARIO CAL.COM
 * Archivo: src/static/css/calCom/calendario.css
 * 
 * Estilos para el modal del calendario con tema oscuro profesional
 */

/* ================================================================
   MODAL OVERLAY Y CONTENEDOR PRINCIPAL
   ================================================================ */

/* Overlay oscuro del modal */
.modal-calendario-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay 0.3s ease-out;
}

/* Modal oscuro del calendario */
.modal-calendario {
    background: #0d0d0d;
    border: 1px solid #1f1f1f;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 
                0 0 40px rgba(0, 0, 0, 0.7);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: slideInModal 0.3s ease-out;
}

/* Header del modal */
.modal-calendario-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    padding: 20px;
    border-bottom: 1px solid #1f1f1f;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-calendario-header h2 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Botón cerrar */
.modal-calendario-close {
    background: transparent;
    border: none;
    color: #999;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-calendario-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Contenedor principal del calendario */
.modal-calendario-content {
    flex: 1;
    background: #0a0a0a;
    padding: 20px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 #0a0a0a;
}

.modal-calendario-content::-webkit-scrollbar {
    width: 8px;
}

.modal-calendario-content::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.modal-calendario-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.modal-calendario-content::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* ================================================================
   CONTENEDOR CAL.COM
   ================================================================ */

/* Contenedor principal del calendario Cal.com */
.calcom-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    min-height: 500px;
}

/* Cal.com iframe responsive - tema oscuro */
.calcom-container iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
    display: block;
    background: #1a1a1a;
}

.calcom-container cal-inline {
    background: #1a1a1a;
}

/* ================================================================
   ESTADOS DE CARGA Y ERROR
   ================================================================ */

/* Estado de carga */
.calcom-loading {
    padding: 60px 20px;
    text-align: center;
    color: #aaa;
    font-size: 16px;
    background: #1a1a1a;
    border-radius: 8px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.calcom-loading::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #aaa;
    margin-left: 8px;
    margin-top: 15px;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        color: rgba(170, 170, 170, 0);
        text-shadow: .25em 0 0 rgba(170, 170, 170, 0), .5em 0 0 rgba(170, 170, 170, 0);
    }
    40% {
        color: #aaa;
        text-shadow: .25em 0 0 rgba(170, 170, 170, 0), .5em 0 0 rgba(170, 170, 170, 0);
    }
    60% {
        text-shadow: .25em 0 0 #aaa, .5em 0 0 rgba(170, 170, 170, 0);
    }
    80%, 100% {
        text-shadow: .25em 0 0 #aaa, .5em 0 0 #aaa;
    }
}

/* Error state */
.calcom-error {
    padding: 30px;
    text-align: center;
    color: #ff6b6b;
    font-size: 14px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #5c3333;
    border-radius: 8px;
    margin: 20px 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* No calendar configured */
.calcom-no-calendar {
    padding: 30px;
    text-align: center;
    color: #888;
    font-size: 14px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    margin: 20px 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================================================================
   ANIMACIONES
   ================================================================ */

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInModal {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* ================================================================
   FORMULARIOS - ESTILO SAAS MODERNO
   ================================================================ */

/* Contenedor de grupo de formulario */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

/* Cuando el form-group contiene un toggle switch de reserva */
.form-group .toggle-switch-reserva-wrapper {
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

/* Labels */
.form-group label {
    color: #e0e0e0;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.form-group label .required {
    color: #ff6b6b;
    margin-left: 2px;
}

/* Inputs y selects */
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #111;
    color: #fff;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #666;
}

/* Focus states */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #17a2b8;
    background: #0d0d0d;
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
}

/* Textarea */
.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

/* Help text */
.form-help {
    color: #888;
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.4;
}

/* ================================================================
   BOTONES - ESTILO MODERNO
   ================================================================ */

/* Botón primario - Guardar */
.btn-config-save {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-config-save:hover {
    background: #138496;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.btn-config-save:active {
    background: #0f5f6f;
    transform: translateY(1px);
}

.btn-config-save:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.btn-config-save.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-config-save.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Botón secundario - Cancelar */
.btn-config-cancel {
    background: transparent;
    color: #aaa;
    border: 1px solid #333;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-config-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ddd;
    border-color: #444;
}

/* Botones en línea */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.button-group .btn-config-cancel {
    flex: 1;
    margin-top: 0;
}

.button-group .btn-config-save {
    flex: 1;
    margin-top: 0;
}

/* ================================================================
   MENSAJES - SUCCESS / ERROR / INFO
   ================================================================ */

/* Contenedor de mensajes */
.message-box {
    padding: 14px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInMessage 0.3s ease-out;
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mensaje de éxito - Verde */
.message-success {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid #4caf50;
    color: #81c784;
}

/* Mensaje de error - Rojo */
/* Mensaje de error - Rojo */
.message-error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #ff4444;
    color: #ff6b6b;
}
.message-info {
    background: rgba(23, 162, 184, 0.1);
    border: 1px solid #17a2b8;
    color: #64b5d6;
}

/* ================================================================
   CAMPOS DE CONFIGURACIÓN ESPECÍFICOS
   ================================================================ */

/* Sección de configuración */
.config-section {
    margin-bottom: 24px;
}

.config-section-title {
    color: #17a2b8;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #222;
}

/* Dos columnas responsive */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   RESPONSIVE - MOBILE FIRST
   ================================================================ */

/* Extra small devices (< 360px) */
@media (max-width: 359px) {
    .modal-calendario {
        width: 100%;
        max-height: 100vh;
        border-radius: 8px;
        max-width: 100%;
    }
    
    .modal-calendario-header {
        padding: 12px;
    }
    
    .modal-calendario-header h2 {
        font-size: 14px;
    }
    
    .modal-calendario-close {
        font-size: 24px;
        width: 28px;
        height: 28px;
    }
    
    .modal-calendario-content {
        padding: 12px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .button-group button {
        width: 100%;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .toggle-switch-reserva-text {
        font-size: 12px;
    }
}

/* Small devices (360px - 480px) */
@media (max-width: 480px) {
    .modal-calendario {
        width: 98%;
        max-height: 98vh;
        max-width: 100%;
        border-radius: 10px;
    }
    
    .modal-calendario-header {
        padding: 14px;
    }
    
    .modal-calendario-header h2 {
        font-size: 15px;
    }
    
    .modal-calendario-content {
        padding: 14px;
    }
    
    .calcom-container {
        min-height: 500px;
    }
    
    .calcom-container iframe {
        min-height: 500px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .button-group button {
        width: 100%;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    form {
        margin: 0;
    }
}

/* Medium devices (481px - 768px) */
@media (max-width: 768px) {
    .modal-calendario {
        width: 95%;
        max-height: 95vh;
        max-width: 100%;
        border-radius: 10px;
    }
    
    .modal-calendario-header {
        padding: 16px;
    }
    
    .modal-calendario-header h2 {
        font-size: 16px;
    }
    
    .modal-calendario-close {
        font-size: 26px;
        width: 30px;
        height: 30px;
    }
    
    .modal-calendario-content {
        padding: 16px;
    }
    
    .calcom-container {
        min-height: 600px;
    }
    
    .calcom-container iframe {
        min-height: 600px;
    }
    
    .button-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .button-group button {
        flex: 1;
        min-width: 150px;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   TOGGLE SWITCH MODERNO - RESERVA
   ================================================================ */

.toggle-switch-reserva-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

/* Input checkbox oculto */
.toggle-switch-reserva-input {
    display: none;
}

/* Label contenedor */
.toggle-switch-reserva-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    width: auto;
    flex-wrap: nowrap;
    position: relative;
}

/* Track (fondo del switch) */
.toggle-switch-reserva-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 56px;
    height: 32px;
    background: #3d3d3d;
    border-radius: 16px;
    transition: background-color 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    padding: 2px;
    box-sizing: border-box;
}

/* Thumb (círculo deslizante) */
.toggle-switch-reserva-thumb {
    position: absolute;
    top: calc(35% + 2px);
    left: 2px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: left 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none;
}

/* Texto del label */
.toggle-switch-reserva-text {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

/* Estados cuando el checkbox está marcado */
.toggle-switch-reserva-input:checked + .toggle-switch-reserva-label .toggle-switch-reserva-track {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 
                0 0 12px rgba(76, 175, 80, 0.4);
}

.toggle-switch-reserva-input:checked + .toggle-switch-reserva-label .toggle-switch-reserva-thumb {
    left: 26px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.toggle-switch-reserva-input:checked + .toggle-switch-reserva-label .toggle-switch-reserva-text {
    color: #4caf50;
}

/* Estados cuando el checkbox no está marcado (sin cambios visuales llamativos) */
.toggle-switch-reserva-input:not(:checked) + .toggle-switch-reserva-label .toggle-switch-reserva-track {
    background: #3d3d3d;
}

.toggle-switch-reserva-input:not(:checked) + .toggle-switch-reserva-label .toggle-switch-reserva-text {
    color: #a0a0a0;
}

/* Hover state */
.toggle-switch-reserva-label:hover .toggle-switch-reserva-track {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4),
                0 0 8px rgba(255, 255, 255, 0.1);
}

.toggle-switch-reserva-input:checked:hover + .toggle-switch-reserva-label .toggle-switch-reserva-track {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2),
                0 0 16px rgba(76, 175, 80, 0.5);
}

/* Focus state (accesibilidad) */
.toggle-switch-reserva-input:focus + .toggle-switch-reserva-label .toggle-switch-reserva-track {
    outline: 2px solid #17a2b8;
    outline-offset: 2px;
}

/* Disabled state */
.toggle-switch-reserva-input:disabled + .toggle-switch-reserva-label {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-switch-reserva-input:disabled + .toggle-switch-reserva-label .toggle-switch-reserva-track {
    background: #2a2a2a;
}

/* Animación de pulso cuando está habilitado */
@keyframes toggleReservaPulse {
    0% {
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 
                    0 0 12px rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2),
                    0 0 20px rgba(76, 175, 80, 0.6);
    }
    100% {
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2),
                    0 0 12px rgba(76, 175, 80, 0.4);
    }
}

/* Aplicar pulso cuando se habilita (opcional) */
.toggle-switch-reserva-input:checked + .toggle-switch-reserva-label .toggle-switch-reserva-track.pulse {
    animation: toggleReservaPulse 0.6s ease-in-out;
}
