/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);
    --radius: 8px;
    --radius-lg: 12px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Layout
   ============================================ */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.main {
    flex: 1;
    padding: 20px 0 60px;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--primary);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    text-align: center;
    padding: 40px 0 30px;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--gray-600);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Calculator Section
   ============================================ */
.calculator-section {
    display: grid;
    gap: 24px;
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    .calculator-section {
        grid-template-columns: 1fr 1fr;
    }
}

.calculator-card,
.results-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

/* ============================================
   Form Styles
   ============================================ */
.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-icon {
    font-size: 1.1rem;
}

.form-group input[type="number"],
.form-group select {
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.hidden {
    display: none !important;
}

/* Toggle Switch */
.form-group-toggle {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.form-group-toggle label:first-child {
    flex: 1;
}

.form-group-toggle .input-hint {
    width: 100%;
    margin-top: 4px;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ============================================
   Results Section
   ============================================ */
.results-card h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--gray-800);
}

.result-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 20px;
}

.result-primary .result-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.result-primary .result-value {
    font-size: 2.5rem;
    font-weight: 700;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.result-item {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.result-item .result-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-item .result-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
}

.result-breakdown {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.result-breakdown h3 {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.result-breakdown ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-breakdown li {
    font-size: 0.9rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Share Buttons */
.share-section {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-share {
    background: var(--primary);
    color: var(--white);
    flex: 1;
}

.btn-share:hover {
    background: var(--primary-dark);
}

.btn-copy {
    background: var(--gray-100);
    color: var(--gray-700);
    flex: 1;
}

.btn-copy:hover {
    background: var(--gray-200);
}

.share-hint {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-top: 12px;
    text-align: center;
}

/* ============================================
   Content Sections
   ============================================ */
.content-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.content-section h2 {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.content-section h3 {
    font-size: 1.1rem;
    color: var(--gray-800);
    margin-top: 24px;
    margin-bottom: 12px;
}

.content-section p {
    color: var(--gray-600);
    margin-bottom: 16px;
}

.content-section ul,
.content-section ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.content-section li {
    color: var(--gray-600);
    margin-bottom: 8px;
}

.steps-list {
    counter-reset: steps;
    list-style: none;
    padding-left: 0;
}

.steps-list li {
    counter-increment: steps;
    position: relative;
    padding-left: 48px;
    margin-bottom: 16px;
}

.steps-list li::before {
    content: counter(steps);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.benefits-list {
    list-style: none;
    padding-left: 0;
}

.benefits-list li {
    padding-left: 0;
}

/* Tips Grid */
.tips-grid {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

@media (min-width: 600px) {
    .tips-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tip-card {
    background: var(--gray-50);
    padding: 20px;
    border-radius: var(--radius);
}

.tip-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

.tip-card h3 {
    margin-top: 0;
    font-size: 1rem;
}

.tip-card p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* ============================================
   FAQ Section
   ============================================ */
.faq-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--gray-800);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.faq-item summary:hover {
    background: var(--gray-50);
}

.faq-item summary::after {
    content: "+";
    font-size: 1.25rem;
    color: var(--gray-400);
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    padding: 0 20px 16px;
    margin: 0;
}

/* ============================================
   Ad Container
   ============================================ */
.ad-container {
    margin: 30px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px;
    color: var(--gray-400);
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--gray-800);
    color: var(--gray-300);
    padding: 40px 0 24px;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 24px;
}

.footer-brand .logo {
    color: var(--white);
    display: block;
    margin-bottom: 8px;
}

.footer-brand p {
    font-size: 0.9rem;
    max-width: 300px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid var(--gray-700);
    padding-top: 24px;
    text-align: center;
    font-size: 0.85rem;
}

.footer-bottom p {
    margin-bottom: 4px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .result-primary .result-value {
        font-size: 2rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
    }
    
    .share-section {
        flex-direction: column;
    }
}