/**
 * Estilos globais do sistema
 * Sistema de Portfólio de Investimento
 */

/* CSS Custom Properties (Variáveis) */
:root,
[data-theme="dark"],
.theme-dark {
    /* Cores principais */
    --primary: #667eea;
    --primary-dark: #764ba2;
    --primary-blue: #667eea;
    --primary-purple: #764ba2;
    --secondary: #f093fb;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --error: #ef4444;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --info: #3b82f6;
    --info-dark: #2563eb;
    
    /* Cores de fundo escuro */
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --hover-bg: #475569;
    
    /* Cores de texto */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    /* Cores de borda */
    --border-color: #334155;
    --border-light: #475569;
    
    /* Cores neutras */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-error: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Bordas */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    
    /* Espaçamentos */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    
    /* Tipografia */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    
    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
    
    /* Transições */
    --transition-fast: 0.15s ease-in-out;
    --transition: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
}

/* Reset básico */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.5em;
    color: var(--gray-900);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Listas */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.25rem;
}

/* Formulários */
input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background-color: var(--white);
    color: white;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

/* Força cor branca em todos os inputs */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
    color: white !important;
}

/* === FORÇA MÁXIMA GLOBAL === */

/* Força tema escuro globalmente */
html,
body {
    background-color: var(--dark-bg) !important;
    color: var(--text-primary) !important;
}

/* Força tema escuro independente do sistema */
html[data-theme="light"],
body.theme-light {
    background-color: var(--dark-bg) !important;
    color: var(--text-primary) !important;
}

/* Força cor branca em TODOS os inputs e estados */
* input,
* input:focus,
* input:active,
* input:hover,
* textarea,
* select {
    color: white !important;
    -webkit-text-fill-color: white !important;
    text-fill-color: white !important;
}

/* Força cor branca com seletor universal mais específico */
html input,
html textarea,
html select {
    color: white !important;
    -webkit-text-fill-color: white !important;
}

/* Remove estilos automáticos do navegador */
input:-webkit-autofill {
    -webkit-text-fill-color: white !important;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

/* Variantes de botões */
.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

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

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

.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--primary);
    color: var(--white);
}

/* Tamanhos de botões */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-xl {
    padding: 1.25rem 2.5rem;
    font-size: 1.125rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* Grid system */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

.col {
    flex: 1;
    padding: 0 0.5rem;
}

.col-auto {
    flex: 0 0 auto;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-gray { color: var(--gray-500); }
.text-muted { color: var(--gray-400); }

.bg-primary { background-color: var(--primary); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-error { background-color: var(--error); }
.bg-gray { background-color: var(--gray-100); }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-4 { margin: 1rem; }
.m-auto { margin: auto; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.h-auto { height: auto; }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Animações */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

.bounce-in {
    animation: bounceIn 0.5s ease-out;
}

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

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    .btn {
        padding: 0.625rem 1.25rem;
    }
    
    .card-header,
    .card-body {
        padding: 1rem;
    }
    
    .row {
        margin: 0 -0.25rem;
    }
    
    .col {
        padding: 0 0.25rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .card-header,
    .card-body {
        padding: 0.75rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Modo escuro (preparação) */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1f2937;
        --gray-50: #111827;
        --gray-100: #1f2937;
        --gray-200: #374151;
        --gray-300: #4b5563;
        --gray-400: #6b7280;
        --gray-500: #9ca3af;
        --gray-600: #d1d5db;
        --gray-700: #e5e7eb;
        --gray-800: #f3f4f6;
        --gray-900: #f9fafb;
    }
}

/* Global Settings Styles */

/* Hide Values Mode */
body.hide-values .stat-value,
body.hide-values .current-price,
body.hide-values .asset-value,
body.hide-values .net-amount,
body.hide-values .total-amount,
body.hide-values .price-value,
body.hide-values [data-currency],
body.hide-values .dividend-amount {
    filter: blur(4px) !important;
    transition: filter 0.3s ease;
    cursor: pointer;
}

body.hide-values .stat-value:hover,
body.hide-values .current-price:hover,
body.hide-values .asset-value:hover,
body.hide-values .net-amount:hover,
body.hide-values .total-amount:hover,
body.hide-values .price-value:hover,
body.hide-values [data-currency]:hover,
body.hide-values .dividend-amount:hover {
    filter: none !important;
}

/* Compact View Mode */
body.compact-view .dashboard-grid {
    gap: 1rem;
}

body.compact-view .card {
    padding: 1rem;
}

body.compact-view .card-header {
    margin-bottom: 0.75rem;
}

body.compact-view .stat-card {
    padding: 1rem;
}

body.compact-view .portfolio-card {
    padding: 1rem;
}

body.compact-view .asset-card {
    padding: 1rem;
}

/* Theme Transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Auto-refresh indicator */
.auto-refresh-indicator {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1000;
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.auto-refresh-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.auto-refresh-indicator i {
    animation: spin 1s linear infinite;
}

/* Currency formatting */
[data-currency] {
    font-weight: 600;
}

[data-currency].positive {
    color: var(--success, #10b981);
}

[data-currency].negative {
    color: var(--error, #ef4444);
}

/* Number formatting */
[data-number] {
    font-variant-numeric: tabular-nums;
}

/* Language specific styles */
html[lang="en"] .date-display {
    font-family: system-ui, -apple-system, sans-serif;
}

html[lang="pt"] .date-display {
    font-family: system-ui, -apple-system, sans-serif;
}

html[lang="es"] .date-display {
    font-family: system-ui, -apple-system, sans-serif;
}

/* Settings applied indicator */
.settings-applied {
    position: relative;
}

.settings-applied::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    opacity: 0.7;
}

/* Updated cross-platform theme fix: 1758061135 */
