/**
 * Etinion Search Course — etsc-search.css
 * Widget: Etinion Search Course
 * Prefix: etsc-
 */

/* ══════════════════════════════════════════════════════
   1. WRAPPER & FORM
   ══════════════════════════════════════════════════════ */

.etsc-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
}

.etsc-search {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.etsc-form {
    display: flex;
    align-items: center;
    position: relative;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.etsc-form:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* ── Style: Minimal ── */
.etsc-style-minimal .etsc-form {
    border-radius: 0;
    border: none;
    border-bottom: 2px solid #dfe3e8;
    background: transparent;
}

.etsc-style-minimal .etsc-form:focus-within {
    border-bottom-color: #3b82f6;
    box-shadow: none;
}

/* ── Style: Pill ── */
.etsc-style-pill .etsc-form {
    border-radius: 999px;
    padding-left: 8px;
    padding-right: 8px;
}

/* ── Style: Boxed (default) ── */
.etsc-style-boxed .etsc-form {
    border-radius: 12px;
}

/* ══════════════════════════════════════════════════════
   2. INPUT
   ══════════════════════════════════════════════════════ */

.etsc-input {
    flex: 1 1 auto;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.4;
    color: #1a1a2e;
    min-width: 0;
}

.etsc-input::placeholder {
    color: #94a3b8;
}

/* ══════════════════════════════════════════════════════
   3. SUBMIT BUTTON / ICON
   ══════════════════════════════════════════════════════ */

.etsc-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 10px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s ease;
}

.etsc-submit:hover {
    color: #3b82f6;
}

.etsc-submit svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Icon position: left */
.etsc-icon-left .etsc-form {
    flex-direction: row;
}

.etsc-icon-left .etsc-submit {
    order: -1;
}

/* Icon position: right (default) */
.etsc-icon-right .etsc-form {
    flex-direction: row;
}

/* ══════════════════════════════════════════════════════
   4. AUTOCOMPLETE DROPDOWN
   ══════════════════════════════════════════════════════ */

.etsc-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
}

.etsc-dropdown.is-open {
    display: block;
}

.etsc-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #1a1a2e;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.etsc-dropdown-item:hover,
.etsc-dropdown-item.is-highlighted {
    background-color: #f1f5f9;
}

.etsc-dropdown-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 auto;
}

.etsc-dropdown-info {
    flex: 1 1 auto;
    min-width: 0;
}

.etsc-dropdown-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.etsc-dropdown-cat {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.etsc-dropdown-empty {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

.etsc-loading {
    display: flex;
    justify-content: center;
    padding: 16px;
}

.etsc-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: etsc-spin 0.6s linear infinite;
}

@keyframes etsc-spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════
   5. RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .etsc-input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .etsc-submit {
        padding: 8px 10px;
    }

    .etsc-dropdown-item {
        padding: 8px 12px;
    }
}
