/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --background: #ffffff;
    --foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --border: #e2e8f0;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --success: #10b981;
    --error: #ef4444;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--foreground);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    color: var(--muted-foreground);
}

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

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

/* Header */
.header {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--foreground);
}

.logo:hover {
    color: var(--foreground);
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.nav-desktop {
    display: none;
    gap: 2rem;
}

.nav-link {
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 0.5rem 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--foreground);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--foreground);
}

.menu-icon {
    width: 24px;
    height: 24px;
}

.nav-mobile {
    display: none;
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
    background: var(--muted);
    border-bottom: 1px solid var(--border);
}

.nav-mobile.open {
    display: flex;
}

.nav-mobile .nav-link {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}

.nav-mobile .nav-link.active {
    background: var(--background);
}

.nav-mobile .nav-link.active::after {
    display: none;
}

@media (min-width: 768px) {
    .nav-desktop {
        display: flex;
    }
    .mobile-menu-btn,
    .nav-mobile {
        display: none !important;
    }
}

/* Main Content */
.main {
    flex: 1;
}

/* Calculator Section */
.calculator-section {
    padding: 3rem 0;
}

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

.calculator-header h1 {
    margin-bottom: 0.5rem;
}

.calculator-header p {
    font-size: 1.125rem;
}

.calculator-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--background);
    border-color: var(--primary);
    color: var(--foreground);
}

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

.calculator-card {
    max-width: 480px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.calculator-panel {
    display: none;
}

.calculator-panel.active {
    display: block;
}

.calc-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--foreground);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-wrapper .suffix {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    font-weight: 500;
}

.calc-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

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

.btn-secondary {
    background: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.result-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--muted);
    border-radius: var(--radius);
    text-align: center;
    display: none;
}

.result-box.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.result-explanation {
    color: var(--muted-foreground);
    font-size: 0.9375rem;
}

.result-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s;
}

.result-copy:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.result-copy svg {
    width: 14px;
    height: 14px;
}

.keyboard-hint {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* FAQ Section */
.faq-section {
    padding: 3rem 0;
    background: var(--muted);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.2s;
}

.faq-question:hover {
    background: var(--muted);
}

.faq-question svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.faq-item.open .faq-question svg {
    transform: rotate(180deg);
}

.faq-answer {
    display: none;
    padding: 0 1.25rem 1.25rem;
    color: var(--muted-foreground);
    line-height: 1.7;
}

.faq-item.open .faq-answer {
    display: block;
}

/* Page Sections */
.page-section {
    padding: 3rem 0;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h1 {
    margin-bottom: 0.75rem;
}

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

/* Cards Grid */
.cards-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-text {
    color: var(--muted-foreground);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.card-link {
    font-weight: 500;
    font-size: 0.9375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.card-link svg {
    width: 16px;
    height: 16px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
}

.card-tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--muted);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Contact Form */
.contact-layout {
    display: grid;
    gap: 3rem;
}

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

.contact-form .input-group input,
.contact-form .input-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-form .input-group textarea {
    min-height: 150px;
    resize: vertical;
}

.contact-form .input-group input:focus,
.contact-form .input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.contact-info h3 {
    margin-bottom: 1rem;
}

.contact-info p {
    margin-bottom: 1.5rem;
}

.contact-email {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--muted);
    border-radius: var(--radius);
    font-weight: 500;
}

.form-message {
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    display: none;
}

.form-message.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Content Pages */
.content-page {
    max-width: 800px;
    margin: 0 auto;
}

.content-page h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-page p {
    margin-bottom: 1rem;
}

.content-page ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.content-page li {
    margin-bottom: 0.5rem;
    color: var(--muted-foreground);
}

.last-updated {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    font-style: italic;
    margin-bottom: 2rem;
}

/* Blog Post */
.blog-post {
    max-width: 800px;
    margin: 0 auto;
}

.blog-post-header {
    margin-bottom: 2rem;
}

.blog-post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.blog-post-content {
    line-height: 1.8;
}

.blog-post-content p {
    margin-bottom: 1.5rem;
    color: var(--foreground);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.back-link svg {
    width: 16px;
    height: 16px;
}

/* About Page */
.about-section {
    margin-bottom: 3rem;
}

.about-section h2 {
    margin-bottom: 1rem;
}

.features-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (min-width: 640px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.feature-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--muted);
    border-radius: var(--radius);
}

.feature-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.feature-icon svg {
    width: 20px;
    height: 20px;
}

.feature-content h4 {
    margin-bottom: 0.25rem;
}

.feature-content p {
    font-size: 0.9375rem;
}

/* Footer */
.footer {
    background: var(--muted);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    gap: 2rem;
}

@media (min-width: 640px) {
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.footer-brand .logo {
    margin-bottom: 0.75rem;
}

.footer-tagline {
    font-size: 0.9375rem;
    max-width: 280px;
}

.footer-links h4 {
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.footer-links a {
    display: block;
    color: var(--muted-foreground);
    font-size: 0.9375rem;
    padding: 0.375rem 0;
}

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

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

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

@media (min-width: 768px) {
    h1 { font-size: 3rem; }
    .calculator-section { padding: 4rem 0; }
    .page-section { padding: 4rem 0; }
    .faq-section { padding: 4rem 0; }
}
