:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;

    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    --danger: #ef4444;
    --danger-hover: #dc2626;

    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic Animated Background */
.background-decor,
.background-decor-2 {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate;
}

.background-decor {
    width: 40vw;
    height: 40vw;
    background: var(--primary);
    top: -10%;
    left: -10%;
}

.background-decor-2 {
    width: 30vw;
    height: 30vw;
    background: var(--accent);
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* Glassmorphism Classes */
.glassmorphism {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.donate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--primary);
    color: var(--text-light);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.2), 0 0 10px rgba(139, 92, 246, 0.2);
    transition: var(--transition);
}

.donate-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: translateY(-2px);
    border-color: var(--primary-hover);
    box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.3), 0 0 15px rgba(139, 92, 246, 0.4);
}

.donate-btn:active {
    transform: scale(0.95);
    background: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
}

.desktop-only {
    display: none;
}

.mobile-donate-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    padding: 1rem 0;
}

@media (min-width: 600px) {
    .desktop-only {
        display: inline-flex;
    }

    .mobile-only {
        display: none;
    }

    .donate-btn {
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: 1px solid var(--glass-border);
        padding: 0.5rem 1rem;
        border-radius: 20px;
        font-size: 0.9rem;
        box-shadow: none;
    }

    .donate-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateY(-2px);
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    }

    .donate-btn:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.15);
    }
}

.lang-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--glass-bg);
    padding: 0.25rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.lang-btn.active {
    background: var(--primary);
    color: white;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 5%;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.header .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Layout Grid */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 768px) {
    .calculator-layout {
        grid-template-columns: 350px 1fr;
    }
}

/* Form Styles */
.form-container {
    padding: 2rem;
}

.form-container h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--accent);
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.half {
    flex: 1;
    justify-content: flex-end;
}

label {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
}

input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.input-with-symbol {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-symbol .symbol {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    white-space: pre;
}

html[lang="en"] .input-with-symbol input {
    padding-left: 2rem;
}

html[lang="pt"] .input-with-symbol input {
    padding-left: 2.5rem;
}

button {
    width: 100%;
    padding: 0.875rem;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

button.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

button.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

button.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    margin-top: 0.75rem;
}

button.btn-secondary:hover {
    background: var(--glass-highlight);
    color: var(--text-light);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.5rem;
}

.badge {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    border: 2px dashed var(--glass-border);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.02);
}

/* Result Card */
.card {
    position: relative;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
    animation: fadeInUp 0.5s ease-out;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    word-break: break-word;
    padding-right: 2rem;
}

.best-value-badge {
    display: none;
    position: absolute;
    top: -12px;
    right: 1.5rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card.is-cheapest {
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.card.is-cheapest .best-value-badge {
    display: block;
}

.card-price-main {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.calc-unit {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.card-details {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-details p {
    display: flex;
    justify-content: space-between;
}

.btn-delete {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
    transform: none;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

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

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

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}