/* ============================================
   VARIÁVEIS E RESET
   ============================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.logo svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.logo-img {
    max-width: 140px;
    height: auto;
}

.nav-links {
    list-style: none;
    padding: 1rem 0.75rem;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.nav-links li:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-links li.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.nav-links li svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   UPLOAD SECTION
   ============================================ */
.upload-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.upload-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.upload-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-icon.pdf {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
}

.upload-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.upload-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.upload-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.upload-placeholder svg {
    width: 40px;
    height: 40px;
    opacity: 0.5;
}

.file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--success);
}

.file-selected svg {
    width: 24px;
    height: 24px;
}

.process-container {
    text-align: center;
    margin-top: 2.5rem;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

/* Status Message */
.status-message {
    max-width: 600px;
    margin: 2rem auto 0;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.status-message.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.status-message.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* ============================================
   DASHBOARD SECTION
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

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

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chart-card canvas {
    max-height: 300px;
}

/* ============================================
   TABLE SECTION
   ============================================ */
.table-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-box select {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 220px;
}

.filter-box select:focus {
    outline: none;
    border-color: var(--primary);
}

.table-container {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

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

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem !important;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

#pageInfo {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .header {
        padding: 0 1rem;
    }

    .section {
        padding: 1rem;
    }

    .upload-container {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   EXPORT SECTION
   ============================================ */
.export-container {
    max-width: 1200px;
}

.export-header {
    margin-bottom: 2rem;
}

.export-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.export-header p {
    color: var(--text-secondary);
}

/* Bank Cards */
.bank-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.bank-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.bank-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.bank-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.bank-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.bank-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bank-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.bank-icon.itau {
    background: linear-gradient(135deg, #EC7000, #003399);
}

.bank-icon.bradesco {
    background: linear-gradient(135deg, #CC092F, #8B0000);
}

.bank-icon.bb {
    background: linear-gradient(135deg, #FFCC00, #003399);
}

.bank-icon.caixa {
    background: linear-gradient(135deg, #0066B3, #FF6600);
}

.bank-icon.santander {
    background: linear-gradient(135deg, #EC0000, #CC0000);
}

.bank-icon.nubank {
    background: linear-gradient(135deg, #820AD1, #5A0A91);
}

.bank-icon.inter {
    background: linear-gradient(135deg, #FF7A00, #FF5500);
}

.bank-card-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.bank-card-stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.bank-card-stat {
    display: flex;
    flex-direction: column;
}

.bank-card-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bank-card-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Empty state box */
.empty-state-box {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}

.empty-state-box svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Bank Details */
.bank-details {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.bank-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.bank-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.bank-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.bank-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.bank-stat svg {
    width: 18px;
    height: 18px;
}

.bank-details .table-container {
    margin-top: 1rem;
}

/* Ajustes responsivos para export */
@media (max-width: 768px) {
    .bank-cards {
        grid-template-columns: 1fr;
    }

    .bank-details-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .bank-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ============================================
   SIDEBAR FOOTER / USER INFO
   ============================================ */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--bg-tertiary);
    color: var(--danger);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal form {
    padding: 1.5rem;
}

.modal .form-group {
    margin-bottom: 1.25rem;
}

.modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.modal .form-group input,
.modal .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.modal .form-group input:focus,
.modal .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal .form-group input::placeholder {
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px !important;
    height: 18px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   SECTION HEADER
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ============================================
   USER STATUS BADGE
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.tipo-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tipo-badge.admin {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.tipo-badge.usuario {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
}

/* ============================================
   ACTION BUTTONS
   ============================================ */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.btn-icon.edit:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Button secondary */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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