/* ════════════════════════════════════════════════════════════════
   ● CAROUSEL E CROP TOOL PARA MÚLTIPLAS IMAGENS
   ════════════════════════════════════════════════════════════════ */

/* ── SECTION UPLOAD IMAGENS ────────────────────────────── */
.imagens-upload-section {
    background: rgba(13, 27, 62, 0.8);
    border: 2px dashed rgba(124, 58, 237, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    transition: all 0.3s ease;
}

.imagens-upload-section:hover {
    border-color: rgba(124, 58, 237, 0.8);
    background: rgba(13, 27, 62, 0.95);
}

.imagens-upload-section.dragover {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--nebula-cyan);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.upload-input-label {
    display: block;
    text-align: center;
    padding: 1rem;
    cursor: pointer;
    color: var(--nebula-cyan);
    font-weight: 600;
    font-size: 0.95rem;
}

.upload-input-label:hover {
    color: var(--star-white);
}

.upload-input-file {
    display: none;
}

/* ── PREVIEW IMAGENS ───────────────────────────────────── */
.imagens-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.imagem-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a2e;
    border: 2px solid rgba(99, 102, 241, 0.2);
    transition: all 0.3s ease;
    cursor: grab;
}

.imagem-preview-item:hover {
    border-color: rgba(124, 58, 237, 0.6);
    transform: scale(1.05);
}

.imagem-preview-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.imagem-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.imagem-preview-numero {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    background: rgba(124, 58, 237, 0.9);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
}

.imagem-preview-acoes {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem;
    justify-content: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.imagem-preview-item:hover .imagem-preview-acoes {
    transform: translateY(0);
}

.btn-crop {
    padding: 0.3rem 0.6rem;
    background: var(--nebula-cyan);
    color: #0d1b3e;
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-crop:hover {
    background: #06d5e0;
    transform: scale(1.1);
}

.btn-remover-imagem {
    padding: 0.3rem 0.6rem;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remover-imagem:hover {
    background: #ef4444;
    transform: scale(1.1);
}

/* ── CROP TOOL MODAL ───────────────────────────────────── */
.crop-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.crop-modal.active {
    opacity: 1;
    pointer-events: all;
}

.crop-modal-container {
    background: #0d1b3e;
    border: 2px solid rgba(124, 58, 237, 0.5);
    border-radius: 14px;
    padding: 1.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.4);
}

.crop-modal-titulo {
    font-family: 'Orbitron', sans-serif;
    color: var(--nebula-cyan);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.crop-preview-area {
    position: relative;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #000;
}

.crop-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: move;
}

.crop-controls {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.crop-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crop-control-label {
    color: var(--nebula-cyan);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crop-control-input {
    padding: 0.6rem;
    background: rgba(6, 12, 26, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
}

.crop-control-input:focus {
    outline: none;
    border-color: var(--nebula-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.crop-slider-group {
    display: grid;
    grid-template-columns: 1fr 60px;
    gap: 0.5rem;
    align-items: center;
}

.crop-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.3), rgba(6, 182, 212, 0.3));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.crop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nebula-purple) 0%, var(--nebula-cyan) 100%);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

.crop-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nebula-purple) 0%, var(--nebula-cyan) 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

.crop-slider-value {
    color: var(--nebula-cyan);
    font-weight: 600;
    text-align: right;
    font-size: 0.85rem;
}

.crop-preset-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.crop-preset-btn {
    padding: 0.6rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--nebula-cyan);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.crop-preset-btn:hover,
.crop-preset-btn.active {
    background: rgba(124, 58, 237, 0.3);
    border-color: var(--nebula-cyan);
    color: white;
    transform: scale(1.05);
}

.crop-acoes {
    display: flex;
    gap: 0.8rem;
}

.btn-salvar-crop {
    flex: 1;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--nebula-purple) 0%, var(--nebula-cyan) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.3);
}

.btn-salvar-crop:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(124, 58, 237, 0.5);
}

.btn-cancelar-crop {
    flex: 1;
    padding: 0.8rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--nebula-cyan);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancelar-crop:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--nebula-cyan);
}

/* ── CAROUSEL NO MODAL ─────────────────────────────────── */
.modal-carousel {
    position: relative;
    margin-bottom: 1.5rem;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 16 / 9;
    background: #000;
    contain: layout style paint;
}

.carousel-imagem {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: fadeIn 0.3s ease-out forwards;
    display: block;
    contain: layout style;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.carousel-contador {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 5;
}

.carousel-seta {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(124, 58, 237, 0.7);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 4;
}

.carousel-seta:hover {
    background: rgba(124, 58, 237, 0.95);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.5);
}

.carousel-seta-prev {
    left: 1rem;
}

.carousel-seta-next {
    right: 1rem;
}

.carousel-indicadores {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.carousel-indicador {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-indicador:hover,
.carousel-indicador.active {
    background: var(--nebula-cyan);
    width: 24px;
    border-radius: 4px;
}

/* ── ESTADOS DE UPLOAD ─────────────────────────────────── */
.estado-upload {
    text-align: center;
    padding: 1rem;
    color: var(--nebula-cyan);
    font-size: 0.9rem;
}

.spinner-upload {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(124, 58, 237, 0.3);
    border-top-color: var(--nebula-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── RESPONSIVE CAROUSEL ───────────────────────────────── */
@media (max-width: 768px) {
    .imagens-preview-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .crop-modal-container {
        padding: 1rem;
    }

    .carousel-seta {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .crop-preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .imagens-preview-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .carousel-seta {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .crop-preset-buttons {
        grid-template-columns: 1fr;
    }
}
