/* Controle de Débitos - Premium Styles */

.debitos-filters-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input-group {
    flex: 1;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-group i {
    position: absolute;
    left: 15px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.search-input-group input {
    width: 100%;
    padding: 10px 15px 10px 42px !important;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.search-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.2);
}

.status-select {
    width: auto;
    min-width: 200px;
}

.debitos-flex-gap {
    display: flex;
    gap: 15px;
}

.debitos-flex-1 {
    flex: 1;
}

.debitos-modal-large {
    max-width: 600px;
    width: 95%;
}

.info-conta-box {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Filtros Avançados */
.debitos-filters-grid {
    background: rgba(0, 0, 0, 0.15);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-filter-tag {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-filter-tag:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}
.btn-filter-tag.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content.glass-modal {
    background: rgba(30, 39, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 0; /* Padding movido para header/body/footer para melhor controle */
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Para caber na tela inteira, se necessário */
    overflow: hidden;
}

.modal-overlay.hidden .modal-content {
    transform: translateY(-20px);
}

.modal-body {
    padding: 20px;
}

.modal-body-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-dim, #999);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.btn-close-modal:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

/* Dashboard V2 */
.debitos-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.dash-card {
    background: rgba(30, 39, 46, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.dash-icon {
    font-size: 1.75rem;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 12px;
}

.dash-info h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #fff;
    font-weight: 700;
}

.dash-info p {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* Badges e Score */
.score-stars {
    color: #ffd700;
    font-size: 0.8rem;
    letter-spacing: 2px;
}
.score-stars.score-low {
    color: #ff4757;
}

/* Progress Bar */
.progress-container {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    height: 8px;
    width: 100%;
    margin-top: 5px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
}
.progress-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: block;
    margin-top: 2px;
}

/* Timeline */
.debitos-timeline {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid rgba(255,255,255,0.1);
}
.timeline-item {
    position: relative;
    margin-bottom: 20px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}
.timeline-item.atraso::before {
    background: var(--danger);
}
.timeline-date {
    font-size: 0.8rem;
    color: var(--text-dim);
}
.timeline-content {
    background: rgba(0,0,0,0.2);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 5px;
}

/* Tabs Internas do Modal */
.debitos-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}
.d-tab {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.3s;
}
.d-tab:hover {
    background: rgba(255,255,255,0.05);
}
.d-tab.active {
    color: #fff;
    background: rgba(0, 168, 132, 0.2);
    font-weight: bold;
}

/* Ações Rapidas */
.btn-action-icon {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-dim);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    margin: 0 2px;
}
.btn-action-icon:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.btn-action-icon.whatsapp:hover { color: #25D366; border-color: #25D366; }
.btn-action-icon.receber:hover { color: var(--success); border-color: var(--success); }

/* V4: Dropdown para Ações (WhatsApp/Imprimir) */
.debitos-dropdown {
    position: relative;
    display: inline-block;
}

.debitos-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    bottom: 100%;
    background-color: #1e272e;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 100;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
}

.debitos-dropdown:hover .debitos-dropdown-content {
    display: block;
}

.debitos-dropdown-content a {
    color: var(--text);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.debitos-dropdown-content a:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--primary);
}

.debitos-dropdown-content a i {
    width: 20px;
    text-align: center;
}

/* V4: Classes Auxiliares e Refatoração Inline CSS */
.text-orange { color: #ff9f43; }
.bg-orange { background: #ff9f43 !important; color: white !important; }
.filter-row-1 { display: flex; gap: 15px; margin-bottom: 15px; }
.filter-row-2 { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.filter-group-buttons { display: flex; gap: 5px; flex-wrap: wrap; }
.filter-group-buttons.ml-10 { margin-left: 10px; }
.filter-values { display: flex; gap: 10px; align-items: center; }
.input-w-120 { width: 125px !important; max-width: 125px; flex-shrink: 0; font-size: 0.85rem !important; }
.alertas-container { display: flex; gap: 10px; flex-wrap: wrap; }
.bg-readonly { background: rgba(0,0,0,0.1) !important; }
.total-input { font-size: 1.2rem; }
.chart-container-card { background: rgba(30, 39, 46, 0.5); padding: 15px; border-radius: 12px; height: 100%; border: 1px solid rgba(255, 255, 255, 0.05); }
.chart-col-1 { width: 40px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.chart-col-2 { flex: 1; height: 100%; position: relative; }
.chart-bar-bg { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 4px; }
.chart-bar-fill.bg-success { background: var(--success); }
.chart-bar-fill.bg-warning { background: var(--warning); }
.chart-bar-fill.bg-danger { background: var(--danger); }
.chart-bar-fill.bg-primary { background: var(--primary); }

/* Classes Utilitárias Globais Locais */
.flex { display: flex; }
.gap-10 { gap: 10px; }
.align-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }

/* Novas classes para substituir inline no modal */
.modal-form-flex {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-actions-fixed {
    padding: 0 20px 20px 20px;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.modal-header-flex { align-items: flex-start; }
.score-badge-container { display: flex; gap: 15px; align-items: center; background: rgba(0,0,0,0.2); padding: 5px 15px; border-radius: 20px; }
.score-stars-large { font-size: 1.2rem; }
.modal-body-scroll { max-height: 80vh; overflow-y: auto; }
.modal-topo-info { align-items: center; }
.dropdown-print { margin-left: 20px; }
.btn-print { padding: 10px 15px; }
.dropdown-print-content { text-align: left; right: 0; }
.doc-upload-form { gap: 10px; margin-bottom: 20px; }
.chart-container-card { padding: 20px; }
.chart-flex-wrap { gap: 40px; align-items: center; flex-wrap: wrap; }
.chart-col-1 { min-width: 300px; }
.chart-progress-bg { height: 12px; background: rgba(0,0,0,0.3); }
.chart-col-2 { min-width: 250px; border-left: 1px solid rgba(255,255,255,0.1); padding-left: 20px; }
.avatar-placeholder { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; }
.avatar-img { width: 40px; height: 40px; border-radius: 50%; }
.btn-expand { background: transparent; border: none; color: var(--text-dim); }
.table-cell-overflow { white-space: nowrap; overflow: visible; }
.table-dropdown-content { text-align: left; }
.expand-row-bg { background: rgba(0,0,0,0.15); }
.expand-row-cell { padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.expand-row-flex { gap: 20px; }
.obs-interna-box { background: rgba(255,193,7,0.1); border-left: 3px solid var(--warning); border-radius: 4px; }
.ascii-progress-text { letter-spacing: 1px; color: var(--primary); font-size: 0.9rem; }

/* Estilização Premium para Botões e Modais de Crediário */
.btn-primary {
    background: var(--premium-gradient, linear-gradient(135deg, #00a884, #008f70)) !important;
    color: white !important;
    border: none !important;
    padding: 10px 22px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0, 168, 132, 0.2) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    height: 40px !important;
}

.btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 168, 132, 0.4) !important;
    filter: brightness(1.1) !important;
}

/* Melhorias gerais nos campos de texto e selects do Modal */
.glass-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), 
.glass-modal select {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    color: #fff !important;
    padding: 10px 14px !important;
    font-size: 0.85rem !important;
    height: 40px !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
}

.glass-modal input:focus, 
.glass-modal select:focus {
    border-color: var(--primary, #00a884) !important;
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15) !important;
    background: rgba(0, 0, 0, 0.5) !important;
    outline: none !important;
}

.glass-modal label {
    display: block !important;
    margin-bottom: 6px !important;
    font-size: 0.8rem !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* Alinhamento e visual dos botões no rodapé dos modais */
.modal-actions {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 25px !important;
    padding: 15px 20px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    background: rgba(0, 0, 0, 0.15) !important;
    border-radius: 0 0 12px 12px !important;
}

.modal-actions .btn-outline {
    height: 40px !important;
    padding: 0 20px !important;
    font-size: 0.85rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Espaçamento e Respiro Premium (Spacing & Margins) - Ajustado para um equilíbrio perfeito */
.glass-modal .modal-header {
    padding: 15px 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.glass-modal .modal-body {
    padding: 15px 20px !important;
}

.glass-modal .input-group {
    margin-bottom: 12px !important;
}

.glass-modal .debitos-flex-gap {
    margin-bottom: 12px !important;
    gap: 12px !important; /* Espaço moderado entre colunas */
}

/* Ajustes no botão Simular Parcelas */
.glass-modal button[onclick="DebitosUI.simularParcelas()"] {
    margin-top: 3px !important;
    margin-bottom: 10px !important;
    height: 40px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.glass-modal button[onclick="DebitosUI.simularParcelas()"]:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Correções para o modal de carrinho da vitrine para telas menores (Scroll & Altura) */
.cart-modal-content {
    max-height: 95vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.cart-modal-body {
    overflow-y: auto !important;
    flex: 1 !important;
    min-height: 0 !important;
}





