/**
 * ===================================================================
 * A.S CRM PRO v7.0.0 - ESTILOS COMPLEMENTARES
 * ===================================================================
 /* Estilos para formulários, tabelas, cards e componentes
 * ===================================================================
 */

/* Mobile Global Fixes */
@media (max-width: 768px) {
    .form-card { padding: 20px; }
    .form-actions { flex-direction: column-reverse; gap: 10px; }
    .form-actions .btn { width: 100%; }
    .modal-content { width: 95% !important; margin: 10px auto; }
    .table-responsive { border: none; box-shadow: none; margin: 0 -20px; width: calc(100% + 40px); }
    .data-table th, .data-table td { padding: 12px 10px; font-size: 13px; }
    
    /* Kanban Mobile */
    .kanban-board { flex-direction: column; overflow-x: hidden; gap: 20px; }
    .kanban-column { min-width: 100% !important; width: 100% !important; }
}

/* Formulários Tech */
.form-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.form-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.form-section h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.form-section h3::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--primary);
    border-radius: 4px;
}

.form-group label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.form-input,
.form-select,
.form-textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    background-color: var(--bg);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Tabelas Minimalistas */
.table-responsive {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.data-table th {
    background: var(--bg);
    padding: 14px 20px;
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13.5px;
    font-weight: 600;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--surface-hover);
}

/* Badges Modernas */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Botões High-Tech */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1.5px solid var(--border);
    color: #64748b;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md);
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px) scale(1.05);
}

/* Módulo Geral Layout Profissional - Redesenhado para ser mais Moderno */
.module-propostas, .module-leads, .module-vendas {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.4s ease-out;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    margin-bottom: 8px;
}

.header-left h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.header-left h2 i {
    color: var(--primary);
}

.header-left .subtitle {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

/* Stats Row em Módulos */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 8px;
}

/* Filtros em Módulos - Estilo Barra Superior */
.filters-section {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    align-items: end;
}

@media (max-width: 1400px) {
    .filters-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
    .filters-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
    .filters-row { grid-template-columns: 1fr; }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group input, .filter-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    transition: var(--transition);
}

.filter-group input:focus, .filter-group select:focus {
    border-color: var(--primary);
    background: var(--surface);
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Empty State Moderno */
.empty-state {
    padding: 80px 40px;
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
}

/* Lista de Vendas/Leads */
.vendas-list, .leads-list, .propostas-list {
    margin-top: 8px;
}

.table-responsive {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg);
    padding: 16px 20px;
    text-align: left;
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--surface-hover);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-icon-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-light);
}

/* Paginação */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.pagination {
    display: flex;
    gap: 8px;
}

.pagination .btn {
    min-width: 40px;
    height: 40px;
    padding: 0;
}

.pagination .btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* IA Results */
.ia-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.ia-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.ia-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.ia-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}

.score-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
}

.recommendation {
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.rec-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.rec-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-box {
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.message-box strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
}

.message-box p {
    margin: 0;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .form-grid,
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .details-grid,
    .ia-results {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .table-responsive {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }
}

/* Loading */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Empty State */
.empty-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-message i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-message h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-message p {
    margin-bottom: 24px;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.product-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

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

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.product-operadora {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.product-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.product-info {
    margin-bottom: 20px;
}

.product-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.product-price-label {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
}

.product-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.product-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
}

.product-detail-item i {
    width: 16px;
    color: var(--text-light);
}

.product-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

.text-muted {
    color: var(--text-light);
    line-height: 1.6;
}

/* Modal Base Refinado */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 850px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    background: var(--white);
}

/* Form Grid System */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    transition: var(--transition);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--primary);
    background: var(--white);
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-group .btn-icon {
    flex-shrink: 0;
    height: 44px;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Calculation Results Style */
.calculation-result {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 10px 0;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.result-item span {
    font-size: 11px;
    font-weight: 800;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-item strong {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
}

@media (max-width: 768px) {
    .col-6, .col-4, .col-8 { grid-column: span 12; }
    .modal-content { max-height: 100vh; border-radius: 0; }
}

/* Templates de Automação */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.template-card {
    background: white;
    border: 2px solid #f1f5f9;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.template-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #eff6ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.template-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}

.template-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

/* Estilos de Importação XLSX */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.2s;
    cursor: pointer;
    margin: 20px 0;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-area i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
    opacity: 0.7;
}

.preview-table {
    font-size: 12px;
}

.preview-table th {
    padding: 8px 12px;
}

.preview-table td {
    padding: 8px 12px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.success-results {
    padding: 20px;
    background: #f0fdf4;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.success-results h4 {
    color: #166534;
    margin-bottom: 16px;
}

.error-log {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.error-log h5 {
    color: #991b1b;
    margin-bottom: 8px;
}

.scroll-area {
    max-height: 200px;
    overflow-y: auto;
    font-size: 13px;
    color: #b91c1c;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* Loading Spinner */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.fa-circle-notch {
    animation: fa-spin 1s linear infinite;
}

/* Responsive Grid Adjustments */
@media (max-width: 1200px) {
    .module-propostas, .module-leads, .module-vendas {
        grid-template-columns: 1fr;
    }
    .stats-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        position: static;
        order: -1;
    }
}

/* Empty States */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    background: white;
    border-radius: 16px;
    border: 1px dashed var(--border);
}

.empty-state i {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.empty-state p {
    color: #64748b;
    font-size: 14px;
}
