/**
 * Estilos para el selector de calendario - OPTIMIZADO
 * Maneja: Carruseles Swiper, selección de láminas/faldillas, extras
 */

/* ============================================ */
/* OCULTAR ELEMENTOS CUANDO HAY CALENDARIO */
/* ============================================ */

/* Para calendarios, ocultar elementos específicos dentro de product__actions pero no el contenedor completo */
body.has-imprepro-calendar .product__actions .product-add-to-cart,
body.has-imprepro-calendar .product__actions .product__variants,
body.has-imprepro-calendar .product__actions .js-product-add-to-cart:not(#add-to-cart-section),
body.has-imprepro-calendar .product-actions__quantity {
    display: none !important;
}

.product-customization:has(.imprepro-calendar-selector) .card.general-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.product-customization:has(.imprepro-calendar-selector) .card.general-card > .card-body {
    padding: 0 !important;
}

.product-customization:has(.imprepro-calendar-selector) .card.general-card > .card-body > .h5.card-title,
.product-customization:has(.imprepro-calendar-selector) .card.general-card > .card-body > .instructions,
.product-customization:has(.imprepro-calendar-selector) .card.general-card > .card-body > .documents {
    display: none !important;
}

/* ============================================ */
/* VARIABLES Y CONTENEDOR PRINCIPAL */
/* ============================================ */

.imprepro-calendar-selector {
    --primary: #2E8CBF;
    --border: #e0e0e0;
    --border-light: #e8e8e8;
    --bg-light: #fafafa;
    --text: #333;
    --text-muted: #666;
    --radius: 4px;
    --radius-lg: 8px;
    --transition: 0.2s ease;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
}

/* ============================================ */
/* PASOS / SECCIONES */
/* ============================================ */

.calendar-step {
    background: #F5F5F5;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 15px;
}

.step-header {
    margin-bottom: 12px;
}

.step-header-with-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.step-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.step-title .step-title-text { text-transform: none; font-weight: 400; }
.step-title .optional-tag { font-weight: 400; font-size: 12px; color: #999; text-transform: none; }
.step-subtitle { 
    font-size: 13px; 
    color: #888; 
    margin: 8px 0 12px 0;
    font-weight: 400;
}

/* ============================================ */
/* FLECHAS DE NAVEGACIÓN */
/* ============================================ */

.step-nav, .faldilla-section-nav { display: flex; gap: 5px; }

.nav-arrow {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 16px;
    transition: color var(--transition);
    padding: 0;
}

.nav-arrow:hover:not(.swiper-button-disabled) { color: var(--primary); }

.nav-arrow.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    color: #ccc;
}

/* ============================================ */
/* SWIPER - CARRUSELES */
/* ============================================ */

/* Ocultar swiper hasta que esté inicializado para evitar flash de imágenes grandes */
.laminas-swiper:not(.swiper-initialized),
.faldillas-swiper:not(.swiper-initialized),
.faldillas-custom-swiper:not(.swiper-initialized) {
    opacity: 0;
    max-height: 200px;
    overflow: hidden;
}

.laminas-swiper:not(.swiper-initialized) .swiper-slide,
.faldillas-swiper:not(.swiper-initialized) .swiper-slide,
.faldillas-custom-swiper:not(.swiper-initialized) .swiper-slide {
    max-width: 150px;
    display: inline-block;
}

.laminas-swiper, .faldillas-swiper, .faldillas-custom-swiper {
    width: 100%;
    padding: 5px 0;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.laminas-swiper.swiper-initialized,
.faldillas-swiper.swiper-initialized,
.faldillas-custom-swiper.swiper-initialized {
    opacity: 1;
}

.laminas-swiper .swiper-slide,
.faldillas-swiper .swiper-slide,
.faldillas-custom-swiper .swiper-slide { height: auto; }

/* ============================================ */
/* LÁMINAS Y FALDILLAS - ITEMS */
/* ============================================ */

.lamina-item, .faldilla-item {
    cursor: pointer;
    text-align: center;
}

.lamina-image-wrapper, .faldilla-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #f5f5f5;
    transition: border-color var(--transition);
}

.lamina-image-wrapper img, .faldilla-image-wrapper img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

.lamina-item:hover .lamina-image-wrapper,
.faldilla-item:hover .faldilla-image-wrapper { border-color: var(--primary); }

.lamina-item.selected .lamina-image-wrapper,
.faldilla-item.selected .faldilla-image-wrapper {
    border-color: var(--primary);
    border-width: 3px;
}

/* Check overlay */
.lamina-check-overlay, .faldilla-check-overlay {
    position: absolute;
    top: 3px; right: 3px;
    width: 18px; height: 18px;
    background: var(--primary);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.lamina-item.selected .lamina-check-overlay,
.faldilla-item.selected .faldilla-check-overlay { opacity: 1; }

.lamina-check-overlay svg { width: 14px; height: 14px; fill: #fff; }
.faldilla-check-overlay svg { width: 10px; height: 10px; fill: #fff; }

/* Nombres */
.lamina-name {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lamina-item.selected .lamina-name { color: var(--primary); font-weight: 600; }

.faldilla-name {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.3;
    min-height: 42px;
    overflow: hidden;
    word-wrap: break-word;
}

.faldilla-item.selected .faldilla-name { color: var(--primary); font-weight: 600; }

/* ============================================ */
/* FALDILLAS - SECCIONES POR LÁMINA */
/* ============================================ */

.faldilla-section {
    background: var(--bg-light);
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

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

.faldilla-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.faldilla-section-nav { margin-left: auto; }

.faldilla-lamina-info {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    padding: 4px 8px;
    flex-shrink: 0;
}

.faldilla-lamina-thumb {
    width: 28px; height: 28px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--border);
}

.faldilla-lamina-thumb img { width: 100%; height: 100%; object-fit: cover; }

.faldilla-lamina-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    white-space: nowrap;
}

.faldilla-remove-btn {
    width: 16px; height: 16px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: color var(--transition);
}

.faldilla-remove-btn:hover { color: #e74c3c; }

.faldilla-total-badge {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius);
    min-width: 28px;
    text-align: center;
}

/* Input cantidad - CALENDARIO NORMAL (PASO 2) */
.step-faldillas .faldilla-qty-input {
    margin-top: 4px;
}

.step-faldillas .faldilla-qty-input input {
    width: 50px;
    height: 26px;
    border: 1px solid var(--primary);
    border-radius: 3px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: #fff;
    -moz-appearance: textfield;
}

.step-faldillas .faldilla-qty-input input::-webkit-outer-spin-button,
.step-faldillas .faldilla-qty-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.step-faldillas .faldilla-qty-input input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.step-faldillas .faldilla-item.selected .faldilla-qty-input input {
    border-color: var(--primary);
    background: #e8f4fc;
}

/* ============================================ */
/* EXTRAS - CHECKBOXES */
/* ============================================ */

.extras-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.extra-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.extra-input,
.design-option-input { display: none; }

.checkbox-box {
    width: 16px; height: 16px;
    border: 2px solid #ccc;
    border-radius: 3px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s ease;
    background: #fff;
}

.extra-checkbox-item:hover .checkbox-box { border-color: var(--primary); }

.extra-checkbox-item.checked .checkbox-box {
    border-color: var(--primary);
    background: var(--primary);
}

.extra-checkbox-item.checked .checkbox-box::after {
    content: '';
    position: absolute;
    top: 0px; left: 4px;
    width: 4px; height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.extra-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #e8f4fc;
    border-radius: var(--radius);
    flex-grow: 1;
    transition: all 0.15s ease;
}

.extra-checkbox-item:hover .extra-content { background: #d0ebf9; }
.extra-checkbox-item.checked .extra-content { background: var(--primary); }
.extra-checkbox-item.checked .extra-label { color: #fff; }

.extra-label {
    flex-grow: 1;
    font-size: 11px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.2;
}

.extra-info-btn {
    width: 18px; height: 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.15s ease;
}

.extra-info-btn:hover {
    color: #1976d2;
    transform: scale(1.1);
}

.extra-info-btn svg {
    width: 18px; height: 18px;
    fill: currentColor;
    transition: fill var(--transition);
}

.extra-checkbox-item.checked .extra-info-btn svg { fill: rgba(255,255,255,0.9); }

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

@media (max-width: 992px) {
    .calendar-step { padding: 15px; }
}

@media (max-width: 576px) {
    .calendar-step { padding: 12px; }
    .extras-grid { grid-template-columns: 1fr; }
    .step-title { font-size: 11px; }
    .faldilla-name { font-size: 8px; min-height: 32px; }
    .nav-arrow { width: 20px; height: 20px; font-size: 14px; }
}

/* ============================================ */
/* CALENDARIO PERSONALIZADO - FALDILLAS CON CANTIDAD */
/* ============================================ */

.step-faldillas-custom .faldillas-custom-container {
    overflow: hidden;
}

/* Items de faldilla - misma estructura visual que laminas */
.faldilla-custom-item {
    cursor: pointer;
    text-align: center;
}

.faldilla-custom-item .faldilla-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #f5f5f5;
    transition: border-color var(--transition);
}

.faldilla-custom-item:hover .faldilla-image-wrapper {
    border-color: var(--primary);
}

.faldilla-custom-item.selected .faldilla-image-wrapper {
    border-color: var(--primary);
    border-width: 3px;
}

.faldilla-custom-item .faldilla-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Check overlay - igual que laminas */
.faldilla-custom-item .faldilla-check-overlay {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.faldilla-custom-item.selected .faldilla-check-overlay {
    opacity: 1;
}

.faldilla-custom-item .faldilla-check-overlay svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

/* Nombre - igual que laminas */
.faldilla-custom-item .faldilla-name {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.faldilla-custom-item.selected .faldilla-name {
    color: var(--primary);
    font-weight: 600;
}

.faldilla-custom-item .faldilla-placeholder {
    width: 100%;
    height: 100%;
    background: #e0e0e0;
}

/* Selector de cantidad - específico del calendario personalizado */
.step-faldillas-custom .faldilla-qty-selector {
    margin-top: 8px;
}

.step-faldillas-custom .faldilla-qty-input {
    width: 55px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: #fff;
    transition: border-color var(--transition), background var(--transition);
    -moz-appearance: textfield;
}

.step-faldillas-custom .faldilla-qty-input::-webkit-outer-spin-button,
.step-faldillas-custom .faldilla-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.step-faldillas-custom .faldilla-qty-input:focus {
    outline: none;
    border-color: var(--primary);
}

.step-faldillas-custom .faldilla-custom-item.selected .faldilla-qty-input {
    border-color: var(--primary);
    background: #e8f4fc;
    color: var(--primary);
}

.total-quantity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    padding: 0 6px;
}

/* ============================================ */
/* PERSONALIZACIÓN - OPCIONES DE DISEÑO */
/* ============================================ */

/* Estilos específicos para personalización - diferentes a extras */
.step-personalizacion .extra-checkbox-item .extra-content {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
}

.step-personalizacion .extra-checkbox-item:hover .extra-content {
    background: #bbdefb;
    border-color: #90caf9;
}

.step-personalizacion .extra-checkbox-item.checked .extra-content {
    background: var(--primary);
    border-color: var(--primary);
}

.step-personalizacion .extra-checkbox-item .extra-label {
    color: var(--primary);
    font-weight: 600;
}

.step-personalizacion .extra-checkbox-item.checked .extra-label {
    color: #fff;
}

.design-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.design-option-item.checked .extra-content {
    background: var(--primary);
}

.design-option-item.checked .extra-label {
    color: #fff;
}

/* ============================================ */
/* PERSONALIZACIÓN - DOCUMENTOS */
/* ============================================ */

.personalizacion-documents {
    margin-bottom: 16px;
}

.documents-label {
    font-size: 14px;
    color: #333;
    font-weight: 400;
    margin-bottom: 10px;
    display: block;
}

.documents-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-document {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #E1EAF0;
    color: #333;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-document:hover {
    background: #d0e0ec;
    text-decoration: none;
    color: #333;
}

.btn-document svg {
    color: #333;
    flex-shrink: 0;
}

/* ============================================ */
/* PERSONALIZACIÓN - SUBIDA DE ARCHIVO */
/* ============================================ */

.personalizacion-upload {
    margin-top: 20px;
}

.upload-dropzone {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid #d0d0d0;
    border-radius: var(--radius);
    background: #F5F5F5;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.upload-dropzone:hover {
    border-color: #999;
    background: #ebebeb;
}

.upload-dropzone.dragover {
    border-color: var(--primary);
    background: #e8f4fc;
}

.upload-icon {
    flex-shrink: 0;
    width: 60px;
    color: #333;
    background: #E1EAF0;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
}

.upload-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.upload-text {
    flex-grow: 1;
}

.upload-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.upload-text p {
    font-size: 12px;
    color: #555;
    margin: 0;
    line-height: 1.5;
}

.upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.uploaded-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #e8f4fc;
    border-radius: var(--radius);
    margin-top: 10px;
}

.uploaded-file-info .file-name {
    flex-grow: 1;
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

.btn-remove-file {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color var(--transition);
}

.btn-remove-file:hover {
    color: #e74c3c;
}

/* ============================================ */
/* PERSONALIZACIÓN - OBSERVACIONES */
/* ============================================ */

.personalizacion-observations {
    margin-top: 20px;
}

.observations-label {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    margin-bottom: 8px;
}

.observations-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d0d0d0;
    border-radius: var(--radius);
    background: #E1EAF0;
    font-size: 13px;
    color: #333;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color var(--transition);
}

.observations-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.observations-textarea::placeholder {
    color: transparent;
}

/* ============================================ */
/* RESPONSIVE CALENDARIO PERSONALIZADO */
/* ============================================ */

@media (max-width: 576px) {
    .design-options-grid {
        grid-template-columns: 1fr;
    }
    
    .documents-buttons {
        flex-direction: column;
    }
    
    .btn-document {
        justify-content: center;
    }
    
    .upload-dropzone {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .faldilla-custom-item {
        width: 100px;
    }
}

/* ============================================ */
/* ARCHIVO REQUERIDO - VALIDACIÓN */
/* ============================================ */

.file-upload-container.file-required {
    animation: pulse-border 1.5s ease-in-out infinite;
}

.file-upload-container.file-required .upload-dropzone {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05);
}

@keyframes pulse-border {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

#file-required-message {
    font-size: 13px;
    border-radius: var(--radius);
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

#file-required-message i {
    color: #856404;
}

/* Botón deshabilitado estilo visual */
#add-multiple-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
