/* Calculadora de Regra de 3 - CSS
   Identidade visual: Andrei Fabio
   Uma marca Yalla */

/* Reset e Variáveis CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

:root {
    /* Cores Light Mode */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2d3748;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --accent-color: #0056f9;
    --accent-hover: #0041c2;
    --success-color: #22c55e;
    --warning-color: #fbbf24;
    --error-color: #ef4444;
    --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);
    
    /* Componentes */
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-color: #0a0a0a;
    --card-bg: #1a1a1a;
    --text-color: #f7fafc;
    --text-light: #a0aec0;
    --border-color: #2d3748;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --input-bg: #2d3748;
    --input-border: #4a5568;
}

/* Base */
body {
    font-family: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
.header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.logo span {
    color: var(--accent-color);
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Theme Toggle */
.theme-toggle {
    width: 50px;
    height: 24px;
    background-color: #cbd5e0;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

[data-theme="dark"] .theme-toggle {
    background-color: var(--accent-color);
}

.toggle-circle {
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .toggle-circle {
    transform: translateX(26px);
}

/* Hero */
.hero {
    padding: 4rem 0 2rem;
    text-align: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Main Content */
.main-content {
    padding: 2rem 0 5rem;
}

.calculator-container {
    max-width: 800px;
    margin: 0 auto;
}

.calculator-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    transition: background-color 0.3s ease;
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
}

.proportion-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.calc-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 1.1rem;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
    font-weight: 600;
}

.calc-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 249, 0.1);
}

.calc-input.result {
    background: linear-gradient(135deg, var(--success-color), #16a34a);
    color: white;
    font-weight: 700;
    font-size: 1.3rem;
    cursor: not-allowed;
}

.calc-input.error {
    border-color: var(--error-color);
    background-color: rgba(239, 68, 68, 0.1);
}

.equals-symbol {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #f59e0b);
    color: #1f2937;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Formula Display */
.formula-display {
    background: linear-gradient(135deg, rgba(0, 86, 249, 0.05), rgba(79, 137, 255, 0.05));
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

.formula-display h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.formula-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    font-family: 'Courier New', monospace;
}

/* History */
.history-section {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.history-section h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: var(--accent-color);
    color: white;
    transform: translateX(5px);
}

.no-history {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Examples */
.examples-section {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.examples-section h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.example-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-item:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
}

.example-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.example-problem {
    font-size: 0.9rem;
    color: var(--text-light);
}

.example-item:hover .example-problem {
    color: rgba(255, 255, 255, 0.8);
}

/* Footer */
.footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    padding: 3rem 0 1rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 1rem;
    display: block;
}

.footer-logo span {
    color: var(--accent-color);
}

.footer-column h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.social-link:hover {
    transform: translateY(-2px);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-bottom-links {
    display: flex;
    gap: 1.5rem;
}

.footer-bottom-links a {
    color: var(--text-light);
    text-decoration: none;
}

.footer-bottom-links a:hover {
    color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .equals-symbol {
        order: 3;
        font-size: 1.5rem;
    }

    .button-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
    }

    .calculator-card {
        padding: 1rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 0.6s ease-in-out;
}