/*
 * shared-styles.css
 * Common styles for all converter pages.
 * Injected via header-template.js.
 *
 * COLOR-DEPENDENT RULES ARE NOT HERE.
 * Rules that use per-page accent colors (body background, swap-button gradient,
 * input focus borders, quick-item border-left, formula-box border-left) stay in
 * each page's inline <style> until strip-shared-css.py has been run on that page.
 * After the strip script runs, those rules move here using CSS custom properties.
 */

/* ─── Reset ─────────────────────────────────────────────────────────────── */

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

/* ─── Base ───────────────────────────────────────────────────────────────── */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: #333;
}

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

/* ─── Page header ────────────────────────────────────────────────────────── */

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.back-button {
    display: inline-flex;
    align-items: center;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    margin-bottom: 20px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: 25px;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* ─── Converter card ─────────────────────────────────────────────────────── */

.converter-container {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.conversion-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
}

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

.input-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.input-field {
    display: flex;
    gap: 10px;
}

.input-field input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.input-field input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.unit-select {
    min-width: 140px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.unit-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.swap-button {
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.swap-button:hover {
    transform: rotate(180deg) scale(1.1);
}

/* ─── Result highlight ───────────────────────────────────────────────────── */

.result-highlight {
    color: white;
}

.result-highlight input {
    background: rgba(255,255,255,0.2);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

.result-highlight input::placeholder {
    color: rgba(255,255,255,0.7);
}

.result-highlight .unit-select {
    background: rgba(255,255,255,0.2);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

/* ─── Quick conversions ──────────────────────────────────────────────────── */

.quick-conversions {
    margin-top: 30px;
}

.quick-conversions h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

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

.quick-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.quick-item .conversion {
    font-weight: 600;
    color: #333;
}

.quick-item .description {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 5px;
}

/* ─── Educational section ────────────────────────────────────────────────── */

.educational-section {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.educational-section h2 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.educational-section h3 {
    margin-bottom: 15px;
    margin-top: 25px;
    font-size: 1.2rem;
}

.educational-section p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #495057;
}

.educational-section ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.educational-section li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #495057;
}

/* ─── Shared utilities ───────────────────────────────────────────────────── */

.formula-box {
    background: #f8f9fa;
    border-left: 4px solid var(--accent-color);
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.highlight {
    background: #fff3cd;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .conversion-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .swap-button {
        justify-self: center;
        transform: rotate(90deg);
    }

    .input-field {
        flex-direction: column;
    }

    .unit-select {
        min-width: auto;
    }
}
