/**
 * Estilos del Formulario de Reserva - Frontend
 * Colden Custom Leases
 *
 * @package Colden_Custom_Leases
 */

/* Variables CSS */
:root {
    --ccl-primary: #2563eb;
    --ccl-primary-dark: #1d4ed8;
    --ccl-primary-light: #3b82f6;
    --ccl-secondary: #64748b;
    --ccl-success: #10b981;
    --ccl-warning: #f59e0b;
    --ccl-danger: #ef4444;
    --ccl-info: #06b6d4;
    --ccl-dark: #1e293b;
    --ccl-light: #f8fafc;
    --ccl-border: #e2e8f0;
    --ccl-text: #334155;
    --ccl-text-light: #64748b;
    --ccl-radius: 8px;
    --ccl-radius-lg: 12px;
    --ccl-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --ccl-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --ccl-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --ccl-transition: all 0.2s ease;
}

/* ========================================
   BADGE DE ALQUILER (LEASE)
   ======================================== */

.ccl-lease-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--ccl-info), var(--ccl-primary));
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--ccl-radius);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 15px;
    box-shadow: var(--ccl-shadow);
}

.ccl-lease-badge .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */

.ccl-booking-form-wrapper {
    margin: 30px 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.ccl-booking-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ccl-dark);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--ccl-primary);
}

/* ========================================
   FORMULARIO BASE
   ======================================== */

.ccl-booking-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Secciones del formulario */
.ccl-form-section {
    background: #fff;
    border: 1px solid var(--ccl-border);
    border-radius: var(--ccl-radius-lg);
    padding: 25px;
    box-shadow: var(--ccl-shadow);
}

.ccl-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ccl-dark);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ccl-border);
}

.ccl-section-icon {
    color: var(--ccl-primary);
    font-size: 20px;
}

.ccl-section-description {
    color: var(--ccl-text-light);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* ========================================
   GRID DE FORMULARIO
   ======================================== */

.ccl-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.ccl-form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.ccl-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
    .ccl-form-grid,
    .ccl-form-grid-2,
    .ccl-form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   CAMPOS DE FORMULARIO
   ======================================== */

.ccl-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ccl-form-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ccl-text);
}

.ccl-form-field label .required {
    color: var(--ccl-danger);
    margin-left: 2px;
}

.ccl-form-field input[type="text"],
.ccl-form-field input[type="email"],
.ccl-form-field input[type="tel"],
.ccl-form-field input[type="number"],
.ccl-form-field input[type="date"],
.ccl-form-field select,
.ccl-form-field textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--ccl-text);
    background: #fff;
    border: 1px solid var(--ccl-border);
    border-radius: var(--ccl-radius);
    transition: var(--ccl-transition);
    box-sizing: border-box;
}

.ccl-form-field input:focus,
.ccl-form-field select:focus,
.ccl-form-field textarea:focus {
    outline: none;
    border-color: var(--ccl-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ccl-form-field input::placeholder,
.ccl-form-field textarea::placeholder {
    color: var(--ccl-text-light);
}

.ccl-form-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.ccl-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* Mostrador de edad */
.ccl-age-display {
    font-size: 0.8rem;
    color: var(--ccl-text-light);
    font-style: italic;
}

/* ========================================
   SECCIÓN DE FECHAS
   ======================================== */

.ccl-date-summary {
    margin-top: 15px;
    padding: 12px 16px;
    background: var(--ccl-light);
    border-radius: var(--ccl-radius);
    text-align: center;
}

.ccl-days-count {
    font-weight: 600;
    color: var(--ccl-primary);
}

/* ========================================
   SECCIÓN DE ARRENDATARIOS
   ======================================== */

#ccl-renters-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

/* Tarjeta de arrendatario */
.ccl-renter-card {
    background: var(--ccl-light);
    border: 1px solid var(--ccl-border);
    border-radius: var(--ccl-radius-lg);
    overflow: hidden;
    transition: var(--ccl-transition);
}

.ccl-renter-card:hover {
    box-shadow: var(--ccl-shadow-md);
}

.ccl-renter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--ccl-primary), var(--ccl-primary-dark));
    color: #fff;
}

.ccl-renter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff !important;
}

.ccl-renter-title .dashicons {
    font-size: 18px;
}

.ccl-remove-renter {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--ccl-transition);
}

.ccl-remove-renter:hover {
    background: var(--ccl-danger);
}

.ccl-remove-renter .dashicons {
    font-size: 16px;
}

.ccl-renter-body {
    padding: 20px;
}

/* Subsecciones dentro del arrendatario */
.ccl-renter-section {
    margin-bottom: 25px;
}

.ccl-renter-section:last-child {
    margin-bottom: 0;
}

.ccl-subsection-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ccl-secondary);
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--ccl-border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   ADD-ONS (COMPLEMENTOS)
   ======================================== */

.ccl-addons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.ccl-addon-checkbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background: #fff;
    border: 2px solid var(--ccl-border);
    border-radius: var(--ccl-radius);
    cursor: pointer;
    transition: var(--ccl-transition);
    text-align: center;
}

.ccl-addon-checkbox:hover {
    border-color: var(--ccl-primary-light);
    background: var(--ccl-light);
}

.ccl-addon-checkbox input[type="checkbox"] {
    display: none;
}

.ccl-addon-checkbox input[type="checkbox"]:checked + .ccl-addon-icon {
    color: #fff;
    background: var(--ccl-primary);
}

.ccl-addon-checkbox input[type="checkbox"]:checked ~ .ccl-addon-label {
    color: var(--ccl-primary);
    font-weight: 600;
}

.ccl-addon-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ccl-light);
    border-radius: 50%;
    color: var(--ccl-secondary);
    transition: var(--ccl-transition);
}

.ccl-addon-icon .dashicons {
    font-size: 20px;
}

.ccl-addon-label {
    font-size: 0.85rem;
    color: var(--ccl-text);
    transition: var(--ccl-transition);
}

/* ========================================
   CAMPOS DE STAFF
   ======================================== */

.ccl-staff-fields {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--ccl-warning);
}

.ccl-staff-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ccl-warning) !important;
    background: rgba(245, 158, 11, 0.1);
    padding: 8px 12px !important;
    border-radius: var(--ccl-radius);
    border-bottom: none !important;
}

.ccl-staff-badge .dashicons {
    font-size: 16px;
}

/* ========================================
   TÉRMINOS Y CONDICIONES
   ======================================== */

.ccl-terms-box {
    padding: 15px;
    background: var(--ccl-light);
    border-radius: var(--ccl-radius);
    margin-bottom: 20px;
}

.ccl-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.ccl-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--ccl-primary);
}

.ccl-checkbox-text {
    font-size: 0.95rem;
    color: var(--ccl-text);
    line-height: 1.5;
}

.ccl-checkbox-text a {
    color: var(--ccl-primary);
    text-decoration: underline;
}

.ccl-checkbox-text a:hover {
    color: var(--ccl-primary-dark);
}

/* ========================================
   SIGNATURE PAD STYLES
   ======================================== */

.ccl-signature-renter-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--ccl-border);
}

.ccl-signature-instructions {
    font-size: 0.85rem;
    color: var(--ccl-text-light);
    margin-bottom: 12px;
}

.ccl-signature-pad-wrapper {
    position: relative;
    width: 100%;
    border: 2px solid var(--ccl-border);
    border-radius: var(--ccl-radius);
    background: #fff;
    overflow: hidden;
    touch-action: none;
}

.ccl-signature-canvas {
    display: block;
    width: 100%;
    height: 150px;
    cursor: crosshair;
    touch-action: none;
}

.ccl-signature-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.ccl-btn-clear-signature {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ccl-secondary);
    background: var(--ccl-light);
    border: 1px solid var(--ccl-border);
    border-radius: var(--ccl-radius);
    cursor: pointer;
    transition: var(--ccl-transition);
}

.ccl-btn-clear-signature:hover {
    color: var(--ccl-danger);
    border-color: var(--ccl-danger);
    background: #fef2f2;
}

.ccl-btn-clear-signature .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Signature error state */
.ccl-signature-renter-section.ccl-error .ccl-signature-pad-wrapper {
    border-color: var(--ccl-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.ccl-signature-renter-section.ccl-error .ccl-subsection-title {
    color: var(--ccl-danger);
}

/* Responsive for signature */
@media (max-width: 600px) {
    .ccl-signature-canvas {
        height: 120px;
    }

    .ccl-signature-actions {
        justify-content: center;
    }
}

/* ========================================
   ADD-ONS ENHANCED STYLES
   ======================================== */

.ccl-addons-section {
    position: relative;
}

.ccl-addons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.ccl-addon-checkbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 15px 10px;
    background: var(--ccl-light);
    border: 2px solid var(--ccl-border);
    border-radius: var(--ccl-radius);
    cursor: pointer;
    transition: var(--ccl-transition);
    text-align: center;
    position: relative;
}

.ccl-addon-checkbox:hover {
    border-color: var(--ccl-primary);
    background: #f0f7ff;
}

.ccl-addon-checkbox:has(input:checked) {
    border-color: var(--ccl-primary);
    background: #e8f4ff;
    box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
}

.ccl-addon-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

.ccl-addon-icon {
    font-size: 24px;
    color: var(--ccl-secondary);
    transition: var(--ccl-transition);
}

.ccl-addon-checkbox:has(input:checked) .ccl-addon-icon {
    color: var(--ccl-primary);
}

.ccl-addon-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ccl-text);
}

.ccl-addon-price {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ccl-success);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.ccl-addon-checkbox:has(input:checked) .ccl-addon-price {
    background: var(--ccl-success);
    color: #fff;
}

/* Disabled addon (e.g., helmet when rental > 1 day) */
.ccl-addon-checkbox.ccl-addon-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    border-color: #ddd;
}

.ccl-addon-checkbox.ccl-addon-disabled:hover {
    border-color: #ddd;
    background: #f5f5f5;
}

.ccl-addon-checkbox.ccl-addon-disabled .ccl-addon-icon {
    color: #999;
}

/* Addon note message */
.ccl-addons-note {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--ccl-radius);
    color: #856404;
    font-size: 0.85rem;
    text-align: center;
}

/* Responsive addons */
@media (max-width: 480px) {
    .ccl-addons-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ccl-addon-checkbox {
        padding: 12px 8px;
    }

    .ccl-addon-icon {
        font-size: 20px;
    }

    .ccl-addon-label {
        font-size: 0.8rem;
    }
}

/* ========================================
   BOTONES
   ======================================== */

.ccl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--ccl-radius);
    cursor: pointer;
    transition: var(--ccl-transition);
    text-decoration: none;
}

.ccl-btn .dashicons {
    font-size: 18px;
}

.ccl-btn-primary {
    background: linear-gradient(135deg, var(--ccl-primary), var(--ccl-primary-dark));
    color: #fff;
}

.ccl-btn-primary:hover {
    background: linear-gradient(135deg, var(--ccl-primary-dark), var(--ccl-primary-dark));
    transform: translateY(-1px);
    box-shadow: var(--ccl-shadow-md);
}

.ccl-btn-secondary {
    background: #fff;
    color: var(--ccl-primary);
    border: 2px solid var(--ccl-primary);
}

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

.ccl-btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

#ccl-add-renter {
    width: 100%;
}

/* ========================================
   ACCIONES DEL FORMULARIO
   ======================================== */

.ccl-form-actions {
    display: flex;
    justify-content: center;
    padding-top: 10px;
}

.ccl-form-actions .ccl-btn {
    min-width: 280px;
}

/* ========================================
   ESTADOS Y ANIMACIONES
   ======================================== */

/* Loading state */
.ccl-booking-form.ccl-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error state */
.ccl-form-field.ccl-error input,
.ccl-form-field.ccl-error select,
.ccl-form-field.ccl-error textarea {
    border-color: var(--ccl-danger);
    background: #fef2f2;
}

.ccl-form-field .ccl-error-message {
    color: var(--ccl-danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Success animation para el arrendatario */
.ccl-renter-card.ccl-new {
    animation: ccl-slide-in 0.3s ease-out;
}

@keyframes ccl-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Remove animation */
.ccl-renter-card.ccl-removing {
    animation: ccl-slide-out 0.3s ease-out forwards;
}

@keyframes ccl-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 600px) {
    .ccl-booking-form-wrapper {
        margin: 20px 0;
    }

    .ccl-form-section {
        padding: 15px;
    }

    .ccl-renter-header {
        padding: 12px 15px;
    }

    .ccl-renter-body {
        padding: 15px;
    }

    .ccl-addons-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ccl-btn-large {
        padding: 14px 24px;
        font-size: 1rem;
    }

    .ccl-form-actions .ccl-btn {
        width: 100%;
        min-width: auto;
    }

    .ccl-section-title {
        font-size: 1rem;
    }

    .ccl-booking-title {
        font-size: 1.25rem;
    }
}

/* ========================================
   FECHAS NO DISPONIBLES
   ======================================== */

/* Mensaje informativo de fechas no disponibles */
.ccl-unavailable-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 10px 14px;
    border-radius: var(--ccl-radius);
    font-size: 0.875rem;
    margin-top: 10px;
    margin-bottom: 15px;
    border: 1px solid #f59e0b;
}

.ccl-unavailable-info .dashicons {
    color: #d97706;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Error de fechas no disponibles */
.ccl-date-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--ccl-radius);
    font-size: 0.875rem;
    margin-top: 15px;
    border: 1px solid var(--ccl-danger);
    animation: ccl-shake 0.4s ease-in-out;
}

.ccl-date-error .dashicons {
    color: var(--ccl-danger);
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Sección con error */
.ccl-dates-section.ccl-has-error {
    border-color: var(--ccl-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.ccl-dates-section.ccl-has-error .ccl-section-title {
    color: var(--ccl-danger);
}

/* Input de fecha con error */
.ccl-dates-section.ccl-has-error input[type="date"] {
    border-color: var(--ccl-danger);
    background-color: #fef2f2;
}

/* Animación de shake para errores */
@keyframes ccl-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* ========================================
   OCULTAR ELEMENTOS DEL TEMA
   ======================================== */

/* Ocultar el formulario estándar de WooCommerce en productos lease */
.ccl-booking-form-wrapper ~ .cart,
.ccl-booking-form-wrapper ~ form.cart {
    display: none !important;
}
