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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 400;
}

/* Content wrapper for desktop layout */
.content-wrapper {
    display: flex;
    gap: 30px;
    flex: 1;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Sidebar */
.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
}

.formula-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.formula-box h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
}

.formula {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    color: #34495e;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.formula p {
    margin: 8px 0;
}

.converter-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.input-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 200px;
}

.input-box label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.input-box input {
    width: 100%;
    padding: 15px 60px 15px 15px;
    font-size: 1.2rem;
    border: 2px solid #bdc3c7;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.input-box input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.2);
}

.input-box input:invalid {
    border-color: #e74c3c;
}

.unit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    font-weight: 600;
    pointer-events: none;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.conversion-arrow {
    font-size: 2rem;
    color: #3498db;
    font-weight: bold;
    margin: 0 20px;
}

.calculation-display {
    background: #ecf0f1;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#calculation-result {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
}

.info-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.info-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

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

.info-section li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
}

.info-section li::before {
    content: "•";
    color: #3498db;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Advertisement Styles */
.ad-space {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #6c757d;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

.ad-placeholder:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #adb5bd;
}

.ad-placeholder span {
    display: block;
    font-size: 0.9rem;
    margin: 2px 0;
}

.ad-placeholder small {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-top: 5px;
}

/* Header Ad */
.ad-header .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

/* Sidebar Ads */
.ad-sidebar .ad-placeholder {
    width: 300px;
    height: 250px;
}

/* Footer Ad */
.ad-footer .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Navigation */
.nav-links {
    display: none; /* Hidden by default for single page */
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.nav-links a {
    text-decoration: none;
    color: #3498db;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-links a:hover,
.nav-links a:focus {
    background: #3498db;
    color: white;
    outline: none;
}

/* Formula description */
.formula-description {
    margin-top: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #27ae60;
}

.formula-description h3 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.formula-description ul {
    list-style: none;
    padding-left: 0;
}

.formula-description li {
    padding: 8px 0;
    color: #555;
}

.formula-description strong {
    color: #2c3e50;
}

/* Unit selector styles */
.unit-selector {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    text-align: center;
}

.unit-selector h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.radio-group {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: #555;
    transition: color 0.3s ease;
}

.radio-label:hover {
    color: #3498db;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-button {
    width: 20px;
    height: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-button {
    border-color: #3498db;
    background: #3498db;
}

.radio-label input[type="radio"]:checked + .radio-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Related links in sidebar */
.related-links {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.related-links h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.related-links ul {
    list-style: none;
    padding-left: 0;
}

.related-links li {
    margin-bottom: 10px;
}

.related-links a {
    color: #3498db;
    text-decoration: none;
    padding: 8px 12px;
    display: block;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.related-links a:hover,
.related-links a:focus {
    background: #f8f9fa;
    color: #2980b9;
    outline: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0 20px 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 30px;
    border-top: 1px solid #ecf0f1;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.footer-nav a {
    color: #95a5a6;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.footer-nav a:hover,
.footer-nav a:focus {
    color: #3498db;
    outline: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 20px;
    }
    
    .ad-sidebar {
        flex: 1;
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 20px;
    }
    
    .conversion-arrow {
        transform: rotate(90deg);
        margin: 10px 0;
    }
    
    .input-box {
        width: 100%;
        min-width: auto;
    }
    
    .formula {
        font-size: 1rem;
    }
    
    /* Mobile ad layout */
    .sidebar {
        flex-direction: column;
        align-items: center;
    }
    
    .ad-header .ad-placeholder,
    .ad-footer .ad-placeholder {
        width: 100%;
        max-width: 500px;
        height: 100px;
    }
    
    .ad-sidebar .ad-placeholder {
        width: 100%;
        max-width: 350px;
        height: 200px;
    }
    
    /* Mobile navigation */
    .nav-links {
        flex-direction: column;
        gap: 15px;
    }
    
    /* Mobile footer */
    .footer-nav ul {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Mobile formula description */
    .formula-description {
        padding: 15px;
    }
    
    .related-links {
        padding: 15px;
    }
    
    /* Mobile unit selector */
    .radio-group {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .unit-selector {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 0;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .converter-section,
    .formula-section,
    .info-section {
        padding: 20px;
    }
}