/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

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

/* Header */
header {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 1rem;
    box-shadow: var(--shadow);
}

header .container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Unit Toggle */
.unit-toggle {
    display: inline-block;
}

.toggle-btn {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 0.25rem;
    display: inline-flex;
    gap: 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-option {
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.toggle-option.active {
    background: var(--primary-color);
    color: white;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

main {
    flex: 1;
    padding: 2rem 1rem;
}

/* Featured Banner */
.featured-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.5s ease;
}

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

.featured-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.featured-text h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: white;
}

.featured-text p {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.btn-featured {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-featured:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.featured-badge {
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-new {
    background: #fbbf24;
    color: #78350f;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Calculator Cards */
.calculator-card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.calculator-card:hover {
    transform: translateY(-2px);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    margin: 1.25rem 0;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    font-size: 0.95rem;
}

.reference-table thead th {
    text-align: left;
    background: var(--background);
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
}

.reference-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.reference-table tbody tr:last-child td {
    border-bottom: none;
}

.table-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.howto-list {
    margin: 1rem 0 0 1.25rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.howto-list li {
    margin-bottom: 0.5rem;
}

.feature-list {
    margin: 0.75rem 0 0 1rem;
    color: var(--text-primary);
}

.feature-list li {
    margin-bottom: 0.45rem;
}

.calculator-card h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Input Grid */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.unit-label {
    color: var(--text-secondary);
    font-weight: 400;
}

input[type="number"],
select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--card-background);
    color: var(--text-primary);
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="number"]:hover,
select:hover {
    border-color: var(--primary-hover);
}

/* Buttons */
.btn-calculate {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 300px;
}

.btn-calculate:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

/* Conversion Toggle Buttons */
.conversion-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

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

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

.conversion-btn:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Result Box */
.result-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    animation: slideIn 0.3s ease;
}

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

.result-box h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.result-box p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.result-box strong {
    font-weight: 700;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

/* Footer */
footer {
    background: var(--card-background);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    text-align: center;
}

.footer-bottom p {
    margin: 0.5rem 0;
}

.disclaimer {
    font-size: 0.85rem;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    .input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .btn-calculate {
        max-width: 100%;
    }

    .conversion-toggle {
        flex-direction: column;
    }

    .featured-content {
        flex-direction: column;
        text-align: center;
    }

    .featured-text h2 {
        font-size: 1.5rem;
    }

    .footer-links {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    .calculator-card h2 {
        font-size: 1.5rem;
    }

    header {
        padding: 1.5rem 1rem;
    }
}

/* Dark Mode Support (optional for future) */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --card-background: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error State */
.error-message {
    background: #fef2f2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #fecaca;
    margin-top: 1rem;
}
