/* ============================================================
   SEARCH RESULTS / SEARCH MODAL STYLES
   Page: resources/views/main/results/search.blade.php (or modal)
   Depends on global variables defined in style.css:
   - Colors: --primary-blue, --primary-blue-light, --text-dark,
     --text-muted, --border-light
   - Spacing: --spacing-*
   - Radius: --radius-*
   - Shadows: --shadow-*
   ============================================================ */

/* ============================================================
   CUSTOM PROPERTIES – search-specific
   ============================================================ */

   :root {
    --sm-primary: #7367F0;
    --sm-primary-light: rgba(115, 103, 240, 0.08);
    --sm-radius-xl: 16px;
    --sm-radius-lg: 12px;
    --sm-radius-md: 10px;
    --sm-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   DIALOG – modal container
   ============================================================ */

.sm-dialog {
    max-width: 650px;
    width: 95%;
    margin: 2rem auto;
}

/* ============================================================
   CONTENT – modal body styling
   ============================================================ */

.sm-content {
    border-radius: var(--sm-radius-xl) !important;
    border: 1px solid rgba(115, 103, 240, 0.1) !important;
    overflow: hidden;
    box-shadow: var(--sm-shadow) !important;
    background: #ffffff;
}

/* Modal animation – scale and fade */
.modal.fade .sm-dialog {
    transform: scale(0.96) translateY(-15px) !important;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease-out !important;
}

.modal.show .sm-dialog {
    transform: scale(1) translateY(0) !important;
}

/* ============================================================
   HEADER – modal header
   ============================================================ */

.sm-mheader {
    padding: 20px 24px 12px;
    border-bottom: none !important;
}

.sm-mtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sm-mtitle-icon {
    color: var(--sm-primary);
}

/* ============================================================
   BODY – main content area
   ============================================================ */

.sm-mbody {
    padding: 8px 24px 24px !important;
}

/* ============================================================
   SEARCH FIELD – with icon
   ============================================================ */

.sm-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sm-field-icon {
    position: absolute;
    color: #a4b0be;
    font-size: 1.05rem;
    pointer-events: none;
    z-index: 2;
    inset-inline-start: 16px;
}

.sm-field {
    width: 100%;
    padding: 14px 16px;
    padding-inline-start: 46px;
    border: 2px solid #f1f2f6;
    border-radius: var(--sm-radius-lg);
    font-size: 1rem;
    background: #f8f9fa;
    color: #2c3e50;
    outline: none;
    transition: all 0.25s ease;
    -webkit-appearance: none;
}

.sm-field:focus {
    background: #ffffff;
    border-color: var(--sm-primary);
    box-shadow: 0 0 0 4px rgba(115, 103, 240, 0.15);
}

/* ============================================================
   LOADING STATE – spinner with text
   ============================================================ */

.sm-mloading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 6px;
}

.sm-mloading-text {
    color: #747d8c;
    font-size: 0.88rem;
}

/* ============================================================
   DROPDOWN – results container (collapsible)
   ============================================================ */

.sm-dropdown {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    border-radius: var(--sm-radius-md);
    background: #ffffff;
    margin-top: 14px;
}

.sm-dropdown.show {
    max-height: 420px;
    opacity: 1;
    overflow-y: auto;
    border: 1px solid #e1e4e8;
    padding: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Custom scrollbar for results */
.sm-dropdown::-webkit-scrollbar {
    width: 6px;
}

.sm-dropdown::-webkit-scrollbar-track {
    background: #f1f2f6;
    border-radius: 10px;
}

.sm-dropdown::-webkit-scrollbar-thumb {
    background: #ced6e0;
    border-radius: 10px;
}

.sm-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a4b0be;
}

/* ============================================================
   RESULT ITEM – individual search result
   ============================================================ */

.sm-result-item {
    opacity: 0;
    transform: translateY(8px);
    animation: smItemIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes smItemIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sm-result-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.2s ease;
    border-radius: var(--sm-radius-md);
}

.sm-result-link:hover {
    background: var(--sm-primary-light);
    color: var(--sm-primary);
    padding-inline-start: 18px;
}

.sm-result-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--sm-radius-md);
    background: #f1f2f6;
    color: #57606f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.sm-result-link:hover .sm-result-icon {
    background: var(--sm-primary);
    color: #ffffff;
}

.sm-result-name {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-result-arrow {
    font-size: 0.75rem;
    color: #ced6e0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sm-result-link:hover .sm-result-arrow {
    color: var(--sm-primary);
    transform: translateX(3px);
}

[dir="rtl"] .sm-result-link:hover .sm-result-arrow {
    transform: translateX(-3px);
}

/* ============================================================
   HIGHLIGHT – matched text
   ============================================================ */

.search-highlight {
    background: rgba(115, 103, 240, 0.12);
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    color: var(--sm-primary);
}

/* ============================================================
   EMPTY STATE – no results found
   ============================================================ */

.sm-result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: #747d8c;
    font-size: 0.95rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: var(--sm-radius-md);
}

.sm-result-empty i {
    font-size: 1.8rem;
    color: #ced6e0;
}

/* ============================================================
   ERROR STATE – network or server error
   ============================================================ */

.sm-result-error {
    color: #ff4757;
    background: #fff5f5;
}

.sm-result-error i {
    color: #ff4757;
}