:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #f59e0b;
    --secondary: #64748b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #475569;
    --success: #10b981;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    padding: 0;
}

header {
    background: transparent;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: flex-start;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: transform 0.2s ease;
}

.btn-back:hover {
    transform: translateX(-4px);
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.calculator-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.025em;
    color: #111827;
}

.tabs-container {
    display: flex;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 12px;
    margin-bottom: 2.5rem;
    gap: 0.5rem;
}

.tab-item {
    flex: 1;
    position: relative;
}

.tab-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

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

.tab-item input:checked + .tab-label {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.grid-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

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

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

input[type="date"], input[type="number"] {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--background);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background: #fff;
}

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

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Results */
.result-display {
    margin-top: 2rem;
    padding: 2rem;
    background: #f0f9ff;
    border-radius: 16px;
    border: 1px solid #bae6fd;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

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

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

.popular-calculations h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: #111827;
}

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

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

.calc-item {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    transition: transform 0.3s ease;
}

.calc-item:hover {
    transform: translateY(-5px);
}

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

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

/* Article Styling */
.article-content {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow);
    margin-top: 3rem;
}

.article-content h2 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1.25rem;
    color: #111827;
    border-bottom: 2px solid var(--background);
    padding-bottom: 0.5rem;
}

.article-content h3 {
    margin: 2rem 0 1rem;
    color: #334155;
    font-size: 1.4rem;
}

.article-content h4 {
    margin: 1.5rem 0 0.75rem;
    color: var(--primary);
    font-size: 1.15rem;
}

.article-content p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.article-content ul, .article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

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

.featured-image {
    width: 100%;
    height: auto;
    border-radius: 16px;
    margin: 2.5rem 0;
    box-shadow: var(--shadow);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

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

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

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

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

.faq-item p {
    margin-bottom: 0;
}

.hidden { display: none !important; }

@media (max-width: 640px) {
    .grid-inputs { grid-template-columns: 1fr; }
    .calculator-card { padding: 1.5rem; }
    h1 { font-size: 1.75rem; }
    .tabs-container { overflow-x: auto; flex-wrap: wrap; }
    .button-group { flex-direction: column; }
    .btn-primary, .btn-secondary { width: 100%; }
    .article-content { padding: 1.5rem; }
}
