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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #F3F8FF;
    color: #333;
    line-height: 1.6;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .converter-grid {
    direction: rtl;
}

/* Header */
header {
    background: #1565C0;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1;
}

/* Language Selector */
.lang-selector {
    position: relative;
}

.lang-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.3);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

.lang-dropdown.show {
    display: block;
}

.lang-dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.lang-dropdown a:last-child {
    border-bottom: none;
}

.lang-dropdown a:hover {
    background: #f5f5f5;
}

.lang-dropdown a.active {
    background: #E3F2FD;
    color: #1565C0;
    font-weight: 600;
}

/* Breadcrumb */
.breadcrumb {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 2rem;
    font-size: 0.85rem;
    color: #666;
}

.breadcrumb a {
    color: #1976D2;
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

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

/* Top Section - Two Column Layout */
.top-section {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 0;
    align-items: start;
    margin-bottom: 1.5rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    order: 2;
}

.intro-section {
    padding: 0;
}

.intro-section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.intro-section p {
    font-size: 1rem;
    font-weight: 400;
    color: #555;
    line-height: 1.6;
}

.intro-section p strong {
    color: #333;
}

@media (max-width: 900px) {
    .top-section {
        grid-template-columns: 1fr;
    }

    .converter-box {
        order: -1;
    }
}

/* Converter Box */
.converter-box {
    background: linear-gradient(135deg, #1976D2 0%, #42A5F5 100%);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(25, 118, 210, 0.25);
    width: 100%;
    max-width: 520px;
    order: 1;
}

/* Swap Button - Inside Converter */
.swap-btn-inside {
    background: rgba(255,255,255,0.25);
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 6px auto -2px;
    position: relative;
    top: 8px;
}

.swap-btn-inside:hover {
    background: rgba(255,255,255,0.4);
    border-color: rgba(255,255,255,0.8);
    transform: rotate(180deg);
}

.swap-btn-inside svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.converter-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.converter-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #E4E9F2;
    border-radius: 8px;
    background: white;
    outline: none;
    transition: border-color 0.3s;
}

.form-group select:focus,
.form-group input:focus {
    border-color: #1976D2;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    background-color: #fff;
}

.form-group select option {
    background-color: #fff;
    color: #333;
    padding: 0.5rem;
}

.form-group select option:hover,
.form-group select option:checked {
    background-color: #1976D2;
    color: white;
}

.result-box {
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    margin-top: 0.5rem;
}

.result-label {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.result-value {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.result-formula {
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 6px;
    font-style: italic;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.btn-copy {
    background: #fb923c;
    color: white;
}

.btn-copy:hover {
    background: #f97316;
}

.btn-reset {
    background: #d1d5db;
    color: #374151;
}

.btn-reset:hover {
    background: #9ca3af;
}

/* Legacy styles for backwards compatibility */
.converter-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.input-group {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1565C0;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: #2196F3;
}

.input-group .unit {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.swap-btn {
    background: #2196F3;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    transition: transform 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: #1976D2;
    transform: rotate(180deg);
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #43A047;
}

.btn-secondary {
    background: #9E9E9E;
    color: white;
}

.btn-secondary:hover {
    background: #757575;
}

.btn-copy {
    background: #fb923c;
    color: white;
}

.btn-copy:hover {
    background: #f97316;
}

.input-hint {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Formula Section */
.formula-section {
    background: transparent;
    padding: 0;
    margin-top: 30px;
}

.formula-section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.formula {
    background: transparent;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    text-align: left;
    color: #333;
    line-height: 1.6;
}

/* Conversion Table */
.table-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.08);
    border: 1px solid rgba(25, 118, 210, 0.06);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.table-section h2 {
    color: #1976D2;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-section h2::before {
    content: "";
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    border-radius: 2px;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.table-card {
    border: 1px solid #E8F0FE;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.table-card:hover {
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.12);
    transform: translateY(-2px);
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
}

.table-card th {
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    color: white;
    padding: 0.875rem 1rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
}

[dir="rtl"] .table-card th {
    text-align: right;
}

.table-card td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #F0F4F8;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
    text-align: center;
}

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

.table-card tr:nth-child(even) {
    background: #FAFCFF;
}

.table-card tr:hover td {
    background: #EEF5FF;
}

/* Full Table Toggle */
.full-table-toggle {
    text-align: center;
    margin-top: 1.5rem;
}

.full-table-toggle button {
    background: transparent;
    border: 2px solid #1976D2;
    color: #1976D2;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.full-table-toggle button:hover {
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.full-table {
    display: none;
    margin-top: 1.5rem;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #E8F0FE;
}

.full-table.show {
    display: block;
}

.full-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.full-table th,
.full-table td {
    padding: 0.625rem 0.5rem;
    border: 1px solid #F0F4F8;
    text-align: center;
    font-size: 0.85rem;
}

.full-table th {
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    color: white;
    font-weight: 600;
    border-color: rgba(255,255,255,0.1);
}

.full-table tr:nth-child(even) {
    background: #FAFCFF;
}

.full-table tr:hover td {
    background: #EEF5FF;
}

/* Unit Info */
.info-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.08);
    border: 1px solid rgba(25, 118, 210, 0.06);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.info-section h2 {
    color: #1976D2;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section h2::before {
    content: "";
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    border-radius: 2px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.info-card {
    background: linear-gradient(135deg, #FAFCFF 0%, #F3F8FF 100%);
    border: 1px solid #E8F0FE;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.info-card:hover {
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.1);
    transform: translateY(-2px);
}

.info-card h3 {
    color: #1976D2;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.info-card p {
    color: #555;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.6;
}

/* FAQ Section */
.faq-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.08);
    border: 1px solid rgba(25, 118, 210, 0.06);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.faq-section h2 {
    color: #1976D2;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.faq-section h2::before {
    content: "";
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    border-radius: 2px;
}

.faq-item {
    background: linear-gradient(135deg, #FAFCFF 0%, #F3F8FF 100%);
    border: 1px solid #E8F0FE;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-item:hover {
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.1);
}

.faq-question {
    font-weight: 700;
    color: #1976D2;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.faq-answer {
    color: #555;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.6;
}

/* Related Links */
.related-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.08);
    border: 1px solid rgba(25, 118, 210, 0.06);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.related-section h2 {
    color: #1976D2;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-section h2::before {
    content: "";
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    border-radius: 2px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.related-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #F8FBFF 0%, #EEF5FF 100%);
    border: 1px solid #E8F0FE;
    border-radius: 12px;
    text-decoration: none;
    color: #1976D2;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-align: center;
}

.related-link:hover {
    background: linear-gradient(135deg, #1976D2, #42A5F5);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

/* Footer */
footer {
    background: linear-gradient(135deg, #1565C0, #1976D2);
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: 1rem;
}

footer a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: white;
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    margin: 0 1rem;
    font-size: 0.95rem;
}

footer p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ========== Responsive Design ========== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem 1.5rem;
    }

    .converter-box {
        padding: 1.5rem;
    }

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

    .related-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile Landscape & Small Tablet (576px - 768px) */
@media (max-width: 768px) {
    /* Header */
    header {
        padding: 0.75rem 1rem;
    }

    .header-inner {
        gap: 0.5rem;
    }

    header h1 {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    /* Language Selector */
    .lang-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .lang-dropdown {
        position: fixed;
        top: 60px;
        right: 1rem;
        left: 1rem;
        transform: none;
        max-height: 60vh;
    }

    [dir="rtl"] .lang-dropdown {
        left: 1rem;
        right: 1rem;
        transform: none;
    }

    /* Breadcrumb */
    .breadcrumb {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    /* Container */
    .container {
        padding: 0 1rem 1rem;
    }

    /* Converter Box */
    .converter-box {
        padding: 1.25rem;
        border-radius: 12px;
        max-width: 100%;
    }

    .converter-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .form-group select,
    .form-group input {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

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

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

    .input-group {
        padding: 1rem;
        border-radius: 10px;
    }

    .input-group label {
        font-size: 0.9rem;
    }

    .input-group input {
        font-size: 1.25rem;
        padding: 0.875rem;
        border-radius: 8px;
    }

    .input-group .unit {
        font-size: 0.8rem;
    }

    .swap-btn {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
        transform: rotate(90deg);
        margin: 0.25rem auto;
    }

    .swap-btn:hover {
        transform: rotate(270deg);
    }

    /* Buttons */
    .button-group {
        gap: 0.75rem;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px;
        flex: 1;
        min-width: 100px;
    }

    .input-hint {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    /* Formula Section */
    .formula-section {
        padding: 1rem;
    }

    .formula-section h2 {
        font-size: 1.1rem;
    }

    .formula {
        font-size: 0.95rem;
        padding: 0.875rem;
    }

    /* Table Section */
    .table-section {
        padding: 1rem;
    }

    .table-section h2 {
        font-size: 1.1rem;
    }

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

    .table-card th,
    .table-card td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .full-table-toggle button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: 100%;
    }

    .full-table table {
        min-width: 500px;
    }

    .full-table th,
    .full-table td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }

    /* Info Section */
    .info-section {
        padding: 1rem;
    }

    .info-section h2 {
        font-size: 1.1rem;
    }

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

    .info-card {
        padding: 0.875rem;
    }

    .info-card h3 {
        font-size: 1rem;
    }

    .info-card p {
        font-size: 0.85rem;
    }

    /* FAQ Section */
    .faq-section {
        padding: 1rem;
    }

    .faq-section h2 {
        font-size: 1.1rem;
    }

    .faq-item {
        padding: 0.875rem 0;
    }

    .faq-question {
        font-size: 0.9rem;
    }

    .faq-answer {
        font-size: 0.85rem;
    }

    /* Related Section */
    .related-section {
        padding: 1rem;
    }

    .related-section h2 {
        font-size: 1.1rem;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .related-link {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* Footer */
    footer {
        padding: 1.5rem 1rem;
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
    }

    .footer-links a {
        margin: 0;
        font-size: 0.9rem;
    }

    footer p {
        font-size: 0.8rem;
    }

    /* Toast */
    .toast {
        left: 1rem;
        right: 1rem;
        transform: translateY(100px);
        text-align: center;
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }

    .toast.show {
        transform: translateY(0);
    }
}

/* Mobile Portrait (max-width: 480px) */
@media (max-width: 480px) {
    /* Header */
    header {
        padding: 0.625rem 0.75rem;
    }

    header h1 {
        font-size: 1.1rem;
        max-width: 180px;
    }

    .lang-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-height: 44px; /* Touch-friendly */
    }

    .lang-btn span {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Breadcrumb */
    .breadcrumb {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Container */
    .container {
        padding: 0 0.75rem 1rem;
    }

    /* Top Section Mobile Optimization */
    .top-section {
        gap: 1rem;
    }

    .left-column {
        order: 2;
        padding: 0;
    }

    .intro-section h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .intro-section p {
        font-size: 0.95rem;
        font-weight: 500;
        line-height: 1.5;
    }

    /* Converter Box - Enhanced Mobile */
    .converter-box {
        padding: 1.25rem;
        border-radius: 16px;
        margin-bottom: 0.75rem;
    }

    .converter-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .converter-form {
        padding: 0;
        gap: 10px;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }

    .form-group select,
    .form-group input {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevents iOS zoom on focus */
        border-radius: 10px;
        min-height: 50px; /* Touch-friendly */
    }

    .swap-btn-inside {
        width: 44px;
        height: 44px;
        margin: 8px auto;
    }

    .swap-btn-inside svg {
        width: 22px;
        height: 22px;
    }

    .result-box {
        padding: 1.25rem;
        margin-top: 0.75rem;
        border-radius: 12px;
    }

    .result-label {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    .result-value {
        font-size: 2.25rem;
        font-weight: 800;
    }

    .result-formula {
        font-size: 0.9rem;
        margin-top: 10px;
    }

    /* Action Buttons - Enhanced Mobile */
    .action-buttons {
        gap: 10px;
        margin-top: 1rem;
    }

    .action-btn {
        flex: 1;
        padding: 12px 16px;
        min-height: 48px; /* Touch-friendly */
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .action-btn svg {
        width: 18px;
        height: 18px;
    }

    .converter-grid {
        gap: 0.5rem;
    }

    .input-group {
        padding: 0.875rem;
    }

    .input-group label {
        font-size: 0.85rem;
        margin-bottom: 0.375rem;
    }

    .input-group input {
        font-size: 1.125rem;
        padding: 0.75rem;
    }

    .input-group .unit {
        font-size: 0.75rem;
        margin-top: 0.375rem;
    }

    .swap-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    /* Buttons - Stack vertically on very small screens */
    .button-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

    .input-hint {
        font-size: 0.7rem;
        margin-top: 0.75rem;
    }

    /* Formula Section Mobile */
    .formula-section {
        margin-top: 1.5rem;
        padding: 0;
    }

    .formula-section h2 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .formula {
        font-size: 0.95rem;
        padding: 0;
        line-height: 1.7;
    }

    /* Sections */
    .table-section,
    .info-section,
    .faq-section,
    .related-section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .table-section h2,
    .info-section h2,
    .faq-section h2,
    .related-section h2 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    /* Table */
    .table-grid {
        gap: 0.5rem;
    }

    .table-card {
        border-radius: 8px;
    }

    .table-card th,
    .table-card td {
        padding: 0.5rem 0.4rem;
        font-size: 0.85rem;
    }

    .full-table-toggle button {
        padding: 0.625rem 1.25rem;
        font-size: 0.8rem;
        border-radius: 20px;
    }

    /* Info Cards */
    .info-card {
        padding: 1rem;
    }

    .info-card h3 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    .info-card p {
        font-size: 0.9rem;
        font-weight: 500;
    }

    /* FAQ Items */
    .faq-item {
        padding: 0.875rem 1rem;
        border-radius: 10px;
    }

    .faq-question {
        font-size: 0.95rem;
        margin-bottom: 0.375rem;
    }

    .faq-answer {
        font-size: 0.875rem;
        font-weight: 500;
    }

    /* Related Grid - Two columns on mobile */
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .related-link {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        border-radius: 10px;
    }

    /* Footer */
    footer {
        padding: 1.5rem 0.75rem;
    }

    .footer-links {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
    }

    .footer-links a {
        font-size: 0.85rem;
    }

    footer p {
        font-size: 0.75rem;
        margin-top: 0.75rem;
    }
}

/* Extra small devices (max-width: 360px) */
@media (max-width: 360px) {
    header h1 {
        font-size: 0.9rem;
        max-width: 140px;
    }

    .converter-title {
        font-size: 1rem;
    }

    .input-group input {
        font-size: 1rem;
        padding: 0.625rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .swap-btn:hover {
        transform: rotate(90deg);
    }

    .related-link:hover {
        background: #F5F5F5;
        color: #2196F3;
    }

    .related-link:active {
        background: #2196F3;
        color: white;
    }

    /* Larger touch targets */
    .lang-dropdown a {
        padding: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

/* Landscape mode optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 0.5rem 1rem;
    }

    header h1 {
        font-size: 1rem;
    }

    .converter-box {
        padding: 0.75rem;
    }

    .converter-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .converter-grid {
        grid-template-columns: 1fr auto 1fr;
        gap: 0.5rem;
    }

    .swap-btn {
        transform: rotate(0deg);
        width: 36px;
        height: 36px;
    }

    .input-group {
        padding: 0.5rem;
    }

    .input-group input {
        padding: 0.5rem;
        font-size: 1rem;
    }

    .button-group {
        flex-direction: row;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* Safe area for notched devices (iPhone X+) */
@supports (padding: max(0px)) {
    header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    footer {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}

/* Print styles */
@media print {
    header, footer, .lang-selector, .button-group, .related-section {
        display: none;
    }

    .converter-box {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    body {
        background: white;
    }
}
