/* ═══════════════════════════════════════════════════════════════
   Semantic Search Styles for Diwan Document Page
   ═══════════════════════════════════════════════════════════════ */

/* ─── Hidden class (used by toggle) ─── */
.sem-hidden {
    display: none !important;
}

/* ─── Status Bar ─── */
#semantic-status-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #5f6368;
    border-bottom: 1px solid #e8eaed;
    flex-wrap: wrap;
}

.sem-status-count {
    font-weight: 600;
    color: #1a73e8;
}

.sem-status-time {
    color: #919193;
    font-size: 0.8rem;
}

.sem-status-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 0.2em 0.7em;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ─── Search Mode Switcher ─── */
.search-modes-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-mode-pill {
    display: flex;
    position: relative;
    background-color: #f1f3f4;
    padding: 4px;
    border-radius: 25px;
    width: fit-content;
    min-width: 220px;
    /* Stable width */
    border: 1px solid #e8eaed;
    user-select: none;
    height: fit-content;
    align-self: center;
}

.search-mode-pill.main-bar {
    min-width: 180px;
    margin-inline: 0.5rem;
    padding: 3px;
}

.search-mode-pill.main-bar .mode-item {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.mode-item {
    flex: 1;
    justify-content: center;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.mode-item.active {
    color: #fff;
}

.mode-glider {
    position: absolute;
    height: calc(100% - 8px);
    width: calc(50% - 4px);
    /* Default for 2 items */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Position for second item */
.search-mode-pill[data-active="1"] .mode-glider {
    transform: translateX(-100%);
    /* For RTL */
}

[dir="ltr"] .search-mode-pill[data-active="1"] .mode-glider {
    transform: translateX(100%);
}

.deep-search-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    min-width: 140px;
    /* Preserve space */
}

.deep-search-toggle.sem-hidden {
    opacity: 0;
    visibility: hidden !important;
    pointer-events: none;
    display: flex !important;
    /* Override .sem-hidden display:none */
}


/* ─── Score Badge on Cards ─── */
.sem-score-badge {
    position: absolute;
    top: 0.5rem;
    inset-inline-start: 0.5rem;
    padding: 0.15em 0.5em;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 25;
    line-height: 1.4;
}

.sem-score-badge.high {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #ceead6;
}

.sem-score-badge.medium {
    background: #fef7e0;
    color: #b06000;
    border: 1px solid #fde293;
}

.sem-score-badge.low {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c6c2;
}

/* ─── Semantic Result Card Overrides ─── */
.docs .resultats .doc.sem-result {
    padding-top: 1.6rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    background-image: none;
}

.docs .resultats .doc.sem-result:hover {
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}

.sem-content-preview {
    font-size: 0.78rem;
    color: #5f6368;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-top: 0.2rem;
}

.sem-lang-badge {
    font-size: 0.65rem;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 500;
}

/* ─── Loading Skeletons ─── */
.doc.sem-skeleton {
    background-image: none !important;
    pointer-events: none;
}

.sem-skel-badge,
.sem-skel-title,
.sem-skel-text,
.sem-skel-meta {
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: sem-shimmer 1.5s infinite;
}

.sem-skel-badge {
    width: 36px;
    height: 18px;
    margin-bottom: 0.5rem;
}

.sem-skel-title {
    width: 80%;
    height: 16px;
    margin-bottom: 0.4rem;
}

.sem-skel-text {
    width: 100%;
    height: 12px;
    margin-bottom: 0.3rem;
}

.sem-skel-text.short {
    width: 60%;
}

.sem-skel-meta {
    width: 40%;
    height: 10px;
    margin-top: auto;
}

@keyframes sem-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ─── Error Message ─── */
.sem-error-msg {
    padding: 1.5em;
    text-align: center;
    color: #c5221f;
    font-size: 0.95rem;
    grid-column: 1 / -1;
}



/* ─── Responsive ─── */
@media (max-width: 750px) {
    .sem-modal-body {
        padding: 1rem;
    }

    .sem-doc-content {
        font-size: 0.85rem;
    }

    .docs .resultats .doc.sem-result {
        padding-top: 2rem;
    }
}