@import url('https://fonts.googleapis.com/css2?family=Bungee&display=swap');

.sub-neo-wrapper {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 1000px;
    margin: 20px auto;
    border: 3px solid #000000;
    border-radius: 12px;
    box-shadow: 8px 8px 0px #000000;
    padding: 25px;
    background: #ffffff;
    color: #000000;
    box-sizing: border-box;
}

.sub-neo-wrapper * { box-sizing: border-box; }

.sub-header {
    background: #ffb7b2; padding: 15px 20px; border-radius: 12px;
    border: 3px solid #000000; box-shadow: 4px 4px 0px #000000; margin-bottom: 25px; text-align: center;
}
.sub-header h2 { margin: 0 0 5px 0; font-size: 1.8rem; font-weight: 900; text-transform: uppercase; color: #000; }
.sub-header p { margin: 0; font-weight: 800; font-size: 0.95rem; }

/* Ô TÌM KIẾM */
.sub-search-box { display: flex; gap: 15px; margin-bottom: 25px; }
.autocomplete-wrapper { position: relative; flex-grow: 1; display: flex; gap: 15px; }

.sub-neo-input {
    flex-grow: 1; padding: 18px 20px; font-size: 1.2rem; font-weight: 900; font-family: monospace;
    border-radius: 8px; border: 3px solid #000; background: #f4f4f4; color: #000;
    outline: none; box-shadow: inset 3px 3px 0px rgba(0,0,0,0.05); transition: 0.1s;
}
.sub-neo-input:focus { border-color: #ff595e; background: #fff; }

.sub-btn-search {
    cursor: pointer; font-size: 1.2rem; font-weight: 900; padding: 0 25px;
    background-color: #ffca3a; border: 3px solid #000; border-radius: 8px; box-shadow: 4px 4px 0px #000;
    text-transform: uppercase; color: #000; transition: 0.1s; white-space: nowrap;
}
.sub-btn-search:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px #000; }

/* DROPDOWN GỢI Ý */
.autocomplete-dropdown {
    position: absolute; top: 100%; left: 0; right: 130px; z-index: 1000;
    background: #fff; border: 3px solid #000; border-radius: 8px; box-shadow: 5px 5px 0px #000;
    margin-top: 5px; padding: 0; list-style: none; max-height: 300px; overflow-y: auto;
}
.autocomplete-dropdown.hidden { display: none; }
.autocomplete-dropdown li {
    padding: 12px 15px; border-bottom: 2px dashed #ccc; font-weight: 800; font-size: 1.05rem;
    cursor: pointer; color: #333; display: flex; justify-content: space-between; align-items: center;
}
.autocomplete-dropdown li:hover { background: #b5ead7; color: #000; }
.autocomplete-dropdown li:last-child { border-bottom: none; }
.dropdown-formula { font-family: monospace; color: #ff595e; font-weight: 900; }

/* WELCOME BANNER */
.sub-welcome {
    background: #fdfd96; border: 3px solid #000; border-radius: 8px; padding: 30px;
    text-align: center; font-weight: 900; font-size: 1.2rem; box-shadow: 4px 4px 0px #000;
}

/* KẾT QUẢ CHI TIẾT (CARD) */
.sub-result-area.hidden { display: none; }
.sub-card-detail {
    background: #fff; border: 3px solid #000; border-radius: 12px; box-shadow: 6px 6px 0px #000;
    overflow: hidden; animation: subFadeIn 0.3s ease-out; margin-bottom: 25px;
}
@keyframes subFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.sub-card-top {
    background: #b5ead7; padding: 20px 25px; border-bottom: 3px solid #000;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;
}
.sub-title-group h3 { margin: 0 0 5px 0; font-size: 1.8rem; font-weight: 900; text-transform: uppercase; }
.sub-title-group span { font-size: 1.1rem; font-weight: 800; color: #333; }
.sub-formula-badge {
    font-family: monospace; font-size: 2.2rem; font-weight: 900; background: #fff;
    padding: 10px 20px; border: 3px solid #000; border-radius: 8px; box-shadow: 3px 3px 0px #000; color: #ff595e;
}

.sub-card-body { padding: 25px; display: flex; flex-direction: column; gap: 20px; }
.sub-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; }
.info-item { background: #f9f9f9; border: 2px solid #000; border-radius: 6px; padding: 12px 15px; font-weight: 800; font-size: 1.05rem; box-shadow: 2px 2px 0px #000; }
.info-item b { color: #000; text-transform: uppercase; }

.sub-desc-box { background: #fdfd96; border: 3px solid #000; border-radius: 8px; padding: 20px; box-shadow: 3px 3px 0px #000; }
.sub-desc-box h4 { margin: 0 0 10px 0; font-size: 1.2rem; font-weight: 900; text-transform: uppercase; }
.sub-desc-box p { margin: 0; font-size: 1.05rem; line-height: 1.6; font-weight: 600; color: #333; }

/* PHƯƠNG TRÌNH LIÊN QUAN */
.related-eq-box {
    background: #e2f0cb; border: 3px solid #000; border-radius: 12px;
    padding: 25px; box-shadow: 6px 6px 0px #000; animation: subFadeIn 0.4s ease-out;
}
.related-eq-box h4 { margin: 0 0 15px 0; font-size: 1.4rem; font-weight: 900; text-transform: uppercase; border-bottom: 3px dashed #000; padding-bottom: 10px; }
.related-eq-list { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; padding-right: 5px; }
.related-eq-list li {
    padding: 15px; border: 2px solid #000; border-radius: 8px; margin-bottom: 10px; background: #fff;
    display: flex; justify-content: space-between; align-items: center; gap: 15px; font-weight: 900; font-size: 1.2rem; font-family: monospace;
}
.related-eq-list li:last-child { margin-bottom: 0; }
.eq-format-text { word-break: break-all; }
.chem-coef { color: #ff595e; font-size: 1.4rem; margin-right: 2px; }
.chem-arrow { margin: 0 10px; }

.btn-copy-eq {
    cursor: pointer; background: #cbaacb; border: 3px solid #000; border-radius: 6px; padding: 8px 15px;
    font-size: 0.95rem; font-weight: 900; box-shadow: 3px 3px 0px #000; text-transform: uppercase; flex-shrink: 0; transition: 0.1s;
}
.btn-copy-eq:active { transform: translate(3px, 3px); box-shadow: 0px 0px 0px #000; }

#toastSub { visibility: hidden; min-width: 200px; background-color: #000; color: #fff; text-align: center; border-radius: 8px; padding: 12px; position: fixed; z-index: 9999; bottom: 30px; left: 50%; transform: translateX(-50%); font-weight: bold; opacity: 0; transition: opacity 0.3s, bottom 0.3s; }
#toastSub.show { visibility: visible; opacity: 1; bottom: 50px; }

@media (max-width: 600px) {
    .sub-search-box { flex-direction: column; }
    .autocomplete-wrapper { flex-direction: column; }
    .autocomplete-dropdown { right: 0; }
    .sub-card-top { flex-direction: column; align-items: flex-start; }
    .related-eq-list li { flex-direction: column; align-items: flex-start; }
    .btn-copy-eq { width: 100%; }
}