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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 40px 20px 30px;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content Layout */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    margin-top: 20px;
}

.converter-section {
    min-width: 0;
}

/* Cards */
.converter-card,
.info-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.converter-card h2,
.info-card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.converter-card h3 {
    font-size: 1.25rem;
    margin: 30px 0 15px;
    color: var(--text-primary);
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.input-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s;
}

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

.height-input {
    margin-top: 20px;
}

.dual-input {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.input-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.number-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--primary-color);
    transition: border-color 0.2s;
}

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

.number-input.large {
    font-size: 2rem;
}

/* Results Section */
.results-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    padding: 30px;
    color: white;
}

.results-section h3 {
    color: white;
    margin: 0 0 20px 0;
    font-size: 1.3rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.result-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}

.result-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

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

/* Comparison Section */
.comparison-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.comparison-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.radio-label input[type="radio"] {
    margin-right: 6px;
    cursor: pointer;
}

.comparison-result {
    background: var(--background);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.comparison-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.visual-comparison {
    margin-top: 20px;
}

.height-bar-container {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    justify-content: center;
    height: 200px;
}

.height-bar {
    width: 80px;
    background: linear-gradient(to top, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
    transition: height 0.5s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
}

.height-bar.average {
    background: linear-gradient(to top, var(--text-secondary), #94a3b8);
}

.bar-label {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Information Section */
.info-section {
    margin-top: 30px;
}

.info-card p {
    margin-bottom: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.info-card ul {
    margin-left: 20px;
}

.info-card li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.formula-item {
    background: var(--background);
    padding: 15px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
}

.formula-item code {
    display: block;
    margin-top: 8px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--primary-dark);
}

.conversion-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.conversion-table th,
.conversion-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.conversion-table th {
    background: var(--background);
    font-weight: 600;
    color: var(--text-primary);
}

.conversion-table td {
    color: var(--text-secondary);
}

.conversion-table tr:hover {
    background: var(--background);
}

.benefit-list {
    list-style: none;
    margin-left: 0;
}

.benefit-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.benefit-list li:last-child {
    border-bottom: none;
}

.benefit-list strong {
    color: var(--primary-color);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

/* Ad Containers */
.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    min-height: 90px;
}

.ad-unit {
    background: var(--background);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    min-height: 90px;
}

.ad-top,
.ad-bottom {
    max-width: 728px;
    margin: 20px auto;
}

.ad-below-converter {
    margin: 30px 0;
}

.ad-sidebar .ad-unit {
    min-height: 600px;
    width: 300px;
}

/* When ads are loaded, remove placeholder styling */
.ad-unit.loaded {
    background: transparent;
    border: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 10px;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        margin-top: 30px;
    }

    .ad-sidebar .ad-unit {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .converter-card,
    .info-card {
        padding: 20px;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .comparison-controls {
        grid-template-columns: 1fr;
    }

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

    .height-bar-container {
        height: 150px;
    }

    .height-bar {
        width: 60px;
    }

    .ad-top,
    .ad-bottom {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px 10px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .converter-card,
    .info-card {
        padding: 15px;
    }

    .number-input {
        font-size: 1.25rem;
    }

    .number-input.large {
        font-size: 1.5rem;
    }

    .result-value {
        font-size: 1.25rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .ad-container,
    footer,
    .comparison-section {
        display: none;
    }

    .converter-card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}
