form {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    flex: 1;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;

    /* Estado Inicial: Invisível */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-container {
    background: white;
    width: 100%;
    max-width: 750px;
    max-height: 90vh;
    border-radius: 18px;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Animação do Container (Opcional: um leve 'pop' de escala) */
.modal-container {
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-container {
    transform: scale(1);
}


/* HEADER */
.modal-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
}

.modal-header h2 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.01em;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.0625rem;
    font-weight: 700;
    color: #0f172a;
}

.modal-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* BODY */
.modal-body {
    padding: 30px 30px 30px 30px;
    overflow-y: auto;
}

/* Estado Ativo: Visível */
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}


/* Seções do Formulário */
.form-section-default {
    margin-bottom: 1.25rem;
}

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

.section-title-modal {
    font-size: 1rem;
    font-weight: 600;
    color: #2E86AB;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title-modal::after,
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #f1efef;
}

.form-grid-default {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.25rem;
    align-items: flex-end;
}

.form-grid-8 {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1.25rem;
    align-items: flex-end;
}

.column-6 {
    grid-column: span 6;
}

.column-4 {
    grid-column: span 4;
}

.column-3 {
    grid-column: span 3;
}

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

/* INPUT */
.input-group-default {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group-default label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}

/* Estilos de input/select/textarea definidos globalmente em form-controls.css */





/* FOOTER */
.modal-footer {
    padding: 1.5rem 2.5rem;
    border-top: 1px solid #E9ECEF;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: #f8fafc;
}

/* ACTIONSBUTTONS */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.action-btn.view {
    background: #E3F2FD;
    color: #2E86AB;
}

.action-btn.edit {
    background: #FFF3E0;
    color: #F57C00;
}

.action-btn.delete {
    background: #FFEBEE;
    color: #D32F2F;
}

.action-btn.activate {
    background: #E8F5E9;
    color: #2E7D32;
}

.action-btn.restock {
    background: #E8F5E8;
    color: #28A745;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}



/* Scrollbar Customizada */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Responsive */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        margin: 20px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}