/**
 * ===================================================================
 * 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 */
.form-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.form-section {
    margin-bottom: 32px;
}

.form-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

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

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 10px;
}

.form-input,
.form-select,
.form-textarea {
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    font-size: 14px;
    color: #fff;
    transition: all 0.3s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1);
}

.form-textarea {
    resize: vertical;
    font-family: inherit;
}

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

/* Tabelas */
.table-responsive {
    overflow-x: auto;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

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

.data-table thead {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-primary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* Botões */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--secondary);
    color: white;
}

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

.btn-outline:hover {
    background: #f8fafc;
}

.btn-icon {
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--primary);
}

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

.btn-icon.btn-whatsapp:hover {
    color: #25d366;
}

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

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.page-header p {
    color: var(--text-light);
    margin: 4px 0 0 0;
}

/* Filtros */
.filters-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Lead specific */
.lead-name {
    font-weight: 600;
    color: var(--text);
}

.lead-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.temperature-badge {
    font-size: 13px;
    font-weight: 600;
}

.score-badge {
    display: inline-block;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 8px;
    font-weight: 700;
}

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

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

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

.details-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
}

.detail-value {
    font-weight: 600;
    color: var(--text);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.stat-item i {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-item div {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.stat-item span {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

/* 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 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease-out;
}

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

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

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

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

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}

/* 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;
}

/* Responsividade Enterprise */
@media (max-width: 1200px) {
    .calendar-days {
        grid-template-columns: repeat(7, minmax(100px, 1fr));
        overflow-x: auto;
    }
    
    .calendar-controls {
        flex-direction: column;
        gap: 20px;
    }
}
