/* =========================================================
   Chapter Live Search — Frontend Styles
   ========================================================= */

.cls-search-wrapper {
    margin: 0 0 1.25rem;
    width: 100%;
    box-sizing: border-box;
}

/* Input row */
.cls-input-wrap {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

/* Search icon */
.cls-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cls-accent, #6c757d);
    pointer-events: none;
    flex-shrink: 0;
    transition: color 0.2s;
    z-index: 1;
}

/* Input field */
.cls-input {
    width: 100%;
    padding: 0.65rem 2.8rem 0.65rem 2.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    background: #fff;
    border: 2px solid var(--cls-accent, #6c757d);
    border-radius: 0.5rem;
    outline: none;
    box-shadow: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.cls-input::-webkit-search-cancel-button,
.cls-input::-webkit-search-decoration {
    -webkit-appearance: none;
}

.cls-input:focus {
    border-color: var(--cls-accent, #6c757d);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cls-accent, #6c757d) 25%, transparent);
}

.cls-input::placeholder {
    color: #adb5bd;
}

/* Clear (×) button */
.cls-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #adb5bd;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.cls-clear:hover {
    color: #495057;
    background: #f0f0f0;
}

.cls-clear[hidden] {
    display: none;
}

/* Status text */
.cls-status {
    margin: 0.4rem auto 0;
    max-width: 640px;
    font-size: 0.85rem;
    color: #6c757d;
    min-height: 1.2em;
    text-align: right;
    padding-right: 2px;
}

/* Hidden items during search */
.cls-hidden {
    display: none !important;
}

/* No-results message */
.cls-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
    font-size: 0.95rem;
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
    .cls-input {
        background: #1e1e1e;
        color: #e9ecef;
    }
    .cls-input::placeholder {
        color: #6c757d;
    }
    .cls-clear:hover {
        background: #333;
        color: #ccc;
    }
    .cls-no-results {
        color: #adb5bd;
    }
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .cls-input {
        font-size: 0.95rem;
        padding: 0.6rem 2.5rem 0.6rem 2.5rem;
    }
    .cls-icon {
        left: 12px;
    }
}
