:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    text-align: center;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.logo-icon i {
    font-size: 28px;
    color: white;
}

.sidebar-header h3 {
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.sidebar-header p {
    color: var(--gray);
    font-size: 13px;
    margin: 4px 0 0;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: var(--transition);
    cursor: pointer;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item i {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-save-all {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save-all:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    position: relative;
}

.content-sections {
    max-width: 1200px;
    margin: 0 auto;
}

.content-section {
    display: none;
    animation: slideIn 0.4s ease;
}

.content-section.active {
    display: block;
}

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

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: var(--primary);
    font-size: 28px;
}

.section-header p {
    color: var(--gray);
    font-size: 14px;
    margin: 0;
}

.card-modern {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card-modern:hover {
    box-shadow: var(--shadow-xl);
}

/* CNPJ Search */
.cnpj-search-container {
    margin-bottom: 32px;
    position: relative;
}

.input-group-cnpj {
    position: relative;
    max-width: 400px;
}

.form-control-modern {
    width: 100%;
    padding: 16px 20px;
    padding-left: 50px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    background: white;
    font-family: 'Inter', sans-serif;
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 20px;
}

.loading-spinner {
    display: none;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    color: var(--primary);
    font-weight: 500;
}

.loading-spinner.active {
    display: flex;
}

.spinner-grow-custom {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Form Groups */
.form-group-modern {
    margin-bottom: 0;
}

.form-group-modern label {
    display: block;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group-modern .form-control-modern {
    width: 100%;
}

/* Upload Cards */
.upload-card {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    background: white;
}

.upload-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.upload-card.has-image {
    border-style: solid;
    border-color: var(--success);
    background: #f0fdf4;
}

.upload-header {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 1px solid var(--border);
}

.upload-header i {
    font-size: 20px;
    color: var(--primary);
}

.upload-body {
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.upload-body:hover {
    background: #f8fafc;
}

.upload-icon {
    font-size: 48px;
    color: var(--gray);
    display: block;
    margin-bottom: 16px;
}

.upload-text {
    font-weight: 500;
    color: var(--dark);
    margin: 0;
}

.upload-hint {
    color: var(--gray);
    font-size: 12px;
    margin: 4px 0 0;
}

.upload-body img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
}

/* Botão Adicionar */
.btn-add-modern {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-add-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Conta Bancária Card */
.conta-card {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    animation: slideIn 0.3s ease;
}

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

.conta-titulo {
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-remove-card {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--danger);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove-card:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Referência Card */
.referencia-card {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fbbf24;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    animation: slideIn 0.3s ease;
}

/* Action Buttons */
.action-buttons {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

.btn-action {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.btn-action:hover {
    transform: translateY(-3px) scale(1.05);
}

.btn-action i {
    font-size: 24px;
    margin-bottom: 2px;
}

.btn-action span {
    font-size: 10px;
}

.btn-pdf {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-image {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-clear {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* Modal */
.modal-header.bg-gradient {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

/* Responsivo */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .action-buttons {
        bottom: 20px;
        right: 20px;
    }
    
    .btn-action {
        width: 50px;
        height: 50px;
    }
    
    .btn-action i {
        font-size: 20px;
    }
}

/* Estilos para campos preenchidos */
.campo-preenchido {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Progress Bar */
.progress {
    background: #e2e8f0;
    overflow: hidden;
}

.progress-bar.bg-gradient {
    background: linear-gradient(90deg, #10b981, #059669) !important;
    transition: width 0.5s ease;
}

/* Feedback de busca */
.cnpj-search-container .form-control-modern.searching {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2) !important;
}

.cnpj-search-container .form-control-modern.success {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

.cnpj-search-container .form-control-modern.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* Upload Cards - Melhorias */
.upload-card {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.upload-card:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    transform: translateY(-2px);
}

.upload-card.has-image {
    border-color: #10b981;
    border-style: solid;
    background: #f0fdf4;
}

.upload-card.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.02);
}

.upload-body {
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-icon {
    font-size: 48px;
    color: #9ca3af;
    margin-bottom: 12px;
    transition: all 0.3s;
}

.upload-card:hover .upload-icon {
    color: #3b82f6;
    transform: scale(1.1);
}

.upload-text {
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: #9ca3af;
}

/* Preview da imagem */
.preview-container {
    position: relative;
    width: 100%;
    text-align: center;
}

.preview-container img {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-actions {
    margin-top: 10px;
}

.btn-remove-image {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-remove-image:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Loading no upload */
.upload-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.upload-header {
    background: linear-gradient(135deg, #0d1b4a, #1a3a8a);
    color: white;
    padding: 12px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer {
  background-color: transparent; /* deixa o fundo livre */
  padding: 2rem 0;
  margin-top: auto;
  width: 100%;
}

.footer-card {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 12px; /* arredondado */
  padding: 1rem 1.5rem;
  text-align: center;
  color: #495057;
  font-size: 0.9rem;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.footer-card a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.footer-card a:hover {
  text-decoration: underline;
}

/* Links clicáveis */
.tabela-dados a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.tabela-dados a:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* Link do WhatsApp em destaque verde */
.tabela-dados a[href*="wa.me"] {
    color: #10b981;
    font-weight: 600;
}

/* Link do endereço em destaque */
.tabela-dados a[href*="google.com/maps"] {
    color: #dc2626;
    font-weight: 500;
}