/* ============================================================
   Convert Units HQ - Shared Stylesheet
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --primary-color: #667eea;
    --primary-hover: #5a67d8;
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --bg-light: #F8FAFC;
    --border-color: #E2E8F0;
    --card-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

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

/* ---- Base ---- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background: #ffffff;
}

/* ---- Header ---- */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #fff;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}
.logo svg { flex-shrink: 0; }
.nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 20px;
    opacity: 0.9;
    font-weight: 600;
}
.nav a:hover { opacity: 1; }

/* ---- Breadcrumb ---- */
.breadcrumb {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--primary-color); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

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

/* ---- Hero ---- */
.hero { text-align: center; margin-bottom: 40px; }
.hero h1 { font-size: 2.5rem; margin-bottom: 15px; color: var(--text-primary); }
.hero p { font-size: 1.2rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }

/* ---- Converter Card ---- */
.converter-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 40px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
}
.converter-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
}

/* ---- Input Group ---- */
.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.input-group input {
    width: 100%;
    padding: 16px;
    font-size: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    transition: border-color 0.3s;
    -moz-appearance: textfield;
    appearance: textfield;
}
.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.input-group input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }

/* ---- Swap Button ---- */
.swap-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.swap-btn:hover { background: var(--primary-hover); transform: rotate(180deg); }
.swap-btn:focus { outline: 2px solid var(--primary-color); outline-offset: 3px; }

/* ---- Result Display ---- */
.result-display {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #fff;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}
.result-display .label { font-size: 0.9rem; opacity: 0.9; margin-bottom: 5px; }
.result-display .value { font-size: 2.5rem; font-weight: 700; }

/* ---- Formula Box ---- */
.formula-box {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border-left: 4px solid var(--primary-color);
}
.formula-box h3 { color: var(--primary-color); margin-bottom: 10px; }
.formula-box code {
    background: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 1.1rem;
    display: inline-block;
}

/* ---- Quick Tip ---- */
.quick-tip {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    padding: 15px 20px;
    border-radius: 12px;
    margin: 20px 0;
}
.quick-tip strong { color: #b45309; }

/* ---- Section ---- */
.section { margin-bottom: 50px; }
.section h2 { font-size: 1.8rem; margin-bottom: 20px; color: var(--text-primary); }

/* ---- Conversion Table ---- */
.conversion-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.conversion-table th,
.conversion-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
.conversion-table th { background: var(--primary-color); color: #fff; }
.conversion-table tr:hover { background: var(--bg-light); }
.conversion-table .description { color: var(--text-muted); font-size: 0.9rem; }

/* ---- FAQ ---- */
.faq-item { border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 15px; overflow: hidden; }
.faq-question {
    width: 100%;
    padding: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: none;
    text-align: left;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
}
.faq-question:hover { background: var(--bg-light); }
.faq-question:focus { outline: 2px solid var(--primary-color); outline-offset: -2px; }
.faq-answer { padding: 0 20px 20px; color: var(--text-secondary); display: none; }
.faq-item.active .faq-answer { display: block; }
.faq-item.active .faq-icon { transform: rotate(180deg); }
.faq-icon { transition: transform 0.3s; flex-shrink: 0; }

/* ---- Ad Slot ---- */
.ad-slot {
    background: var(--bg-light);
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    margin: 30px 0;
    min-height: 100px;
}

/* ---- Related Section ---- */
.related-section { background: var(--bg-light); padding: 30px; border-radius: 16px; margin-top: 40px; }
.related-section h3 { margin-bottom: 20px; font-size: 1.3rem; }
.related-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.related-link {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}
.related-link:hover { transform: translateY(-2px); box-shadow: var(--card-shadow); }
.related-link strong { color: var(--primary-color); display: block; margin-bottom: 4px; }
.related-link small { color: var(--text-muted); }

/* ---- Footer ---- */
.footer {
    background: var(--text-primary);
    color: #fff;
    padding: 40px 20px;
    text-align: center;
    margin-top: 60px;
}
.footer a { color: rgba(255,255,255,0.8); text-decoration: none; }
.footer a:hover { color: #fff; }

/* ---- Error Message ---- */
.input-error { color: #dc2626; font-size: 0.85rem; margin-top: 6px; display: none; }
.input-error.visible { display: block; }

/* ---- Temp Indicator (F-to-C page) ---- */
.temp-indicator { display: flex; justify-content: center; gap: 20px; margin-top: 20px; }
.temp-badge { padding: 10px 20px; border-radius: 20px; font-weight: 600; font-size: 0.9rem; }
.temp-badge.cold { background: #dbeafe; color: #1d4ed8; }
.temp-badge.mild { background: #dcfce7; color: #15803d; }
.temp-badge.warm { background: #fef3c7; color: #b45309; }
.temp-badge.hot { background: #fee2e2; color: #dc2626; }

/* ---- Height Converter (cm-to-inches) ---- */
.height-converter { background: #fef3c7; border: 1px solid #f59e0b; padding: 20px; border-radius: 12px; margin: 20px 0; }
.height-converter h4 { color: #b45309; margin-bottom: 10px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }
    .header-content { flex-direction: column; text-align: center; gap: 8px; }
    .nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }
    .nav a { margin-left: 10px; }
    .container { padding: 14px; }
    .converter-card { padding: 24px 16px; }
    .converter-grid { grid-template-columns: 1fr; }
    .input-group input { font-size: 1.2rem; padding: 14px; }
    .result-display { padding: 20px; }
    .result-display .value { font-size: 1.8rem; }
    .section h2 { font-size: 1.4rem; }
    .conversion-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .related-links { grid-template-columns: 1fr 1fr; gap: 10px; }
    .related-link { padding: 14px; }
    .related-section { padding: 20px 16px; }
    .breadcrumb { font-size: 0.8rem; }
    .footer { padding: 24px 16px; }
    .swap-btn { margin: 0 auto; }
}
