/* ===========================
   TG Apartment Booking - Formulario
   =========================== */

.tg-booking-form-wrapper {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.tg-booking-form {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

/* Secciones del formulario */
.tg-form-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.tg-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.tg-form-section h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 22px;
    font-weight: 600;
}

.tg-form-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Calendario */
.tg-calendar-container {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Header del calendario con botón */
.tg-calendar-header {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
    padding: 0 10px;
}

/* Botón de limpiar selección */
.tg-btn-clear {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    animation: bounceIn 0.4s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    60% {
        opacity: 1;
        transform: scale(1.05) translateY(0);
    }
    100% {
        transform: scale(1) translateY(0);
    }
}

.tg-btn-clear:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.tg-btn-clear:active {
    transform: translateY(0);
}

.tg-btn-clear .clear-icon {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

/* Mensaje temporal */
.tg-temp-message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

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

.tg-temp-message.tg-temp-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.tg-temp-message.tg-temp-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

#tg-booking-calendar {
    max-width: 100%;
}

.flatpickr-calendar {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.flatpickr-day.fortnight-boundary {
    position: relative;
    font-weight: bold;
}

/* Instrucciones de uso */
.tg-booking-instructions {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.tg-instruction-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e7ff;
}

.tg-instruction-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.tg-instruction-icon {
    font-size: 28px;
    margin-right: 15px;
    flex-shrink: 0;
    line-height: 1;
}

.tg-instruction-text {
    flex: 1;
}

.tg-instruction-text strong {
    display: block;
    color: #4c51bf;
    margin-bottom: 5px;
    font-size: 15px;
}

.tg-instruction-text p {
    margin: 0;
    color: #5a67d8;
    font-size: 14px;
    line-height: 1.5;
}

/* Calendario con 2 meses */
.flatpickr-calendar.inline {
    width: auto !important;
    max-width: 100%;
    box-shadow: none !important;
}

.flatpickr-months {
    display: flex;
}

.flatpickr-month {
    background: transparent !important;
}

/* ESTILOS CRÍTICOS - Días de INICIO de quincena (1 y 16) */
.flatpickr-day.fortnight-start,
span.flatpickr-day.fortnight-start {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    font-weight: bold !important;
    border: 2px solid #5568d3 !important;
    position: relative !important;
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4) !important;
    z-index: 1 !important;
}

.flatpickr-day.fortnight-start:hover,
span.flatpickr-day.fortnight-start:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6b4b9a 100%) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.6) !important;
}

/* Días de inicio que están deshabilitados */
.flatpickr-day.fortnight-start.flatpickr-disabled,
span.flatpickr-day.fortnight-start.flatpickr-disabled {
    background: linear-gradient(135deg, #999 0%, #666 100%) !important;
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

/* Badge en días de inicio */
.fortnight-badge {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #667eea !important;
    font-size: 9px !important;
    font-weight: bold !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    line-height: 1 !important;
    z-index: 2 !important;
    pointer-events: none !important;
}

/* Días de FIN de quincena (15 y último) */
.flatpickr-day.fortnight-end,
span.flatpickr-day.fortnight-end {
    border: 2px dashed #667eea !important;
    font-weight: 600 !important;
    background-color: rgba(102, 126, 234, 0.08) !important;
}

.flatpickr-day.fortnight-end:hover,
span.flatpickr-day.fortnight-end:hover {
    background-color: rgba(102, 126, 234, 0.15) !important;
}

.flatpickr-day.fortnight-boundary::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background-color: #667eea;
    border-radius: 50%;
}

/* Filas de formulario */
.tg-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.tg-form-col {
    display: flex;
    flex-direction: column;
}

.tg-form-row label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.tg-form-row input,
.tg-form-row select,
.tg-form-row textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.tg-form-row input:focus,
.tg-form-row select:focus,
.tg-form-row textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Resumen de precio */
.tg-price-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 8px;
    margin-top: 20px;
}

.tg-price-breakdown p {
    margin: 8px 0;
    font-size: 16px;
}

.tg-price-breakdown strong {
    font-size: 20px;
}

.tg-deposit-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

/* Campos de edades de niños */
#tg-children-ages-container {
    margin-top: 20px;
}

#tg-children-ages-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.tg-child-age-field {
    display: flex;
    flex-direction: column;
}

.tg-child-age-field label {
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.tg-child-age-field input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

/* Mensajes de advertencia */
.tg-warning-message {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin-top: 15px;
    border-radius: 4px;
    color: #856404;
}

/* Mensajes del formulario */
.tg-form-messages {
    margin: 20px 0;
}

.tg-message {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 15px;
}

.tg-message.tg-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.tg-message.tg-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* Botón de envío */
.tg-form-actions {
    text-align: center;
    margin-top: 30px;
}

.tg-btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.tg-btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.tg-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .tg-booking-form {
        padding: 25px;
    }
    
    .tg-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    #tg-children-ages-fields {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Instrucciones más compactas en móvil */
    .tg-booking-instructions {
        padding: 15px;
    }
    
    .tg-instruction-item {
        margin-bottom: 15px;
        padding-bottom: 15px;
    }
    
    .tg-instruction-icon {
        font-size: 24px;
        margin-right: 10px;
    }
    
    .tg-instruction-text strong {
        font-size: 14px;
    }
    
    .tg-instruction-text p {
        font-size: 13px;
    }
    
    /* Calendario en móvil */
    .flatpickr-calendar.inline {
        font-size: 14px;
    }
    
    .flatpickr-months {
        flex-direction: column;
    }
    
    /* Botón de limpiar en móvil */
    .tg-calendar-header {
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .tg-btn-clear {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tg-booking-form-wrapper {
        padding: 0 10px;
    }
    
    .tg-booking-form {
        padding: 20px;
    }
    
    .tg-form-section h3 {
        font-size: 18px;
    }
    
    #tg-children-ages-fields {
        grid-template-columns: 1fr;
    }
    
    .tg-instruction-item {
        flex-direction: column;
        text-align: center;
    }
    
    .tg-instruction-icon {
        margin-right: 0;
        margin-bottom: 8px;
    }
}