/**
 * JH Skills - Financial Calculator Styles
 */

.jh-calc-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 16px;
    color: #1a1a2e;
    -webkit-font-smoothing: antialiased;
}

.jh-calc-wrapper *,
.jh-calc-wrapper *::before,
.jh-calc-wrapper *::after {
    box-sizing: border-box;
}

.jh-calc-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #1a1a2e;
}

.jh-calc-subtitle {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 28px;
}

/* Description / glossary section */
.jh-calc-description {
    margin-top: 36px;
    margin-bottom: 0;
}

.jh-calc-description > h3 {
    font-size: 13px;
    font-weight: 700;
    color: #9ca3af;
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.jh-calc-description > h3:not(:first-child) {
    margin-top: 28px;
}

.jh-calc-description > p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.65;
}

.jh-calc-glossary {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 13.5px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.jh-calc-glossary tr {
    border-bottom: 1px solid #e5e7eb;
}

.jh-calc-glossary tr:last-child {
    border-bottom: none;
}

.jh-calc-glossary tr:nth-child(even) {
    background: #f9fafb;
}

.jh-gloss-term {
    font-weight: 600;
    color: #374151;
    padding: 11px 20px 11px 16px;
    vertical-align: top;
    white-space: nowrap;
    width: 220px;
    min-width: 220px;
    border-right: 1px solid #e5e7eb;
    background: inherit;
}

.jh-gloss-def {
    color: #6b7280;
    padding: 11px 16px;
    vertical-align: top;
    line-height: 1.55;
}

/* Grid layout */
.jh-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 768px) {
    .jh-calc-grid {
        grid-template-columns: 1fr;
    }
}

.jh-calc-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin: 0 0 16px;
    padding: 0;
}

/* Inputs */
.jh-calc-inputs {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.jh-calc-field {
    margin-bottom: 14px;
}

.jh-calc-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

/* Tooltip "i" icon next to labels */
.jh-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
    cursor: help;
    position: relative;
    vertical-align: middle;
    user-select: none;
    transition: background 120ms, color 120ms;
}

.jh-tip:hover,
.jh-tip:focus,
.jh-tip.jh-tip-open {
    background: #18AF84;
    color: #fff;
    outline: none;
}

.jh-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: none;
    padding: 8px 10px;
    border-radius: 6px;
    width: max-content;
    max-width: 240px;
    white-space: normal;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.jh-tip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1a2e;
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms;
    z-index: 10;
}

.jh-tip:hover::after,
.jh-tip:focus::after,
.jh-tip.jh-tip-open::after,
.jh-tip:hover::before,
.jh-tip:focus::before,
.jh-tip.jh-tip-open::before {
    opacity: 1;
    visibility: visible;
}

/* Input error state */
.jh-calc-input-wrap.jh-calc-input-error input {
    border-color: #dc2626;
    background: #fef2f2;
}

.jh-calc-input-wrap.jh-calc-input-error input:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.jh-calc-field-error {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #dc2626;
    margin-top: 4px;
    line-height: 1.4;
}

/* Top-of-calculator validation banner */
.jh-calc-error-banner {
    display: none;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    line-height: 1.4;
}

.jh-calc-error-banner.jh-calc-error-banner-visible {
    display: block;
}

.jh-calc-input-wrap {
    position: relative;
}

.jh-calc-input-wrap input {
    width: 100%;
    padding: 9px 12px 9px 28px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #1a1a2e;
    outline: none;
    transition: border-color 150ms, box-shadow 150ms;
    -moz-appearance: textfield;
}

.jh-calc-input-wrap input::-webkit-outer-spin-button,
.jh-calc-input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.jh-calc-input-wrap input:focus {
    border-color: #18AF84;
    box-shadow: 0 0 0 3px rgba(24, 175, 132, 0.12);
    background: #fff;
}

.jh-calc-dollar::before,
.jh-calc-percent::after {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    pointer-events: none;
}

.jh-calc-dollar::before {
    content: '$';
    left: 10px;
}

.jh-calc-percent::after {
    content: '%';
    right: 10px;
}

.jh-calc-percent input {
    padding-left: 12px;
    padding-right: 28px;
}

.jh-calc-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.jh-calc-field-row .jh-calc-field {
    margin-bottom: 0;
}

.jh-calc-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 18px 0;
}

/* Results */
.jh-calc-results {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

/* Funnel visualization */
.jh-calc-funnel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jh-calc-funnel-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 14px;
}

.jh-calc-funnel-label {
    color: #6b7280;
    font-weight: 500;
}

.jh-calc-funnel-value {
    font-weight: 700;
    color: #1a1a2e;
    font-size: 16px;
}

.jh-calc-funnel-final {
    background: linear-gradient(135deg, rgba(24, 175, 132, 0.08), rgba(24, 175, 132, 0.15));
    border: 1px solid rgba(24, 175, 132, 0.2);
}

.jh-calc-funnel-final .jh-calc-funnel-value {
    color: #18AF84;
    font-size: 18px;
}

.jh-calc-funnel-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.jh-calc-funnel-split {
    text-align: center;
    flex-direction: column;
    gap: 2px;
}

/* Metrics */
.jh-calc-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jh-calc-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.jh-calc-metric-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.jh-calc-metric-value {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.jh-calc-metric-hero {
    padding: 14px 16px;
    background: #f9fafb;
    border-radius: 10px;
    margin: 4px 0;
}

.jh-calc-metric-hero .jh-calc-metric-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.jh-calc-metric-hero .jh-calc-metric-value {
    font-size: 22px;
    font-weight: 700;
}

.jh-calc-metric-profit {
    background: linear-gradient(135deg, rgba(24, 175, 132, 0.06), rgba(24, 175, 132, 0.12));
    border: 1px solid rgba(24, 175, 132, 0.15);
}

.jh-calc-metric-profit .jh-calc-metric-value {
    color: #18AF84;
}

.jh-calc-metric-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.jh-calc-metric-row .jh-calc-metric {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 14px;
    background: #f9fafb;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 480px) {
    .jh-calc-wrapper {
        padding: 20px 12px;
    }

    .jh-calc-title {
        font-size: 22px;
    }

    .jh-calc-inputs,
    .jh-calc-results {
        padding: 16px;
    }

    .jh-calc-metric-row {
        grid-template-columns: 1fr;
    }

    .jh-calc-field-row {
        grid-template-columns: 1fr;
    }

    .jh-calc-funnel-row {
        grid-template-columns: 1fr;
    }

    .jh-gloss-term {
        white-space: normal;
    }
}
