/*
 * Produto Form - Custom CSS
 * Melhorias UX para formulário de produto com layout responsivo
 */

/* ===== LAYOUT RESPONSIVO ===== */
.produto-form-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.produto-form-left {
    flex: 1;
    min-width: 0; /* Permite flexbox wrap */
}

.produto-form-right {
    flex: 0 0 400px;
    min-width: 400px;
}

/* Mobile First - Em telas pequenas volta ao layout vertical */
@media (max-width: 991.98px) {
    .produto-form-container {
        flex-direction: column;
        gap: 1.5rem;
    }

    .produto-form-right {
        flex: 1;
        min-width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .produto-form-container {
        gap: 1rem;
    }
}

/* ===== DROPZONE MELHORADO ===== */
.dropzone-enhanced {
    border: 2px dashed #d0d7de;
    border-radius: 12px;
    background: #f8f9fc;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.dropzone-enhanced:hover {
    border-color: #007bff;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.dropzone-enhanced.dz-drag-hover {
    border-color: #28a745;
    background: #f0fff4;
    transform: scale(1.02);
}

.dropzone-enhanced .dz-message {
    margin: 0;
    font-size: 16px;
    color: #6c757d;
    transition: all 0.3s ease;
}

.dropzone-enhanced .dz-message .upload-icon {
    font-size: 3rem;
    color: #007bff;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.dropzone-enhanced:hover .dz-message .upload-icon {
    color: #0056b3;
    transform: scale(1.1);
}

.dropzone-enhanced .dz-message h6 {
    margin: 0.5rem 0;
    font-weight: 600;
    color: #495057;
}

.dropzone-enhanced .dz-message small {
    color: #6c757d;
    font-size: 0.875rem;
}

/* ===== PREVIEW DE IMAGENS MELHORADO ===== */
.dropzone-enhanced .dz-preview {
    position: relative;
    display: inline-block;
    margin: 0.5rem;
    vertical-align: top;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 110px;
}

/* ===== GRID LAYOUT PARA IMAGENS ===== */
.dropzone-enhanced .dz-preview-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
}

.dropzone-enhanced.dz-started {
    min-height: 320px;
}

.dropzone-enhanced.dz-started .dz-message {
    display: block;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.dropzone-enhanced.dz-started .dz-message .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.dropzone-enhanced.dz-started .dz-message h6 {
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.dropzone-enhanced.dz-started .dz-message small {
    font-size: 0.75rem;
}

.dropzone-enhanced .dz-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.dropzone-enhanced .dz-preview .dz-image {
    border-radius: 6px;
    overflow: hidden;
    width: 100px;
    height: 100px;
    position: relative;
    display: block;
    margin: 0 auto;
}

.dropzone-enhanced .dz-preview .dz-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropzone-enhanced .dz-preview .dz-details {
    opacity: 1;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 6px;
    font-size: 0.75rem;
}

.dropzone-enhanced .dz-preview:hover .dz-details {
    opacity: 1;
}

.dropzone-enhanced .dz-preview .dz-filename {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    text-align: center;
    color: #495057;
    word-wrap: break-word;
    max-width: 100px;
}

.dropzone-enhanced .dz-preview .dz-size {
    font-size: 0.7rem;
    color: #6c757d;
    text-align: center;
}

/* ===== PROGRESS BAR MELHORADA ===== */
.dropzone-enhanced .dz-preview .dz-progress {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.dropzone-enhanced .dz-preview .dz-progress .dz-upload {
    background: linear-gradient(90deg, #007bff, #28a745);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* ===== BOTÕES DE AÇÃO MELHORADOS ===== */
.dropzone-enhanced .dz-preview .dz-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: 2px solid white;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 10;
}

.dropzone-enhanced .dz-preview .dz-remove:hover {
    background: #c82333;
    transform: scale(1.1);
    text-decoration: none;
    color: white;
}

/* ===== STATUS VISUAL ===== */
.dropzone-enhanced .dz-preview.dz-success .dz-image::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #28a745;
    font-size: 2rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: successPulse 0.6s ease-out;
}

.dropzone-enhanced .dz-preview.dz-error .dz-image::after {
    content: '\2717';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #dc3545;
    font-size: 2rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: errorShake 0.6s ease-out;
}

/* ===== ANIMAÇÕES ===== */
@keyframes successPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes errorShake {
    0%, 100% {
        opacity: 0;
        transform: translate(-50%, -50%);
    }
    20%, 60% {
        opacity: 1;
        transform: translate(-52%, -50%);
    }
    40%, 80% {
        opacity: 1;
        transform: translate(-48%, -50%);
    }
}

.dropzone-enhanced .dz-preview {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== IMAGENS EXISTENTES MELHORADAS ===== */
.imagens-existentes-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.imagens-existentes-container h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.imagens-existentes-container h6::before {
    content: '\f03e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #007bff;
}

.imagem-existente-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: white;
}

.imagem-existente-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.imagem-existente-card img {
    transition: transform 0.3s ease;
}

.imagem-existente-card:hover img {
    transform: scale(1.05);
}

.imagem-existente-card .card-body {
    background: white;
    border-top: 1px solid #e9ecef;
}

.btn-remover-imagem {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-remover-imagem:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* ===== UPLOAD AREA RESPONSIVA ===== */
.upload-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.upload-section-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.upload-section-title::before {
    content: '\f03e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #007bff;
    font-size: 1.2rem;
}

/* ===== ESTADOS DE LOADING ===== */

.upload-counter {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== MELHORIAS GERAIS ===== */
.form-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
}

.section-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

/* ===== TABLETS ===== */
@media (max-width: 1199.98px) {
    .produto-form-right {
        flex: 0 0 350px;
        min-width: 350px;
    }

    .upload-section {
        position: static;
    }

    .dropzone-enhanced .dz-preview {
        width: 100px;
    }

    .dropzone-enhanced .dz-preview .dz-image {
        width: 90px;
        height: 90px;
    }
}

/* ===== TABLET PORTRAIT ===== */
@media (max-width: 991.98px) {
    .upload-section {
        margin-top: 0;
    }

    .dropzone-enhanced {
        min-height: 250px;
    }

    .dropzone-enhanced.dz-started {
        min-height: 280px;
    }

    .dropzone-enhanced .dz-preview {
        width: 90px;
    }

    .dropzone-enhanced .dz-preview .dz-image {
        width: 80px;
        height: 80px;
    }
}

/* ===== MOBILE ===== */
@media (max-width: 576px) {
    .dropzone-enhanced {
        min-height: 200px;
        padding: 1.5rem 1rem;
    }

    .dropzone-enhanced.dz-started {
        min-height: 240px;
    }

    .dropzone-enhanced .dz-preview {
        width: 80px;
        margin: 0.25rem;
    }

    .dropzone-enhanced .dz-preview .dz-image {
        width: 70px;
        height: 70px;
    }

    .dropzone-enhanced .dz-preview-container {
        gap: 0.25rem;
    }
}

/* ===== ANIMAÇÕES ADICIONAIS ===== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== ESTADOS DE LOADING MELHORADOS ===== */
.upload-success {
    animation: successPulse 0.6s ease-out;
}

.dz-uploading {
    opacity: 0.7;
}

.dz-uploading .dz-progress {
    opacity: 1;
}

/* ===== MELHORIAS NOS BOTÕES ===== */
.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-lg:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary.btn-lg {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
}

.btn-primary.btn-lg:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
}

/* ===== RESPONSIVIDADE DOS BOTÕES ===== */
@media (max-width: 576px) {
    .btn-lg {
        padding: 0.6rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-lg.mr-3 {
        margin-right: 0 !important;
    }
}