/*
 * licham-tools.css v3 — Redesign theo mockup 2026-06-04.
 * Layout: intro-card | form-card | glossary-card | note-card.
 * Màu: xanh lá brand #15803d. H2: bold + green bar ::after.
 *
 * ⚠️ JS hook classes — KHÔNG đổi tên:
 *   .licham-tool, .licham-tool__form, .licham-tool__year, .licham-tool__days,
 *   .licham-tool__submit, .licham-tool__result, .licham-tool__hint,
 *   .licham-tool__day, .licham-tool__item, .licham-tool__ly,
 *   .licham-tool__tuoi, .licham-tool__verdict, .licham-tool__muted,
 *   .licham-tool__note, .licham-tool__muc, .licham-tool__error
 */

/* ──────────────── TOKENS ──────────────── */
.licham-tool,
.licham-hub {
    --t-green:      #15803d;
    --t-green-dark: #166534;
    --t-green-bg:   #f0fdf4;
    --t-green-soft: #dcfce7;
    --t-border:     #e5e7eb;
    --t-muted:      #6b7280;
    --t-text:       #1f2937;
    --t-radius:     12px;
    --t-radius-sm:  8px;
    --t-red:        #b91c1c;
}

/* ──────────────── WRAPPER ──────────────── */
.licham-tool,
.licham-hub {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ──────────────── SHARED CARD ──────────────── */
.licham-tool__intro-card,
.licham-tool__form-card,
.licham-tool__glossary-card,
.licham-hub__intro-card {
    background: #fff;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
    padding: 1.25rem;
}

/* ──────────────── H2 SECTION TITLE (đồng bộ) ──────────────── */
.licham-tool__section-title,
.licham-hub__section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--t-text);
    margin: 0 0 1rem;
    position: relative;
    padding-bottom: .6rem;
    display: inline-block; /* giúp ::after chỉ bằng text */
}

.licham-tool__section-title::after,
.licham-hub__section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 32px;
    height: 3px;
    background: var(--t-green);
    border-radius: 2px;
}

/* Sau title cần display block để dùng margin-bottom đúng */
.licham-tool__section-title {
    display: block;
}

/* ──────────────── INTRO CARD ──────────────── */
.licham-tool__intro-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border-left: 3px solid var(--t-green);
}

.licham-tool__intro-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: var(--t-green-bg);
    border-radius: 50%;
    color: var(--t-green-dark);
    flex-shrink: 0;
}

.licham-tool__intro-icon svg {
    width: 22px;
    height: 22px;
}

.licham-tool__intro-body p {
    margin: 0 0 .6rem;
    font-size: .92rem;
    line-height: 1.7;
    color: var(--t-text);
}

.licham-tool__intro-body p:last-child {
    margin-bottom: 0;
}

/* ──────────────── FORM CARD ──────────────── */
/* hint: JS toggle hidden */
.licham-tool__hint {
    margin: 0 0 .75rem;
    padding: .55rem .85rem;
    background: var(--t-green-bg);
    border-left: 3px solid var(--t-green);
    border-radius: 0 var(--t-radius-sm) var(--t-radius-sm) 0;
    font-size: .88rem;
    font-weight: 600;
    color: var(--t-green-dark);
}

.licham-tool__form {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

/* 2 cột ngang trên desktop */
.licham-tool__fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}

.licham-tool__field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.licham-tool__field-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--t-text);
}

/* Input wrapper để đặt icon / stepper */
.licham-tool__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.licham-tool__input-wrap input {
    width: 100%;
    padding: .6rem .85rem;
    border: 1.5px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    font-size: .95rem;
    font-family: inherit;
    color: var(--t-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    -moz-appearance: textfield; /* ẩn spinner Firefox */
}

.licham-tool__input-wrap input::-webkit-outer-spin-button,
.licham-tool__input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.licham-tool__input-wrap input:focus {
    outline: none;
    border-color: var(--t-green);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, .12);
}

/* Icon bên phải input năm sinh */
.licham-tool__input-wrap--has-icon input {
    padding-right: 2.4rem;
}

.licham-tool__input-icon {
    position: absolute;
    right: .7rem;
    color: var(--t-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.licham-tool__input-icon svg {
    width: 18px;
    height: 18px;
}

/* Stepper +/- cho input số ngày */
.licham-tool__input-wrap--stepper input {
    padding-right: 4.5rem;
    text-align: left;
}

.licham-tool__stepper {
    position: absolute;
    right: 4px;
    display: flex;
    gap: 2px;
}

.licham-tool__stepper-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--t-border);
    border-radius: 6px;
    background: #f9fafb;
    color: var(--t-text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: background .15s;
    padding: 0;
}

.licham-tool__stepper-btn:hover {
    background: var(--t-green-bg);
    border-color: var(--t-green);
    color: var(--t-green-dark);
}

.licham-tool__help {
    font-size: .78rem;
    color: var(--t-muted);
    line-height: 1.5;
}

/* NÚT SUBMIT — xanh lá, full width */
.licham-tool__submit {
    width: 100%;
    padding: .75rem 1.5rem;
    border: none;
    border-radius: var(--t-radius-sm);
    background: var(--t-green-dark);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: .01em;
    transition: background .2s, transform .1s;
    margin-top: .25rem;
}

.licham-tool__submit:hover {
    background: #14532d;
}

.licham-tool__submit:active {
    transform: scale(.99);
}

.licham-tool__submit[disabled] {
    opacity: .65;
    cursor: progress;
}

/* ──────────────── RESULT (JS render vào đây) ──────────────── */
.licham-tool__result {
    background: #fff;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
    padding: 1.25rem;
}

.licham-tool__result h3 {
    font-size: .92rem;
    font-weight: 700;
    color: var(--t-text);
    margin: .85rem 0 .4rem;
    padding-left: .6rem;
    border-left: 3px solid var(--t-green);
}

.licham-tool__result h3:first-child {
    margin-top: 0;
}

.licham-tool__tuoi {
    font-size: .92rem;
    font-weight: 700;
    color: var(--t-green-dark);
    background: var(--t-green-bg);
    padding: .45rem .75rem;
    border-radius: var(--t-radius-sm);
    margin: 0 0 .75rem;
}

.licham-tool__verdict {
    font-size: 1rem;
    font-weight: 700;
    color: var(--t-green-dark);
    margin: 0 0 .5rem;
}

.licham-tool__day {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .7rem;
    margin: .3rem 0;
    background: #f9fafb;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    text-decoration: none;
    color: var(--t-green-dark);
    font-size: .88rem;
    font-weight: 600;
    transition: background .15s, border-color .15s;
}

.licham-tool__day:hover {
    background: var(--t-green-bg);
    border-color: var(--t-green);
}

.licham-tool__item {
    margin: .4rem 0;
    padding: .55rem .7rem;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    background: #fff;
}

.licham-tool__item .licham-tool__day {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0 0 .3rem;
}

.licham-tool__item .licham-tool__day:hover {
    background: transparent;
    border-color: transparent;
}

.licham-tool__ly {
    margin: .2rem 0 0 .3rem;
    padding: 0 0 0 1rem;
    font-size: .8rem;
    color: var(--t-muted);
}

.licham-tool__ly li {
    margin: .15rem 0;
}

.licham-tool__muted,
.licham-tool__muc {
    font-size: .83rem;
    color: var(--t-muted);
    margin: .4rem 0 0;
}

.licham-tool__muc { font-style: italic; }

.licham-tool__error {
    color: var(--t-red);
    font-weight: 600;
    font-size: .9rem;
}

/* ──────────────── GLOSSARY CARD ──────────────── */
.licham-tool__glossary-card {
    background: #fff;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
    padding: 1.25rem;
}

/* Rows dạng badge + text (không accordion) */
.licham-tool__glossary-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.licham-tool__glossary-row {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--t-border);
}

.licham-tool__glossary-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.licham-tool__glossary-row:first-child {
    padding-top: 0;
}

.licham-tool__glossary-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 72px;
    max-width: 80px;
    padding: .35rem .5rem;
    background: var(--t-green-bg);
    border: 1px solid var(--t-green-soft, #bbf7d0);
    border-radius: var(--t-radius-sm);
    font-size: .78rem;
    font-weight: 700;
    color: var(--t-green-dark);
    line-height: 1.3;
    flex-shrink: 0;
    word-break: break-word;
}

.licham-tool__glossary-text {
    font-size: .87rem;
    color: var(--t-muted);
    line-height: 1.65;
    margin: 0;
    padding-top: .15rem;
}

/* ──────────────── NOTE CARD (Lưu ý quan trọng) ──────────────── */
.licham-tool__note-card {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    background: var(--t-green-bg);
    border: 1px solid var(--t-green-soft, #bbf7d0);
    border-radius: var(--t-radius);
    padding: 1rem 1.1rem;
}

.licham-tool__note-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: var(--t-green-dark);
    border-radius: 50%;
    color: #fff;
    flex-shrink: 0;
}

.licham-tool__note-icon svg {
    width: 20px;
    height: 20px;
}

.licham-tool__note-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--t-green-dark);
    margin: 0 0 .25rem;
}

.licham-tool__note-desc {
    font-size: .84rem;
    color: var(--t-text);
    line-height: 1.6;
    margin: 0;
}

/* ──────────────── HUB — card layout mới ──────────────── */
.licham-hub__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Card: ảnh full làm nền, text đè lên trên */
.licham-hub__card {
    position: relative;
    border-radius: 16px;
    border: 2.5px solid #e5e7eb;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    min-height: 200px;
    display: block;
    transition: transform .2s, box-shadow .2s;
}

.licham-hub__card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .12);
}

/* ── ẢNH: full card, làm nền ── */
.licham-hub__card-img {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.licham-hub__card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;         /* hiện trọn chủ thể, không cắt */
    object-position: right bottom;
    display: block;
}

/* ── OVERLAY: gradient trắng từ trái → trong suốt để chữ đọc được ── */
.licham-hub__card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(255,255,255,1)   0%,
        rgba(255,255,255,.95) 40%,
        rgba(255,255,255,.5)  65%,
        rgba(255,255,255,0)   100%
    );
    z-index: 1;
}

/* ── TEXT: đè lên ảnh + overlay ── */
.licham-hub__card-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .6rem;
    padding: 1.6rem 55% 1.6rem 1.5rem; /* padding-right 55% → chừa chỗ cho ảnh */
    min-height: 200px;
}

/* Title */
.licham-hub__card-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
    display: block;
}

/* Mô tả */
.licham-hub__card-desc {
    font-size: .84rem;
    color: #374151;
    line-height: 1.55;
    display: block;
}

/* Nút "Xem ngay →" */
.licham-hub__card-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .85rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    border: 1.5px solid currentColor;
    width: fit-content;
    margin-top: .2rem;
    transition: opacity .15s;
    background: transparent;
}

.licham-hub__card:hover .licham-hub__card-btn {
    opacity: .75;
}



/* ──────────────── RESPONSIVE ──────────────── */
@media (max-width: 640px) {
    .licham-hub__grid {
        grid-template-columns: 1fr;
    }

    .licham-hub__card {
        min-height: 150px;
        grid-template-columns: 1fr 38%;   /* ảnh hẹp hơn chút trên mobile */
    }
    /* Ảnh vẫn cover lấp đầy ô (giữ rule absolute inset + cover ở trên), KHÔNG ép kích thước cố định. */
}

@media (max-width: 520px) {
    .licham-tool__fields-row {
        grid-template-columns: 1fr;
    }

    .licham-tool__intro-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}


.licham-hub__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .45rem;
    padding: 1rem;
    background: #fff;
    border: 1.5px solid var(--t-border);
    border-radius: var(--t-radius);
    text-decoration: none;
    color: var(--t-text);
    transition: border-color .2s, box-shadow .2s, transform .15s;
}

.licham-hub__item:hover {
    border-color: var(--t-green);
    box-shadow: 0 4px 12px rgba(21, 128, 61, .1);
    transform: translateY(-2px);
}

.licham-hub__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--t-green-bg);
    border-radius: 8px;
    color: var(--t-green-dark);
    flex-shrink: 0;
}

.licham-hub__icon svg {
    width: 20px;
    height: 20px;
}

.licham-hub__label {
    font-size: .95rem;
    font-weight: 700;
    color: var(--t-green-dark);
}

.licham-hub__desc {
    font-size: .8rem;
    color: var(--t-muted);
    line-height: 1.5;
}

.licham-hub__arrow {
    margin-top: .2rem;
    color: var(--t-green);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .2s, transform .2s;
}

.licham-hub__item:hover .licham-hub__arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ──────────────── RESPONSIVE ──────────────── */
@media (max-width: 520px) {
    .licham-tool__fields-row {
        grid-template-columns: 1fr;
    }

    .licham-hub__grid {
        grid-template-columns: 1fr;
    }

    .licham-tool__intro-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
