/* Reset e Variáveis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --neutral-color: #6b7280;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 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);
    --radius: 12px;
    --radius-sm: 8px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 50px 30px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 50%, #1a365d 100%);
    border-radius: var(--radius);
    margin-bottom: 30px;
    color: white;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

header > * {
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo-text {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.5px;
}

.logo-text strong {
    font-weight: 800;
    color: #4ade80;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 500px;
    margin: 0 auto 20px;
}

.header-badges {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.badge-header {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Section Intro */
.section-intro {
    color: var(--text-secondary);
    margin-bottom: 25px;
    margin-top: -10px;
    font-size: 0.95rem;
}

/* Sections */
section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-primary);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

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

.form-group .help-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Input com botão ao lado */
.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
}

.btn-external {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
}

.btn-external:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-external:active {
    transform: translateY(0);
}

.btn-external svg {
    flex-shrink: 0;
}

/* Input com select ao lado */
.input-with-select {
    display: flex;
    gap: 0;
}

.input-with-select input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-with-select select {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 1rem;
    font-family: inherit;
    background: var(--background);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.input-with-select input:focus + select {
    border-color: var(--primary-color);
}

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

/* Button */
.btn-calculate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-top: 10px;
}

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

.btn-calculate:active {
    transform: translateY(0);
}

/* Results Section */
.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--background);
    border-radius: var(--radius-sm);
    margin-bottom: 25px;
}

.stock-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.current-price {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.current-price strong {
    color: var(--text-primary);
    font-size: 1.3rem;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

/* Result Cards */
.result-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
}

.result-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    color: white;
}

.result-card.graham .card-header {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.result-card.bazin .card-header {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}

.result-card .card-header h4 {
    font-size: 1.2rem;
    font-weight: 600;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.buy {
    background: var(--success-light);
    color: var(--success-color);
}

.badge.hold {
    background: var(--warning-light);
    color: var(--warning-color);
}

.badge.sell {
    background: var(--danger-light);
    color: var(--danger-color);
}

.card-body {
    padding: 25px;
    background: white;
}

.value-display, .margin-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.value-display .label, .margin-display .label {
    color: var(--text-secondary);
    font-weight: 500;
}

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

.margin-display .value {
    font-size: 1.2rem;
    font-weight: 600;
}

.margin-display .value.positive {
    color: var(--success-color);
}

.margin-display .value.negative {
    color: var(--danger-color);
}

.formula-info {
    margin-top: 20px;
    padding: 15px;
    background: var(--background);
    border-radius: var(--radius-sm);
}

.formula-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.formula-info .description {
    font-style: italic;
}

/* Combined Analysis */
.combined-analysis {
    padding: 25px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.combined-analysis h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.combined-analysis p {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.7;
}

/* Indicators */
.indicators h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.indicator {
    padding: 20px;
    background: var(--background);
    border-radius: var(--radius-sm);
    text-align: center;
}

.indicator-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.indicator-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Education Section */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.education-card {
    padding: 25px;
    background: var(--background);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
}

.education-card h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--primary-dark);
}

.education-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.formula-box {
    padding: 15px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.formula-box p {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.formula-box small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.disclaimer {
    padding: 20px;
    background: var(--danger-light);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--danger-color);
}

.disclaimer p {
    font-size: 0.95rem;
    color: var(--danger-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
    border-radius: var(--radius);
    margin-top: 30px;
    color: white;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.footer-brand strong {
    color: #4ade80;
}

.footer-content > p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.footer-disclaimer {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 15px;
}

.footer-copy {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-top: 20px;
}

/* ========================================
   ESPAÇOS PARA ANÚNCIOS
   ======================================== */

.ad-container {
    margin: 25px 0;
    display: flex;
    justify-content: center;
}

.ad-placeholder {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    background: linear-gradient(135deg, var(--background) 0%, var(--border-color) 100%);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    position: relative;
}

.ad-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 4px 12px;
    border-radius: 12px;
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
}

.ad-placeholder p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Variações de tamanho */
.ad-banner-top .ad-placeholder,
.ad-banner-middle .ad-placeholder,
.ad-banner-bottom .ad-placeholder {
    max-width: 728px;
    min-height: 90px;
}

/* Anúncio responsivo mobile */
@media (max-width: 768px) {
    .ad-placeholder {
        max-width: 320px;
        min-height: 100px;
    }
    
    .ad-placeholder p {
        font-size: 0.75rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section {
    animation: fadeIn 0.5s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        padding: 30px 15px;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    header .subtitle {
        font-size: 0.95rem;
    }
    
    .header-badges {
        gap: 8px;
    }
    
    .badge-header {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    section {
        padding: 20px;
    }
    
    .stock-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .indicators-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .compound-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-brand {
        font-size: 1.1rem;
    }
}

/* ========================================
   CALCULADORA DE JUROS COMPOSTOS
   ======================================== */

.compound-section {
    background: var(--card-bg);
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 25px;
    margin-top: -15px;
}

/* Campo de inflação */
.inflation-group {
    max-width: 100%;
}

.inflation-group label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.optional-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    background: var(--border-color);
    color: var(--text-secondary);
    border-radius: 12px;
    font-weight: 500;
}

.inflation-group .help-text {
    line-height: 1.5;
}

/* Seção de valor real */
.real-value-section {
    margin-top: 25px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: var(--radius);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.real-value-section h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.real-value-explanation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.real-value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.real-value-card {
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border-color);
}

.real-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.real-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 5px;
}

.real-info {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-compound {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-compound:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.compound-results {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
    animation: fadeIn 0.5s ease;
}

.compound-results h3 {
    font-size: 1.3rem;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.compound-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    padding: 25px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.summary-card.total {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.summary-card.invested {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.summary-card.profit {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.summary-card.percentage {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
}

.summary-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Gráfico de Juros Compostos */
.chart-container {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--background);
    border-radius: var(--radius);
}

.chart-container h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.chart-wrapper {
    height: 350px;
    position: relative;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-color.total {
    background: #10b981;
}

.legend-color.invested {
    background: #6366f1;
}

.legend-color.profit {
    background: #f59e0b;
}

.compound-details {
    margin-bottom: 25px;
}

.compound-details h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

#compoundTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

#compoundTable th,
#compoundTable td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

#compoundTable th {
    background: var(--background);
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

#compoundTable th:first-child,
#compoundTable td:first-child {
    text-align: center;
}

#compoundTable tbody tr:hover {
    background: var(--background);
}

#compoundTable tbody tr:last-child td {
    border-bottom: none;
}

.compound-formula {
    padding: 15px;
    background: var(--background);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
}

.compound-formula p {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.compound-formula small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --card-bg: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }
    
    .form-group input {
        background: var(--background);
        color: var(--text-primary);
    }
    
    .card-body {
        background: var(--card-bg);
    }
    
    .formula-box {
        background: var(--background);
        border-color: var(--border-color);
    }
    
    .combined-analysis {
        background: linear-gradient(135deg, #422006 0%, #78350f 100%);
    }
    
    .combined-analysis h4,
    .combined-analysis p {
        color: #fef3c7;
    }
}
