/* ==========================================================================
   Base Styles and Variables
   ========================================================================== */
:root {
    /* Colors */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary-color: #10b981;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
    --error-color: #ef4444;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Layout */
    --max-width: 1200px;
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition: all 0.2s ease-in-out;
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #1e293b;
    --secondary-color: #34d399;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --input-bg: #0f172a;
    --error-color: #f87171;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
}

.navbar-logo {
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

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

.nav-link {
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    text-decoration: none;
}

.nav-link:hover {
    color: var(--primary-color);
}

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

.theme-switcher {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.theme-switcher:hover {
    color: var(--primary-color);
    background: var(--bg-color);
}

.theme-switcher svg {
    width: 20px;
    height: 20px;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn.active {
    background: var(--surface-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.lang-btn:hover:not(.active) {
    color: var(--text-main);
}

.main-content {
    padding: 3rem 0;
    min-height: calc(100vh - 70px - 100px); /* header and footer approx heights */
}

/* ==========================================================================
   Cards & Grid
   ========================================================================== */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.calc-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.calc-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.calc-card-icon svg {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.calc-card:hover .calc-card-icon svg {
    transform: scale(1.15) rotate(5deg);
}

.calc-card-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.calc-card h3 {
    margin-bottom: 0.5rem;
}

.calc-card p {
    flex-grow: 1;
    font-size: 0.95rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

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

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

.btn-outline:hover {
    background-color: var(--primary-light);
}

.calc-card .btn {
    margin-top: 1.5rem;
    width: 100%;
}

/* ==========================================================================
   Calculator Page Layout
   ========================================================================== */
.calc-page-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 992px) {
    .calc-page-layout {
        grid-template-columns: 1fr;
    }
}

.calc-panel {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.calc-header {
    margin-bottom: 2rem;
    text-align: center;
}

.calc-header p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

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

.input-prefix, .input-suffix {
    position: absolute;
    color: var(--text-muted);
    font-weight: 500;
}

.input-prefix { left: 1rem; }
.input-suffix { right: 1rem; }

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--text-main);
    background-color: var(--input-bg);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: var(--surface-color);
}

.has-prefix .form-input { padding-left: 2.5rem; }
.has-suffix .form-input { padding-right: 2.5rem; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; gap: 0; }
}

.calc-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.calc-actions .btn {
    flex: 1;
}

/* Results Panel */
.results-panel {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 90px;
}

.result-card {
    background: var(--primary-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    border: 1px solid rgba(37, 99, 235, 0.1);
}

.result-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.result-row:last-child {
    border-bottom: none;
}

.result-row-label {
    color: var(--text-muted);
    font-weight: 500;
}

.result-row-value {
    font-weight: 700;
    color: var(--text-main);
}

/* Chart Container */
.chart-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    height: 300px;
    width: 100%;
}

/* ==========================================================================
   Content Sections
   ========================================================================== */
.content-section {
    margin-top: 4rem;
    max-width: 800px;
}

.content-section h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.content-section p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.content-section ul {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.content-section li {
    margin-bottom: 0.5rem;
}

.formula-box {
    background: var(--input-bg);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

/* ==========================================================================
   Ad Banner Slots
   ========================================================================== */
.ad-slot {
    background: #e2e8f0;
    border: 1px dashed #94a3b8;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    margin: 2rem auto;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.ad-horizontal {
    width: 100%;
    max-width: 728px;
    height: 90px;
}

.ad-square {
    width: 100%;
    max-width: 300px;
    height: 250px;
    margin: 0 auto;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    background: var(--surface-color);
    padding: 4rem 0 2rem;
    margin-top: 5rem;
    border-top: 1px solid var(--border-color);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.footer-logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
}

.footer-logo-container img {
    height: 32px;
    width: auto;
}

.footer-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .footer-top {
        flex-direction: column;
        gap: 2rem;
        align-items: flex-start;
    }
}

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }

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

.main-content {
    animation: fadeInUp 0.5s ease-out forwards;
}

.calc-card {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.calc-grid .calc-card:nth-child(1) { animation-delay: 0.1s; }
.calc-grid .calc-card:nth-child(2) { animation-delay: 0.15s; }
.calc-grid .calc-card:nth-child(3) { animation-delay: 0.2s; }
.calc-grid .calc-card:nth-child(4) { animation-delay: 0.25s; }
.calc-grid .calc-card:nth-child(5) { animation-delay: 0.3s; }
.calc-grid .calc-card:nth-child(6) { animation-delay: 0.35s; }
.calc-grid .calc-card:nth-child(7) { animation-delay: 0.4s; }
.calc-grid .calc-card:nth-child(8) { animation-delay: 0.45s; }
.calc-grid .calc-card:nth-child(9) { animation-delay: 0.5s; }
.calc-grid .calc-card:nth-child(10) { animation-delay: 0.55s; }
.calc-grid .calc-card:nth-child(11) { animation-delay: 0.60s; }

/* ==========================================================================
   Testimonials
   ========================================================================== */
.testimonials-section {
    padding: 4rem 0 2rem;
    text-align: center;
}

.badge {
    display: inline-block;
    background: #cffafe;
    color: #0891b2;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

[data-theme="dark"] .badge {
    background: #164e63;
    color: #67e8f9;
}

.testimonials-section h2 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.testimonials-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto 3rem auto;
}

.testimonials-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.testimonial-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    position: relative;
    text-align: center;
}

.testimonial-icon {
    color: #38bdf8;
    margin-bottom: 1rem;
}

.testimonial-icon svg {
    width: 24px;
    height: 24px;
}

[data-theme="dark"] .testimonial-icon {
    color: #0284c7;
}

.testimonial-quote {
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-main);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.testimonial-author {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.testimonial-author img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.testimonial-author-info {
    text-align: left;
}

.testimonial-author-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}

.testimonial-author-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}
