:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-color: #f59e0b;
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

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

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

/* Header & Navigation */
header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-back:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

/* Layout */
main {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

/* Card */
.calculator-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Radio Tabs */
.tabs-container {
    display: flex;
    background: #f1f5f9;
    padding: 0.4rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    gap: 0.2rem;
}

.tab-item {
    flex: 1;
}

.tab-item input[type="radio"] {
    display: none;
}

.tab-label {
    display: block;
    text-align: center;
    padding: 0.8rem;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.tab-item input[type="radio"]:checked+.tab-label {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Form Groups */
.grid-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

input[type="date"],
input[type="number"] {
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
    width: 100%;
}

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

/* Actions */
.button-group {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    flex: 2;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary {
    flex: 1;
    padding: 1rem;
    background: #f1f5f9;
    color: var(--text-muted);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    filter: brightness(1.1);
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

/* Result Section */
.result-display {
    margin-top: 2.5rem;
    padding: 2rem;
    background: #f8fafc;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.4s ease-out;
}

.hidden {
    display: none;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-text {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Direct Answer Section */
.direct-answer {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 2rem;
    border-radius: var(--radius);
    margin: 2rem 0;
    border-left: 4px solid var(--primary-color);
}

.direct-answer p {
    font-size: 1.05rem;
    line-height: 1.8;
    margin: 0;
    color: var(--text-main);
}

/* Popular Calculations */
.popular-calculations {
    margin: 3rem 0;
}

.popular-calculations h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.popular-calculations>p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.calc-item {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-top: 3px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.calc-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.calc-item strong {
    display: block;
    color: var(--primary-color);
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.calc-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
}

/* Article Content Styling */
.article-content {
    margin-top: 4rem;
    max-width: 900px;
}

.article-content section {
    margin-bottom: 3rem;
}

.article-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    margin-top: 2rem;
}

.article-content h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.article-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    margin-top: 1.25rem;
}

.article-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: var(--text-main);
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.75rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: var(--text-main);
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 2rem auto;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-content a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.2s;
}

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

/* Table Styling */
.table-responsive {
    overflow-x: auto;
    margin: 2rem 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.article-content th {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.article-content td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.article-content tbody tr:hover {
    background: #f8fafc;
}

/* FAQ Section */
.faq-section {
    margin-top: 3rem;
}

.faq-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.faq-item h3 {
    color: var(--primary-color);
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    margin-top: 0;
}

.faq-item p {
    margin-bottom: 0;
    color: var(--text-muted);
}

/* Intro and Conclusion */
.intro-section p:first-child,
.conclusion p {
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .grid-inputs {
        grid-template-columns: 1fr;
    }

    .tabs-container {
        flex-direction: column;
    }

    .button-group {
        flex-direction: column;
    }

    main {
        margin: 1.5rem auto;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .article-content h2 {
        font-size: 1.5rem;
    }

    .article-content h3 {
        font-size: 1.2rem;
    }

    .article-content h4 {
        font-size: 1rem;
    }

    .article-content table {
        font-size: 0.9rem;
    }

    .article-content th,
    .article-content td {
        padding: 0.75rem 0.5rem;
    }
}