/* ==========================================================================
   1. BOTÃO DISCRETO NO EDITOR (VARINHA MÁGICA)
   ========================================================================== */
.btn-wizard-magic {
    padding: 0 10px !important;
    height: 24px !important;
    line-height: 24px !important;
    vertical-align: middle !important;
    background: #f8fafc !important;
    border: 1px solid #c2c7cc !important;
    color: #5865F2 !important;
    border-radius: 4px !important;
    margin: 0 2px !important;
}

.btn-wizard-magic:hover {
    border-color: #5865F2 !important;
    background: #eff6ff !important;
    box-shadow: 0 0 5px rgba(88, 101, 242, 0.3);
}

/* ==========================================================================
   2. ESTRUTURA E OVERLAY DO MODAL
   ========================================================================== */
.dw-modal-overlay {
    display: none; 
    position: fixed;
    z-index: 100000 !important;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.dw-modal-container {
    background: #fff;
    width: 90%;
    max-width: 1000px;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    font-family: "Open Sans", "Segoe UI", Tahoma, sans-serif;
    animation: dwFadeIn 0.3s ease-out;
}

@keyframes dwFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.dw-modal-header {
    background: #1e293b;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dw-title { display: flex; align-items: center; gap: 10px; }
.dw-title h2 { color: #fff !important; margin: 0 !important; font-size: 18px !important; font-weight: 600 !important; }
.dw-close-btn { cursor: pointer; font-size: 24px; opacity: 0.7; transition: 0.2s; }
.dw-close-btn:hover { opacity: 1; color: #ef4444; }

.dw-step-content { padding: 25px; }
.dw-editor-grid { display: flex; gap: 20px; margin: 20px 0; }
.dw-editor-box { flex: 1; position: relative; }

/* FIX: Prendendo o estilo do textarea apenas ao Modal */
#diff-wizard-modal .dw-editor-box textarea {
    width: 100% !important; 
    height: 350px !important;
    font-family: "JetBrains Mono", "Consolas", monospace !important;
    font-size: 13px !important; 
    padding: 15px !important;
    border: 1.5px solid #e2e8f0 !important; 
    border-radius: 8px !important;
    box-sizing: border-box !important; 
    resize: none !important;
    line-height: 1.5 !important;
}

/* ==========================================================================
   3. VISUALIZAÇÃO DO DIFF NO MODAL
   ========================================================================== */
.dw-preview-area {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-bottom: 5px;
}

.dw-diff-view {
    background: #f8fafc;
    color: #1e293b;
    margin: 0 !important;
    padding: 15px !important;
    max-height: 400px;
    overflow-y: auto;
    font-family: "JetBrains Mono", monospace !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
}

.dw-diff-added { 
    display: block;
    background-color: #ecfdf5 !important; 
    color: #065f46 !important; 
    border-left: 4px solid #10b981;
    padding-left: 10px;
}

.dw-diff-removed { 
    display: block;
    background-color: #fef2f2 !important; 
    color: #991b1b !important; 
    border-left: 4px solid #ef4444;
    padding-left: 10px;
}

.dw-diff-header { 
    display: block;
    background-color: #eff6ff !important; 
    color: #1e40af !important; 
    font-weight: 600;
    padding-left: 10px;
}

/* ==========================================================================
   4. ESTILIZAÇÃO DOS BOTÕES E CONTAINERS
   ========================================================================== */
.dw-label-container {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dw-label-tag {
    position: static !important; /* Garantindo que não flutue fora do container */
    font-size: 10px; 
    font-weight: bold; 
    padding: 2px 8px; 
    border-radius: 4px; 
    text-transform: uppercase;
}

.tag-orig { background: #ffebe9; color: #cf222e; }
.tag-mod { background: #dafbe1; color: #1a7f37; }

.dw-btn-upload {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.dw-btn-upload:hover { background: #e2e8f0; color: #1e293b; border-color: #94a3b8; }

.dw-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none !important;
    text-shadow: none !important;
}

.dw-btn-next, .dw-btn-attach { background: #16a34a !important; color: #ffffff !important; }
.dw-btn-next:hover, .dw-btn-attach:hover { background: #15803d !important; transform: translateY(-1px); }

.dw-btn-back { background: #f1f5f9 !important; color: #475569 !important; border: 1px solid #cbd5e1 !important; }
.dw-btn-back:hover { background: #e2e8f0 !important; }

.dw-btn-copy { background: #2563eb !important; color: #fff !important; }
.dw-btn-copy:hover { background: #1d4ed8 !important; }

.dw-btn:active { transform: scale(0.96); }

.dw-modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 15px 25px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}
.dw-space-between { justify-content: space-between; }

/* ==========================================================================
   5. MODO ESCURO (DARK MODE)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .dw-modal-container { background: #0f172a; color: #f1f5f9; }
    .dw-modal-header { background: #020617; }
    .dw-modal-footer, .dw-diff-view { background: #1e293b; border-color: #334155; }
    #diff-wizard-modal textarea { background: #020617 !important; border-color: #334155 !important; color: #f1f5f9 !important; }
    
    .dw-diff-view { background: #020617 !important; color: #94a3b8 !important; }
    .dw-diff-added { background-color: rgba(16, 185, 129, 0.1) !important; color: #34d399 !important; }
    .dw-diff-removed { background-color: rgba(239, 68, 68, 0.1) !important; color: #f87171 !important; }
    .dw-diff-header { background-color: rgba(59, 130, 246, 0.1) !important; color: #60a5fa !important; }

    .dw-btn-back { background: #334155 !important; color: #f1f5f9 !important; border-color: #475569 !important; }
}