/* ============================================================
   ELP Plugin — Shared Tool Styles (LDM, CFT/Unit Converter, Insurance)
   Palette: Teal #1E9E87 | Dark #0D1B2A | Accent #F4A261
   All tools use .elvc-wrap for CSS variable inheritance.
   ============================================================ */

/* ── Tool Header ─────────────────────────────────────────────── */
.elp-tool-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px 28px 20px;
    background: #ffffff;
    border-bottom: 1px solid var(--border, #d4e4e1);
}

.elp-tool-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--teal-light, #e6f7f4);
    color: var(--teal, #1E9E87);
    font-size: 24px;
    border-radius: 12px;
    font-style: normal;
}

.elp-tool-title {
    font-size: clamp(18px, 2.5vw, 24px);
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--dark, #0D1B2A);
    margin: 0 0 4px;
    line-height: 1.2;
}

.elp-tool-subtitle {
    font-size: 13px;
    color: var(--muted, #6b7f8e);
    margin: 0;
    line-height: 1.4;
}

/* ── Tool Body ───────────────────────────────────────────────── */
.elp-tool-body {
    padding: 24px 28px 28px;
    background: var(--bg, #f7fafa);
}

/* ── Two-column grid ─────────────────────────────────────────── */
.elp-tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 540px) {
    .elp-tool-grid {
        grid-template-columns: 1fr;
    }
}

.elp-tool-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Field groups ────────────────────────────────────────────── */
.elp-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.elp-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 360px) {
    .elp-field-row {
        grid-template-columns: 1fr;
    }
}

/* ── Labels ──────────────────────────────────────────────────── */
.elp-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #1a2a36);
    letter-spacing: .01em;
}

/* ── Inputs & Selects ────────────────────────────────────────── */
.elp-input,
.elp-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text, #1a2a36);
    background: #ffffff;
    border: 1.5px solid var(--border, #d4e4e1);
    border-radius: var(--radius-sm, 6px);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.07));
    transition: border-color .15s ease, box-shadow .15s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.elp-input:focus,
.elp-select:focus {
    border-color: var(--teal, #1E9E87);
    box-shadow: 0 0 0 3px rgba(30, 158, 135, .15);
}

.elp-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7f8e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.elp-mt-sm {
    margin-top: 8px;
}

/* ── Calculate button ────────────────────────────────────────── */
.elp-calc-btn {
    display: block;
    width: 100%;
    padding: 13px 24px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #ffffff;
    background: var(--teal, #1E9E87);
    border: none;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
    box-shadow: 0 2px 8px rgba(30, 158, 135, .30);
    margin-bottom: 20px;
}

.elp-calc-btn:hover {
    background: var(--teal-dark, #167a6a);
    box-shadow: 0 4px 16px rgba(30, 158, 135, .40);
}

.elp-calc-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(30, 158, 135, .25);
}

/* ── Result box ──────────────────────────────────────────────── */
.elp-result-box {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px;
    background: var(--teal-light, #e6f7f4);
    border: 1.5px solid var(--teal-mid, #b2e4dc);
    border-radius: var(--radius-sm, 6px);
    animation: elp-fadein .25s ease;
}

.elp-result-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--teal-dark, #167a6a);
}

.elp-result-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--teal, #1E9E87);
    letter-spacing: -.02em;
    line-height: 1;
}

.elp-result-unit {
    font-size: 16px;
    font-weight: 700;
    color: var(--teal-dark, #167a6a);
}

.elp-result-breakdown {
    width: 100%;
    font-size: 12px;
    color: var(--muted, #6b7f8e);
    margin: 4px 0 0;
}

/* ── Error message ───────────────────────────────────────────── */
.elp-error-msg {
    padding: 12px 16px;
    background: #fff5f5;
    border: 1.5px solid #fca5a5;
    border-radius: var(--radius-sm, 6px);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 500;
    margin: 0;
}

/* ── Utility ─────────────────────────────────────────────────── */
.elp-hidden {
    display: none !important;
}

@keyframes elp-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Unit Converter — Tab nav ────────────────────────────────── */
.elp-tab-bar,
.elp-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 16px 28px 0;
    background: #ffffff;
    border-bottom: 2px solid var(--border, #d4e4e1);
}

.elp-tab-btn {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted, #6b7f8e);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
    white-space: nowrap;
}

.elp-tab-btn:hover {
    color: var(--teal, #1E9E87);
    background: var(--teal-light, #e6f7f4);
}

.elp-tab-btn.is-active {
    color: var(--teal, #1E9E87);
    border-bottom-color: var(--teal, #1E9E87);
    background: var(--teal-light, #e6f7f4);
}

.elp-tab-panel {
    display: none;
}

.elp-tab-panel.is-active {
    display: block;
    animation: elp-fadein .2s ease;
}

/* ── Unit Converter — Card header, input row, output ──────────── */
.elp-conv-card-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border, #d4e4e1);
    margin-bottom: 10px;
}

.elp-conv-card-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text, #1a2a36);
    line-height: 1.3;
}

.elp-conv-card-note {
    font-size: 11px;
    color: var(--muted, #6b7f8e);
    line-height: 1.4;
}

.elp-conv-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.elp-conv-input-wrap,
.elp-conv-output-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.elp-conv-input-wrap .elp-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 14px;
}

.elp-conv-unit {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted, #6b7f8e);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 28px;
}

.elp-conv-arrow-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #ffffff;
    background: var(--teal, #1E9E87);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
    padding: 0;
    line-height: 1;
}

.elp-conv-arrow-btn:hover {
    background: var(--teal-dark, #167a6a);
    transform: scale(1.1);
}

.elp-conv-output {
    font-size: 18px;
    font-weight: 800;
    color: var(--muted, #6b7f8e);
    transition: color .2s ease;
    white-space: nowrap;
    letter-spacing: -.01em;
}

.elp-conv-output.elp-conv-output--active {
    color: var(--teal, #1E9E87);
}

@media (max-width: 420px) {
    .elp-conv-input-row {
        flex-wrap: wrap;
    }
    .elp-conv-input-wrap {
        flex: 1 1 100%;
    }
    .elp-conv-output-wrap {
        flex: 1 1 100%;
        justify-content: flex-end;
    }
    .elp-conv-arrow-btn {
        order: 3;
        align-self: flex-end;
    }
}

/* ── Unit Converter — Conversion cards grid ──────────────────── */
.elp-conv-grid {
    display: grid;
    /* Fixed 2-column on wide, 1-column on narrow — no orphan cards */
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: stretch;
}

@media (max-width: 600px) {
    .elp-conv-grid {
        grid-template-columns: 1fr;
    }
}

.elp-conv-card {
    background: #ffffff;
    border: 1.5px solid var(--border, #d4e4e1);
    border-radius: var(--radius, 10px);
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.07));
    transition: box-shadow .15s ease, border-color .15s ease;
    /* Equal height within each row */
    height: 100%;
    box-sizing: border-box;
}

.elp-conv-card:hover {
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,.10));
    border-color: var(--teal-mid, #b2e4dc);
}

.elp-conv-card-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted, #6b7f8e);
    margin: 0;
}

.elp-conv-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.elp-conv-row .elp-input {
    flex: 1;
    min-width: 0;
}

.elp-conv-btn {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background: var(--teal, #1E9E87);
    border: none;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease;
    line-height: 1.2;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.elp-conv-btn:hover {
    background: var(--teal-dark, #167a6a);
}

.elp-conv-result {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted, #6b7f8e);
    margin: 0;
    min-height: 18px;
    transition: color .15s ease;
    /* Push result to bottom of card for alignment */
    margin-top: auto;
}

.elp-conv-result--active {
    color: var(--teal, #1E9E87);
    font-size: 15px;
}

/* ── Insurance body max-width ────────────────────────────────── */
.elp-ins-body {
    max-width: min(640px, 100%);
}

/* ── Responsive: narrow screens ─────────────────────────────── */
@media (max-width: 480px) {
    .elp-tool-header {
        padding: 18px 16px 14px;
        gap: 12px;
    }
    .elp-tool-body {
        padding: 16px 16px 20px;
    }
    .elp-tab-nav {
        padding: 12px 16px 0;
        gap: 2px;
    }
    .elp-tab-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
    .elp-tool-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .elp-conv-row {
        flex-direction: column;
    }
    .elp-conv-btn {
        width: 100%;
        justify-content: center;
    }
}
