/* Init Live Search - Modal */
#ils-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    font-family: system-ui, sans-serif;
    color: var(--ils-color, #111);
}
#ils-modal *,
#ils-modal *::before,
#ils-modal *::after {
    box-sizing: border-box;
}
#ils-modal.open {
    display: block;
}
#ils-modal .ils-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}
#ils-modal .ils-content {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 720px;
    background: var(--ils-bg, #fff);
    color: var(--ils-color, #111);
    border-radius: 5px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}
#ils-modal.dark {
    --ils-bg: #1e1e1e;
    --ils-color: #eee;
}

/* Buttons */
#ils-modal .ils-search,
#ils-modal .ils-voice,
#ils-modal .ils-close {
    position: absolute;
    top: 10px;
    width: 35px;
    height: 35px;
    line-height: 35px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    color: var(--ils-color, #111);
    fill: currentColor;
    font: inherit;
    cursor: pointer;
    transition: color 0.2s;
}
#ils-modal.dark .ils-search,
#ils-modal.dark .ils-voice,
#ils-modal.dark .ils-close {
    color: var(--ils-color, #eee);
}
#ils-modal .ils-search {
    left: 10px;
}
#ils-modal .ils-voice {
    right: 40px;
}
#ils-modal .ils-close {
    right: 10px;
}
#ils-modal .ils-clear-active:hover,
#ils-modal .ils-voice:hover,
#ils-modal .ils-close:hover {
    color: #999;
}
#ils-modal .ils-voice-active {
    animation: pulse 1s infinite;
}

/* Input */
#ils-modal .ils-input {
    width: 100%;
    padding: 18px 75px 18px 50px;
    font-size: 16px;
    height: 58px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ils-color, #111);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-family: inherit;
}
#ils-modal.dark .ils-input {
    color: var(--ils-color, #eee);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

/* Suggest Keywords */
.ils-suggestions {
    display: block;
}
.ils-suggestions:not(.ils-command-list) {
    margin: 10px 0;
    padding: 5px 15px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.ils-suggestions:not(.ils-command-list)::-webkit-scrollbar {
    display: none;
}
.ils-suggestions .ils-suggest-pill {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    background: #f1f1f1;
    border-radius: 20px;
    padding: 5px 12px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #111;
    text-decoration: none;
    transition: all 0.2s ease;
}
.ils-suggestions .ils-suggest-pill:hover {
    background: #e2e2e2;
}
#ils-modal.dark .ils-suggestions .ils-suggest-pill {
    color: #fff;
    background: #333;
}
#ils-modal.dark .ils-suggestions .ils-suggest-pill:hover {
    background: #666;
}
.ils-suggestions .ils-suggest-pill.active {
    background: #333;
    color: #fff;
}
#ils-modal.dark .ils-suggestions .ils-suggest-pill.active {
    background: #fff;
    color: #111;
}

/* Slash Command */
.ils-command-list {
    display: block;
    padding: 0;
    margin: 0;
    max-height: 61vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}
.ils-command-item {
    display: flex;
    gap: 0.75em;
    align-items: center;
    padding: 0.6em 1em;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
}
#ils-modal.dark .ils-command-item {
    background: #1e1e1e;
    border-color: rgba(255, 255, 255, 0.1);
}
.ils-command-item:hover,
.ils-command-item:focus,
.ils-command-item.active {
    background: #f0f0f0;
    outline: none;
}
#ils-modal.dark .ils-command-item:hover,
#ils-modal.dark .ils-command-item:focus,
#ils-modal.dark .ils-command-item.active {
    background: #2a2a2a;
}
.ils-command-code {
    font-family: Consolas, monaco, monospace;
    color: #f0506e;
    background: transparent;
    min-width: 115px;
    font-size: 16px;
}
#ils-modal.dark .ils-command-code {
    color: #f0506e;
}
.ils-command-desc {
    flex: 1;
    color: #666;
    font-size: 16px;
}
#ils-modal.dark .ils-command-desc {
    color: #bbb;
}

/* Results */
.ils-results {
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    background: var(--ils-bg, #fff);
    color: var(--ils-color, #111);
}
#ils-modal.dark .ils-results {
    background: var(--ils-bg, #1e1e1e);
    color: var(--ils-color, #eee);
}
.ils-results .ils-message {
    padding: 20px;
    font-size: 16px;
}
.ils-results .ils-message p:first-child {
    margin-top: 0;
}
.ils-results .ils-message ul {
    list-style: none;
    padding-left: 0;
}
.ils-results .ils-message ul li {
    margin-bottom: 5px;
}
.ils-results .ils-message code.ils-command {
    font-family: Consolas, monaco, monospace;
    font-size: 14px;
    color: #f0506e;
    padding: 2px 6px;
    background: #f8f8f8;
    cursor: pointer;
}
#ils-modal.dark .ils-results .ils-message code.ils-command {
    color: rgba(255, 255, 255, 0.7);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Each result item */
.ils-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--ils-color, #111);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: transparent;
    transition: all 0.2s ease;
}
.ils-item.active,
.ils-item:hover {
    background: rgba(0, 0, 0, 0.03);
    text-decoration: none;
}
#ils-modal.dark .ils-item {
    color: var(--ils-color, #eee);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}
#ils-modal.dark .ils-item.active,
#ils-modal.dark .ils-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
#ils-modal mark {
    background-color: #fff3a0;
    color: #000;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}
#ils-modal.dark mark {
    background-color: #665c00;
    color: #fffbe0;
}

/* Thumbnail */
.ils-thumb {
    flex: 0 0 64px;
    height: 64px;
    overflow: hidden;
    border-radius: 5px;
    background: #ccc;
}
.ils-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Meta info */
.ils-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-right: 30px;
}
.ils-title {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    color: inherit;
}
.ils-info {
    font-size: 14px;
    color: #666;
}
.ils-excerpt {
    margin-top: 3px;
    margin-bottom: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
#ils-modal.dark .ils-info {
    color: #aaa;
}

/* Messages */
.ils-loading,
.ils-error,
.ils-empty {
    padding: 20px;
    margin-bottom: 0;
    text-align: center;
    color: #888;
    background: transparent;
}
#ils-modal.dark .ils-loading,
#ils-modal.dark .ils-error,
#ils-modal.dark .ils-empty {
    color: #aaa;
}
.ils-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}
.ils-loading-spinner svg {
    animation: ils-spin 0.7s linear infinite;
    display: block;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes slideDown {
    from {
        transform: translate(-50%, -20%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}
@keyframes favFlash {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}
@keyframes ils-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Scrollbar (Webkit only) */
.ils-results::-webkit-scrollbar,
.ils-command-list::-webkit-scrollbar {
    width: 6px;
}
.ils-results::-webkit-scrollbar-thumb,
.ils-command-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
#ils-modal.dark .ils-results::-webkit-scrollbar-thumb,
#ils-modal.dark .ils-command-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 600px) {
    #ils-modal .ils-content {
        top: 5%;
        width: 95%;
        border-radius: 8px;
    }
    .ils-item {
        padding: 10px 14px;
    }
    .ils-thumb {
        flex: 0 0 52px;
        height: 52px;
    }
}

/* Quick search */
.ils-selection-tooltip {
    position: absolute;
    background: #1e1e1e;
    color: #eee;
    padding: 6px 10px;
    font-weight: 400;
    font-size: 16px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.2s ease;
}
.ils-selection-tooltip:hover {
    color: #ddd;
    text-decoration: none;
}
.ils-selection-tooltip::after {
    content: "";
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1e1e1e transparent transparent transparent;
}
.ils-selection-tooltip-mobile {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 10px;
    font-size: 16px;
    background: #1e1e1e;
    color: #eee;
    text-decoration: none;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Favourite */
.ils-meta .ils-fav-btn,
.ils-meta .ils-cart-btn {
    position: absolute;
    right: 0;
    top: calc(50% - 13px);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
}
.ils-meta .ils-fav-btn:hover,
.ils-meta .ils-cart-btn:hover {
    opacity: 1;
}
.ils-meta .ils-fav-btn.active,
.ils-meta .ils-cart-btn.active {
    color: #f1c40f;
    opacity: 1;
}
.ils-meta .ils-cart-btn.active {
    color: #2ecc71;
}
.ils-meta .ils-fav-btn.flash,
.ils-meta .ils-cart-btn.flash {
    animation: favFlash 0.4s ease-out;
}
.ils-meta .ils-cart-btn.out-of-stock {
    opacity: 0.3;
    pointer-events: none;
}

/* Product */
.ils-meta .ils-info .ils-sale-badge,
.ils-meta .ils-info .ils-stock-badge {
    display: inline-block;
    color: #fff;
    padding: 2px 5px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    border-radius: 4px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ils-meta .ils-info .ils-sale-badge {
    background: #f57c00; /* cam giảm giá */
}
.ils-meta .ils-info .ils-stock-badge {
    background: #d93025; /* đỏ cảnh báo */
}
.ils-meta .ils-info ins {
    background: none;
}
.ils-meta .ils-info ins .amount {
    background: #ffd;
    color: #666;
}
.ils-meta .ils-info .screen-reader-text {
    display: none;
}

/* Coupon */
.ils-coupon-item {
    background: #fff;
    border-left: 4px solid #3b82f6;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.ils-coupon-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.ils-coupon-item.ils-copied {
    border-left-color: #22c55e;
}
.ils-coupon-code {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
    cursor: pointer;
}
.ils-coupon-code code {
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}
.ils-copy-btn {
    background: #3b82f6;
    color: white;
    font-size: 0.875rem;
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.ils-copy-btn:hover {
    background: #2563eb;
}
.ils-coupon-desc {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 6px;
}
.ils-coupon-meta {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.ils-coupon-meta li::before {
    content: "• ";
    color: #3b82f6;
}

/* ===== Init Live Search Shortcode ===== */

/* ICON BUTTON */
.ils-icon-launch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    background: transparent;
    border: none;
    padding: 4px;
    font: inherit;
    transition: opacity 0.2s ease;
}
.ils-icon-launch:hover {
    opacity: 0.7;
}
.ils-icon-launch svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Optional label */
.ils-icon-label {
    font-size: 15px;
    line-height: 1;
}

/* INPUT FORM */
.ils-input-launch {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 9999px;
    padding: 0 10px;
    background: #fff;
    max-width: 100%;
    transition: border 0.2s;
}
.ils-input-launch:focus-within {
    border-color: #999;
}
.ils-input-launch input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    padding: 10px 0;
    font-family: inherit;
    color: inherit;
}
.ils-input-launch button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}
.ils-input-launch button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ===== Shortcode Search - Dark mode hỗ trợ class trực tiếp ===== */

/* ICON BUTTON */
.ils-icon-launch.dark {
    color: #eee;
}
.ils-icon-launch.dark:hover {
    opacity: 0.8;
}

/* INPUT FORM */
.ils-input-launch.dark {
    background: #1e1e1e;
    border-color: #444;
    color: #eee;
}
.ils-input-launch.dark:focus-within {
    border-color: #666;
}
.ils-input-launch.dark input {
    color: #eee;
}
.ils-input-launch.dark button {
    color: #eee;
}
.ils-input-launch.dark button svg {
    fill: #eee;
}

/* Coupon – Dark Mode Support */
#ils-modal.dark .ils-coupon-item {
    background: #2a2a2a;
    box-shadow: 0 1px 2px rgba(255, 255, 255, 0.05);
}
#ils-modal.dark .ils-coupon-item:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}
#ils-modal.dark .ils-coupon-code {
    color: #eee;
}
#ils-modal.dark .ils-coupon-code code {
    background: #444;
    color: #fff;
}
#ils-modal.dark .ils-copy-btn {
    background: #3b82f6;
    color: #fff;
}
#ils-modal.dark .ils-copy-btn:hover {
    background: #2563eb;
}
#ils-modal.dark .ils-coupon-desc {
    color: #ccc;
}
#ils-modal.dark .ils-coupon-meta {
    color: #aaa;
}
#ils-modal.dark .ils-coupon-meta li::before {
    color: #60a5fa; /* màu xanh nhạt hơn để nổi bật */
}
