/* ============================================ */
/* MODAL Y CARRUSEL - VERSION LIMPIA           */
/* SOLO CLASES EN USO                          */
/* ============================================ */

/* ============================================ */
/* MODAL UNIFICADO                             */
/* ============================================ */

.oculta {
    display: none;
}

.modal-editar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-editar-overlay.active {
    display: flex;
}

body.modal-abierto {
    overflow: hidden;
}

.modal-editar-contenido {
    background: #fff;
    border-radius: 12px;
    width: 96%;
    max-width: 454px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-editar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.modal-editar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.modal-editar-header h3 i {
    margin-right: 8px;
    color: #4a90e2;
}

.btn-editar-cerrar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.btn-editar-cerrar:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-editar-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-editar-footer {
    padding: 12px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fff;
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
}

/* ===== FORMULARIO ===== */
.form-editar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-editar-grupo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.full-width {
    grid-column: span 2;
}

.form-editar-grupo label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
}

.form-editar-grupo label .required {
    color: #dc3545;
    font-size: 0.75rem;
    margin-left: 2px;
}

.form-editar-control {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

.form-editar-control:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.form-editar-control:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.form-editar-control.error {
    border-color: #dc3545;
}

textarea.form-editar-control {
    resize: vertical;
    min-height: 60px;
}

select.form-editar-control {
    cursor: pointer;
    background-color: #fff;
    appearance: auto;
}

.observaciones-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    color: #495057;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    max-height: 150px;
    overflow-y: auto;
}

.observaciones-box:empty::before {
    content: 'Sin observaciones';
    color: #6c757d;
    font-style: italic;
}

/* ============================================ */
/* CARRUSEL DE IMÁGENES                        */
/* ============================================ */

.image-carousel-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 10px auto;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.image-carousel-wrapper {
    position: relative;
    width: 100%;
    height: 380px;
    overflow: hidden;
    background: #f3f4f6;
}

.image-carousel-slide {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.image-carousel-item {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    position: relative;
    overflow: hidden;
}

.image-carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    display: block;
}

.image-upload-input { display: none; }

/* ===== BOTONES DE NAVEGACIÓN ===== */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    color: #374151;
    border: 1px solid #d1d5db;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.carousel-btn:hover {
    background: #ffffff;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #9ca3af;
}

.carousel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: translateY(-50%) scale(0.95);
}

.carousel-btn-prev {
    left: 10px;
}

.carousel-btn-next {
    right: 10px;
}

/* ===== CONTADOR ===== */
.carousel-counter-container {
    display: flex;
    justify-content: center;
    padding: 8px 0;
    width: 100%;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.carousel-counter {
    background: #e5e7eb;
    color: #374151;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== ESTADO VACÍO ===== */
.carousel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 320px;
    color: #9ca3af;
    background: #f9fafb;
}

.carousel-empty i {
    font-size: 48px;
    margin-bottom: 10px;
    color: #d1d5db;
}

.carousel-empty p {
    font-size: 14px;
    margin: 0;
}

/* ============================================ */
/* ELEMENTOS ADICIONALES                       */
/* ============================================ */

.carousel-image {
    display: none;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    color: #6b7280;
    border: 1.5px solid #d1d5db;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    cursor: pointer;
    display: none;
    font-size: 12px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.remove-image-btn:hover {
    background: #ffffff;
    color: #dc2626;
    border-color: #fca5a5;
    transform: scale(1.1);
}

.hidden-input {
    display: none;
}

/* ============================================ */
/* RESPONSIVE - MODAL Y CARRUSEL               */
/* ============================================ */

@media (max-width: 768px) {
    .image-carousel-wrapper {
        height: 380px;
    }

    .carousel-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .carousel-empty {
        height: 340px;
    }
}

@media (max-width: 480px) {
    .image-carousel-wrapper {
        height: 340px;
    }

    .carousel-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .carousel-empty {
        height: 300px;
    }

    .carousel-empty i {
        font-size: 36px;
    }

    .modal-editar-contenido {
        width: 93%;
        max-width: 389px;
        max-height: 75vh;
        border-radius: 10px;
    }

    .modal-editar-body {
        padding: 12px;
    }

    .form-editar-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .full-width {
        grid-column: span 1;
    }

    .modal-editar-footer {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    .modal-editar-header {
        padding: 12px 16px;
    }

    .modal-editar-header h3 {
        font-size: 0.95rem;
    }

    .form-editar-control {
        font-size: 0.8rem;
        padding: 5px 8px;
    }

    .form-editar-grupo label {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .image-carousel-wrapper {
        height: 290px;
    }

    .carousel-empty {
        height: 260px;
    }
}

/* ============================================ */
/* ACCESIBILIDAD                                */
/* ============================================ */

@media (prefers-reduced-motion: reduce) {
    .modal-editar-contenido,
    .image-carousel-slide,
    .carousel-btn {
        transition: none !important;
        animation: none !important;
    }
}