/**
 * Modal System - Becoming
 * Sistema de modais genérico e reutilizável
 * 
 * Classes disponíveis:
 * - .bc-modal-overlay: Container overlay
 * - .bc-modal: Container do modal
 * - .bc-modal-sm, .bc-modal-md, .bc-modal-lg: Tamanhos
 * - .bc-modal-header, .bc-modal-body, .bc-modal-footer: Seções
 */

/* ========================================
   OVERLAY
   ======================================== */

.bc-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    z-index: 2147483647 !important;
    backdrop-filter: blur(2px);
    padding: 20px;
    box-sizing: border-box;
    margin: 0 !important;
    overflow: auto;
}

.bc-modal-overlay.show {
    display: flex !important;
}

/* Regra específica para qualquer overlay de modal (por ID) */
[id$="-overlay"].bc-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
}

[id$="-overlay"].bc-modal-overlay.show {
    display: flex !important;
}

/* ========================================
   MODAL CONTAINER
   ======================================== */

.bc-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: bc-modal-in 0.2s ease-out;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    margin: 0 !important;
    position: relative;
    flex-shrink: 0;
}

/* Tamanhos */
.bc-modal-sm {
    max-width: 360px;
}

.bc-modal-md {
    max-width: 480px;
}

.bc-modal-lg {
    max-width: 640px;
}

.bc-modal-xl {
    max-width: 900px;
}

.bc-modal-full {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
}

/* Animação de entrada */
@keyframes bc-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Animação de saída */
.bc-modal-overlay.closing .bc-modal {
    animation: bc-modal-out 0.15s ease-in forwards;
}

@keyframes bc-modal-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
}

/* ========================================
   HEADER
   ======================================== */

.bc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.bc-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.bc-modal-title i {
    color: #004778;
}

.bc-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #9CA3AF;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
    border-radius: 4px;
}

.bc-modal-close:hover {
    color: #EF4444;
    background: #FEF2F2;
}

/* ========================================
   BODY
   ======================================== */

.bc-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.bc-modal-body-compact {
    padding: 16px 24px;
}

/* ========================================
   FOOTER
   ======================================== */

.bc-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #E5E7EB;
    background: #F9FAFB;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.bc-modal-footer-left {
    justify-content: flex-start;
}

.bc-modal-footer-center {
    justify-content: center;
}

.bc-modal-footer-between {
    justify-content: space-between;
}

/* ========================================
   BOTÕES
   ======================================== */

.bc-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
    text-decoration: none;
    border: 2px solid transparent;
}

.bc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Secundário (outline) */
.bc-btn-secondary {
    background: #FFFFFF;
    border-color: #D1D5DB;
    color: #374151;
}

.bc-btn-secondary:hover:not(:disabled) {
    background: #F3F4F6;
    border-color: #9CA3AF;
}

/* Primário */
.bc-btn-primary {
    background: linear-gradient(135deg, #004778 0%, #003d66 100%);
    border-color: transparent;
    color: #FFFFFF;
}

.bc-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #003d66 0%, #002d4d 100%);
    box-shadow: 0 4px 12px rgba(0, 71, 120, 0.3);
}

/* Sucesso */
.bc-btn-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: transparent;
    color: #FFFFFF;
}

.bc-btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* Perigo */
.bc-btn-danger {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    border-color: transparent;
    color: #FFFFFF;
}

.bc-btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #B91C1C 0%, #991B1B 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Tamanhos */
.bc-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.bc-btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Loading state */
.bc-btn .bc-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: bc-btn-spin 0.8s linear infinite;
    display: none;
}

.bc-btn.loading .bc-btn-spinner {
    display: block;
}

.bc-btn.loading .bc-btn-text {
    display: none;
}

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

/* ========================================
   FORMULÁRIOS DENTRO DO MODAL
   ======================================== */

.bc-form-group {
    margin-bottom: 20px;
}

.bc-form-group:last-child {
    margin-bottom: 0;
}

.bc-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.bc-form-label .bc-required {
    color: #EF4444;
}

.bc-form-input {
    width: 100%;
    height: 44px;
    padding: 10px 14px;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
    color: #1F2937;
    transition: all 0.2s;
    box-sizing: border-box;
}

.bc-form-input:focus {
    outline: none;
    border-color: #004778;
    box-shadow: 0 0 0 3px rgba(0, 71, 120, 0.15);
}

.bc-form-input::placeholder {
    color: #9CA3AF;
}

.bc-form-input.bc-input-error {
    border-color: #EF4444;
    background: #FEF2F2;
}

.bc-form-input.bc-input-success {
    border-color: #10B981;
    background: #ECFDF5;
}

.bc-form-textarea {
    min-height: 100px;
    resize: vertical;
}

.bc-form-error {
    display: none;
    font-size: 12px;
    color: #EF4444;
    margin-top: 4px;
}

.bc-form-group.has-error .bc-form-error {
    display: block;
}

.bc-form-hint {
    font-size: 12px;
    color: #6B7280;
    margin-top: 4px;
}

/* ========================================
   ALERTAS DENTRO DO MODAL
   ======================================== */

.bc-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.bc-alert i {
    flex-shrink: 0;
    margin-top: 2px;
}

.bc-alert-info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

.bc-alert-success {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.bc-alert-warning {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    color: #92400E;
}

.bc-alert-danger {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}
