/* ============================================
   Norvio Data Search — Frontend Styles
   ============================================ */

/* Widget Container */
.norvio-search-widget {
    max-width: 780px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
}

/* Header */
.nds-search-header {
    text-align: center;
    margin-bottom: 24px;
}

.nds-search-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #1a1a2e;
}

.nds-search-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Search Form */
.nds-search-form {
    margin-bottom: 12px;
}

.nds-input-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 4px 6px 4px 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.nds-input-group:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.nds-search-icon {
    flex-shrink: 0;
    color: #9ca3af;
    margin-right: 10px;
}

.nds-input-group:focus-within .nds-search-icon {
    color: #3b82f6;
}

.nds-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 10px 0;
    background: transparent;
    color: #1a1a2e;
    font-family: inherit;
}

.nds-search-input::placeholder {
    color: #9ca3af;
}

.nds-search-button {
    flex-shrink: 0;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.nds-search-button:hover { background: #2563eb; }
.nds-search-button:active { background: #1d4ed8; }
.nds-search-button.nds-loading { opacity: 0.7; pointer-events: none; }

/* ============================================
   FILTER BAR
   ============================================ */
.nds-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.nds-filter-btn {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.nds-filter-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.nds-filter-btn.nds-filter-active {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

/* Status Bar */
.nds-search-status {
    font-size: 13px;
    color: #6b7280;
    padding: 8px 0;
    text-align: center;
}

.nds-search-status.nds-status-no-results {
    color: #9ca3af;
    font-style: italic;
}

/* Results Container */
.nds-results {
    margin-top: 8px;
}

/* ============================================
   RESULT CARD
   ============================================ */
.nds-result-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 10px;
    transition: box-shadow 0.15s ease;
    animation: ndsFadeIn 0.25s ease;
}

.nds-result-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* STRONG result card — elevated styling */
.nds-result-strong {
    border-color: #bfdbfe;
    border-left: 3px solid #2563eb;
    background: linear-gradient(135deg, #f0f7ff 0%, #fff 40%);
}

.nds-result-strong:hover {
    box-shadow: 0 4px 16px rgba(37,99,235,0.1);
}

@keyframes ndsFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   STRONG LABEL
   ============================================ */
.nds-strong-label {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    margin-right: 6px;
    letter-spacing: 0.3px;
}

/* ============================================
   INTENT-MATCH LABEL
   ============================================ */
.nds-intent-label {
    display: inline-block;
    background: #059669;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

/* SYNONYM-ONLY LABEL (v2.1.5) — subdued, no green accent */
.nds-synonym-label {
    display: inline-block;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

/* RELEVANT result card — green accent for full intent match */
.nds-result-relevant {
    border-color: #a7f3d0;
    border-left: 3px solid #059669;
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 40%);
}

.nds-result-relevant:hover {
    box-shadow: 0 4px 16px rgba(5,150,105,0.1);
}

.nds-result-relevant .nds-result-strength {
    background: #d1fae5;
    color: #065f46;
}

/* ============================================
   MATCHED CONCEPTS BADGE
   ============================================ */
.nds-result-concepts {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    font-style: italic;
}

.nds-result-concepts svg {
    flex-shrink: 0;
    color: #9ca3af;
}

/* ============================================
   SENTENCE + DATA HIGHLIGHTING
   ============================================ */
.nds-result-sentence {
    font-size: 15px;
    line-height: 1.65;
    color: #1a1a2e;
    margin-bottom: 10px;
    word-break: break-word;
}

/* Query match highlight */
.nds-result-sentence mark {
    background: #fef08a;
    color: inherit;
    border-radius: 2px;
    padding: 0 2px;
}

/* Percentage highlight */
.nds-hl-pct {
    color: #059669;
    font-weight: 700;
}

/* Euro/money highlight */
.nds-hl-eur {
    color: #b45309;
    font-weight: 600;
}

/* Trend/comparison word highlight */
.nds-hl-trend {
    color: #2563eb;
    font-weight: 600;
}

/* ============================================
   CONTEXT BADGE
   ============================================ */
.nds-result-context {
    display: inline-block;
    background: #f0fdf4;
    color: #15803d;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}

/* ============================================
   SOURCE TRUST NOTE
   ============================================ */
.nds-result-trust {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #059669;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}

.nds-result-trust svg {
    flex-shrink: 0;
}

/* ============================================
   META BAR
   ============================================ */
.nds-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.nds-result-meta-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Topic Badge */
.nds-result-topic {
    display: inline-block;
    background: #eff6ff;
    color: #2563eb;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* v3.0: Score NEVER displayed as visible data value to normal users.
   Hidden by default. Only visible for admins with WP_DEBUG. */
.nds-result-strength {
    display: none;
}

body.wp-debug .nds-result-strength {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    opacity: 0.5;
}

/* Source Link */
.nds-result-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.15s;
}

.nds-result-source:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.nds-result-source svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   COPY BUTTONS
   ============================================ */
.nds-result-meta-right {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nds-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.nds-copy-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.nds-copy-btn.nds-copied {
    background: #d1fae5;
    color: #059669;
    border-color: #6ee7b7;
}

.nds-copy-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* "Copy with source" button — compact icon-only style */
.nds-copy-with-source {
    padding: 5px 8px;
}

/* ============================================
   SECTION TITLE (v3.0)
   Small context line above sentence.
   ============================================ */
.nds-result-section-title {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    margin-bottom: 4px;
    font-style: italic;
}

/* ============================================
   METRIC CHIPS (v3.0)
   Only from sentence, never scores/IDs.
   ============================================ */
.nds-result-metric-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.nds-metric-chip {
    display: inline-block;
    background: #f0fdf4;
    color: #15803d;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #bbf7d0;
}

/* ============================================
   QUALITY BADGE (v4)
   ============================================ */
.nds-quality-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    margin-bottom: 8px;
    margin-right: 4px;
    background: #f3f4f6;
    letter-spacing: 0.3px;
}

/* ============================================
   TOPIC LABELS (v3.0)
   Percentage, Comparison, Kosten, Trend.
   ============================================ */
.nds-topic-label {
    display: inline-block;
    background: #eff6ff;
    color: #3b82f6;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    margin-right: 4px;
}

/* ============================================
   DEBUG INFO (v3.0)
   Only visible for admins.
   ============================================ */
.nds-debug-info {
    display: none;
}

body.wp-debug .nds-debug-info {
    display: block;
}

/* ============================================
   LOADING / EMPTY
   ============================================ */
.nds-results-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 14px;
}

.nds-results-loading {
    text-align: center;
    padding: 40px 20px;
}

.nds-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: ndsSpin 0.7s linear infinite;
    margin-bottom: 10px;
}

@keyframes ndsSpin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .nds-search-title { font-size: 19px; }
    .nds-input-group { border-radius: 10px; padding: 4px 4px 4px 12px; }
    .nds-search-input { font-size: 14px; }
    .nds-search-button { padding: 10px 16px; font-size: 13px; }

    .nds-filter-bar { gap: 4px; }
    .nds-filter-btn { padding: 4px 10px; font-size: 11px; }

    .nds-result-card { padding: 14px 16px; }
    .nds-result-sentence { font-size: 14px; }

    .nds-intent-label { font-size: 10px; padding: 2px 6px; }
    .nds-synonym-label { font-size: 9px; padding: 1px 5px; }
    .nds-result-concepts { font-size: 11px; }

    .nds-result-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .nds-result-meta-left { width: 100%; }
    .nds-result-meta-right { width: 100%; justify-content: flex-start; }
}
