/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #FBFDFF;
    color: #0f172a;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    background: #0f172a;
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.5s ease-in-out;
    overflow: hidden;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar.sidebar-closed {
    width: 0;
    opacity: 0;
}

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-logo .icon-waves {
    background: #2563eb;
    padding: 12px;
    border-radius: 20px;
    color: white;
    box-shadow: 0 10px 40px rgba(37, 99, 235, 0.4);
}

.sidebar-logo h1 {
    font-size: 24px;
    font-weight: 900;
    color: white;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    font-style: italic;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s;
}

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

.sidebar-nav {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 16px;
    border: none;
    background: none;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-style: italic;
    margin-bottom: 8px;
}

.nav-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}

.nav-item.active {
    background: #2563eb;
    color: white;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-item-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nav-item-wrapper .nav-item {
    flex: 1;
    margin-bottom: 0;
}

.nav-item-delete {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s;
    opacity: 0;
}

.nav-item-wrapper:hover .nav-item-delete {
    opacity: 1;
}

.nav-item-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.nav-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
    transition: all 0.3s;
}

.nav-item.active .nav-item-dot {
    background: #60a5fa;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.8);
}

.nav-section-title {
    padding: 24px 20px 8px;
    font-size: 10px;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3em;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    height: 96px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid #e2e8f0;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
}

.sidebar-toggle-btn:hover {
    background: #1d4ed8;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    font-style: italic;
}

.header-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-subtitle span:last-child {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-style: italic;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px 56px;
}

.view {
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.7s;
}

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

.view-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.view-header > div:first-child h2 {
    font-size: 32px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.view-header > div:first-child p {
    color: #64748b;
    font-weight: 700;
    font-size: 14px;
    font-style: italic;
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.year-selector span {
    font-size: 10px;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.badge {
    display: inline-block;
    background: #2563eb;
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 4px 12px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: -0.1px;
    font-style: italic;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
    margin-bottom: 8px;
}

.select-input {
    background: #f1f5f9;
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 900;
    color: #2563eb;
    text-transform: uppercase;
    cursor: pointer;
    outline: none;
}

.select-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 6px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.select-group span {
    padding: 0 12px;
    font-size: 10px;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.controls-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.1;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 900;
    padding: 4px 12px;
    border-radius: 9999px;
}

.stat-trend.positive {
    background: #ecfdf5;
    color: #059669;
}

.stat-trend.negative {
    background: #fef2f2;
    color: #dc2626;
}

.stat-label {
    font-size: 10px;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 900;
    color: #0f172a;
}

.stat-subvalue {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 700;
    font-style: italic;
    margin-top: 4px;
}

.card {
    background: white;
    border-radius: 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-bottom: 32px;
}

.card-header {
    padding: 32px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    font-style: italic;
    margin-bottom: 4px;
}

.card-header p {
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 16px;
    border: none;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: scale(1.02);
}

.btn-secondary {
    background: transparent;
    color: #64748b;
}

.btn-secondary:hover {
    color: #0f172a;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    text-align: left;
}

thead {
    background: rgba(248, 250, 252, 0.5);
}

th {
    padding: 24px 40px;
    font-size: 10px;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

td {
    padding: 20px 40px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

tbody tr {
    border-top: 1px solid #e2e8f0;
    transition: background 0.2s;
}

tbody tr:hover {
    background: rgba(248, 250, 252, 0.8);
}

.evolution-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 900;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.evolution-badge.positive {
    background: #ecfdf5;
    color: #059669;
}

.evolution-badge.negative {
    background: #fef2f2;
    color: #dc2626;
}

.chart-container {
    padding: 40px;
    height: 400px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 800px;
    border-radius: 48px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 32px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-box {
    background: #2563eb;
    padding: 8px;
    border-radius: 12px;
    color: white;
}

.modal-title h3 {
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.05);
}

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

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

.form-group label {
    display: block;
    font-size: 10px;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    padding-left: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-field {
    padding: 20px;
    background: #f1f5f9;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.form-field:hover {
    border-color: #93c5fd;
}

.form-field span {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.form-field .select-input {
    width: 100%;
    background: transparent;
}

.file-drop-zone {
    border: 2px dashed #93c5fd;
    border-radius: 40px;
    padding: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.file-drop-zone:hover {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.03);
}

.file-drop-zone svg {
    color: #2563eb;
}

.file-drop-zone span {
    font-size: 14px;
    font-weight: 900;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: -0.1px;
    text-align: center;
}

.file-drop-zone p {
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
    margin-top: 8px;
}

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

.badge-count {
    background: #2563eb;
    color: white;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 900;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
}

.preview-table-container {
    background: #f1f5f9;
    border-radius: 32px;
    border: 1px solid #cbd5e1;
    overflow: hidden;
}

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

.preview-table-container thead {
    background: rgba(248, 250, 252, 0.5);
}

.preview-table-container th {
    padding: 16px 24px;
    font-size: 9px;
}

.preview-table-container td {
    padding: 16px 24px;
}

.alert {
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fed7aa;
    color: #92400e;
}

.modal-footer {
    padding: 32px;
    border-top: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, 0.5);
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.modal-footer .btn {
    flex: 1;
}

.modal-footer .btn-primary {
    flex: 2;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
