/**
 * Reta Razão — Busca Inteligente
 * Stylesheet v1.0.0
 *
 * Design tokens:
 *   --rrss-amber:    #D4A853  (brand accent)
 *   --rrss-purple:   #8B6BBE  (video)
 *   --rrss-green:    #6BAF6B  (questão / completed)
 *   --rrss-gold:     #B08840  (locked)
 */

/* ══════════════════════════════════════════════
   0. FONTS
   ══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700;900&family=Source+Sans+3:wght@400;600;700&display=swap');


/* ══════════════════════════════════════════════
   1. THEME VARIABLES
   ══════════════════════════════════════════════ */

/* ── Dark (default) ── */
.rrss-theme-dark {
    --rrss-bg-input:     #232323;
    --rrss-bg-dropdown:  #212121;
    --rrss-bg-hover:     #2A2A2A;
    --rrss-border:       #333;
    --rrss-border-focus: #D4A85350;
    --rrss-text-primary: #E8E0D4;
    --rrss-text-muted:   #999;
    --rrss-text-dim:     #666;
    --rrss-text-faint:   #555;
    --rrss-highlight-bg: #D4A85340;
    --rrss-shadow:       0 14px 44px rgba(0,0,0,0.55);
}

/* ── Light ── */
.rrss-theme-light {
    --rrss-bg-input:     #FAFAF8;
    --rrss-bg-dropdown:  #FFFFFF;
    --rrss-bg-hover:     #F5F3EE;
    --rrss-border:       #E0DDD5;
    --rrss-border-focus: #D4A85380;
    --rrss-text-primary: #2C2C2C;
    --rrss-text-muted:   #666;
    --rrss-text-dim:     #999;
    --rrss-text-faint:   #BBB;
    --rrss-highlight-bg: #D4A85330;
    --rrss-shadow:       0 10px 30px rgba(0,0,0,0.1);
}


/* ══════════════════════════════════════════════
   2. CONTAINER
   ══════════════════════════════════════════════ */
.rrss-container {
    position: relative;
    width: 100%;
    max-width: 620px;
    font-family: 'Source Sans 3', sans-serif;
    box-sizing: border-box;
}

.rrss-container *, .rrss-container *::before, .rrss-container *::after {
    box-sizing: border-box;
}

.rrss-container ::selection {
    background: #D4A85350;
    color: #fff;
}


/* ══════════════════════════════════════════════
   3. INPUT
   ══════════════════════════════════════════════ */
.rrss-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--rrss-bg-input);
    border: 1px solid var(--rrss-border);
    border-radius: 8px;
    padding: 0 13px;
    transition: border-color 0.2s, border-radius 0.2s;
}

.rrss-input-wrapper:focus-within {
    border-color: var(--rrss-border-focus);
}

/* When dropdown is open */
.rrss-container.rrss-open .rrss-input-wrapper {
    border-radius: 8px 8px 0 0;
    border-color: var(--rrss-border-focus);
}

.rrss-search-icon {
    flex-shrink: 0;
    color: #D4A853;
}

.rrss-input {
    flex: 1;
    padding: 13px 11px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--rrss-text-primary);
    font-size: 15px;
    font-family: 'Source Sans 3', sans-serif;
}

.rrss-input::placeholder {
    color: var(--rrss-text-faint);
}

.rrss-clear {
    background: none;
    border: none;
    color: var(--rrss-text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 0 3px;
    line-height: 1;
    transition: color 0.15s;
}

.rrss-clear:hover {
    color: var(--rrss-text-primary);
}


/* ══════════════════════════════════════════════
   4. DROPDOWN
   ══════════════════════════════════════════════ */
.rrss-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--rrss-bg-dropdown);
    border: 1px solid var(--rrss-border-focus);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 9999;
    max-height: 520px;
    overflow-y: auto;
    box-shadow: var(--rrss-shadow);
}

/* Scrollbar */
.rrss-dropdown::-webkit-scrollbar {
    width: 5px;
}
.rrss-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.rrss-dropdown::-webkit-scrollbar-thumb {
    background: #3A3A3A;
    border-radius: 3px;
}
.rrss-theme-light .rrss-dropdown::-webkit-scrollbar-thumb {
    background: #CCC;
}


/* ══════════════════════════════════════════════
   5. FILTER BAR
   ══════════════════════════════════════════════ */
.rrss-filters {
    display: flex;
    gap: 5px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--rrss-border);
    flex-wrap: wrap;
    align-items: center;
}

.rrss-filter-label {
    font-size: 10.5px;
    color: var(--rrss-text-faint);
    font-weight: 700;
    margin-right: 3px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rrss-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 4px;
    border: 1px solid var(--rrss-border);
    background: transparent;
    color: var(--rrss-text-dim);
    font-size: 11.5px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.rrss-filter-icon { font-size: 10px; }

.rrss-filter-count {
    font-size: 9.5px;
    background: var(--rrss-border);
    border-radius: 7px;
    padding: 0 5px;
    margin-left: 1px;
}

/* Active states per type */
.rrss-filter-btn.rrss-type-aula.rrss-filter-active {
    border-color: #D4A853; color: #D4A853; background: #D4A85315;
}
    border-color: #5BA4CF; color: #5BA4CF; background: #5BA4CF15;
}
.rrss-filter-btn.rrss-type-video.rrss-filter-active {
    border-color: #8B6BBE; color: #8B6BBE; background: #8B6BBE15;
}
.rrss-filter-btn.rrss-type-questao.rrss-filter-active {
    border-color: #6BAF6B; color: #6BAF6B; background: #6BAF6B15;
}


/* ══════════════════════════════════════════════
   6. RESULT COUNT
   ══════════════════════════════════════════════ */
.rrss-count {
    padding: 7px 16px 2px;
    font-size: 11.5px;
    color: var(--rrss-text-faint);
    font-weight: 600;
}

.rrss-query-echo {
    color: #D4A853;
}


/* ══════════════════════════════════════════════
   7. RESULT CARDS
   ══════════════════════════════════════════════ */
@keyframes rrss-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rrss-results-section {
    padding: 4px 0;
}

.rrss-card {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    animation: rrss-fadeIn 0.22s ease both;
    text-decoration: none;
    color: inherit;
}

a.rrss-card:hover, a.rrss-card:focus {
    text-decoration: none;
    color: inherit;
}

.rrss-card:hover {
    background: var(--rrss-bg-hover);
}

/* Border-left color on hover per type */
.rrss-card.rrss-type-aula:hover    { border-left-color: #D4A853; }
.rrss-card.rrss-type-video:hover   { border-left-color: #8B6BBE; }
.rrss-card.rrss-type-questao:hover { border-left-color: #6BAF6B; }

/* ── Card icon ── */
.rrss-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.rrss-type-aula    .rrss-card-icon { background: #D4A85315; border: 1px solid #D4A85325; }
.rrss-type-video   .rrss-card-icon { background: #8B6BBE15; border: 1px solid #8B6BBE25; }
.rrss-type-questao .rrss-card-icon { background: #6BAF6B15; border: 1px solid #6BAF6B25; }

/* ── Card body ── */
.rrss-card-body {
    flex: 1;
    min-width: 0;
}

/* Breadcrumb */
.rrss-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--rrss-text-dim);
    gap: 0;
}

.rrss-bc-sep {
    margin: 0 4px;
    font-size: 8px;
    color: var(--rrss-text-faint);
}

/* Title row */
.rrss-card-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.rrss-card-title {
    margin: 0;
    font-size: 14.5px;
    font-family: 'Merriweather', serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--rrss-text-primary);
    transition: color 0.15s;
}

.rrss-card:hover .rrss-card-title {
    color: #D4A853;
}

/* Type badge */
.rrss-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 3px;
    padding: 2px 7px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.rrss-type-badge.rrss-type-aula    { color: #D4A853; background: #D4A85315; }
.rrss-type-badge.rrss-type-video   { color: #8B6BBE; background: #8B6BBE15; }
.rrss-type-badge.rrss-type-questao { color: #6BAF6B; background: #6BAF6B15; }

.rrss-badge-icon { font-size: 11px; }

/* Snippet */
.rrss-snippet {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--rrss-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Highlight */
.rrss-highlight {
    background: var(--rrss-highlight-bg);
    color: var(--rrss-text-primary);
    border-radius: 2px;
    padding: 0 1px;
}

/* Progress pill */
.rrss-progress {
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 10px;
    padding: 1px 7px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.rrss-prog-done    { color: #6BAF6B; border: 1px solid #6BAF6B44; }
.rrss-prog-partial { color: #D4A853; border: 1px solid #D4A85344; }
.rrss-prog-zero    { color: #888;    border: 1px solid #88888844; }


/* ══════════════════════════════════════════════
   8. LOCKED RESULTS
   ══════════════════════════════════════════════ */
.rrss-locked-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    border-top: 1px solid var(--rrss-border);
    border-bottom: 1px solid var(--rrss-border);
}

.rrss-locked-count {
    font-size: 11.5px;
    color: var(--rrss-text-dim);
}

.rrss-locked-btn {
    background: none;
    border: 1px solid #44403A;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 11px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    color: #B08840;
    cursor: pointer;
    transition: all 0.15s;
}

.rrss-locked-btn:hover {
    background: #B0884015;
}

/* Locked card */
.rrss-card-locked {
    opacity: 0.55;
    cursor: default;
}

.rrss-card-locked:hover {
    opacity: 0.75;
    border-left-color: #B08840 !important;
}

.rrss-card-locked .rrss-card-title {
    color: #998866;
}
.rrss-theme-light .rrss-card-locked .rrss-card-title {
    color: #8A7750;
}

.rrss-card-locked:hover .rrss-card-title {
    color: #B08840 !important;
}

.rrss-icon-locked {
    background: #B0884010 !important;
    border-color: #B0884025 !important;
    filter: grayscale(0.6);
}

.rrss-locked-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #B08840;
    background: #B0884015;
    border: 1px solid #B0884030;
    border-radius: 3px;
    padding: 2px 8px;
    letter-spacing: 0.4px;
}

/* Locked CTA (revealed on hover) */
.rrss-locked-cta {
    margin-top: 6px;
    display: none;
    animation: rrss-fadeIn 0.15s ease;
}

.rrss-card-locked:hover .rrss-locked-cta {
    display: block;
}

.rrss-cta-link {
    font-size: 11.5px;
    font-weight: 600;
    color: #B08840;
    background: #B0884020;
    border: 1px solid #B0884035;
    border-radius: 4px;
    padding: 3px 10px;
    text-decoration: none;
    transition: all 0.15s;
    display: inline-block;
}

.rrss-cta-link:hover {
    background: #B0884030;
    color: #D4A853;
}

.rrss-card-locked .rrss-snippet {
    color: #776655;
}
.rrss-theme-light .rrss-card-locked .rrss-snippet {
    color: #A09080;
}


/* ══════════════════════════════════════════════
   9. EMPTY & LOADING STATES
   ══════════════════════════════════════════════ */
.rrss-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--rrss-text-faint);
    font-size: 13px;
}

.rrss-loading {
    padding: 24px 16px;
    text-align: center;
}

.rrss-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--rrss-border);
    border-top-color: #D4A853;
    border-radius: 50%;
    animation: rrss-spin 0.6s linear infinite;
}

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


/* ══════════════════════════════════════════════
   10. RESPONSIVE
   ══════════════════════════════════════════════ */
@media ( max-width: 480px ) {
    .rrss-card {
        gap: 10px;
        padding: 10px 12px;
    }

    .rrss-card-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .rrss-card-title {
        font-size: 13.5px;
    }

    .rrss-card-title-row {
        gap: 5px;
    }

    .rrss-filters {
        padding: 6px 10px;
    }

    .rrss-filter-btn {
        padding: 2px 7px;
        font-size: 11px;
    }
}


/* ══════════════════════════════════════════════
   11. FLOATING TRIGGER BUTTON
   ══════════════════════════════════════════════ */
.rrss-floating-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99998;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: #0f5b62;
    color: #E8E0D4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 0 rgba(15,91,98,0.3);
    transition: all 0.25s ease;
}

.rrss-floating-trigger:hover {
    background: #0d4e56;
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,0.4), 0 0 0 6px rgba(15,91,98,0.15);
}

.rrss-floating-trigger:active {
    transform: scale(0.95);
}

/* Keyboard hint */
.rrss-floating-trigger::after {
    content: '⌘K';
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 9px;
    font-family: 'Source Sans 3', system-ui, sans-serif;
    font-weight: 700;
    background: #D4A853;
    color: #1A1A1A;
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.rrss-floating-trigger:hover::after {
    opacity: 1;
}


/* ══════════════════════════════════════════════
   12. OVERLAY
   ══════════════════════════════════════════════ */
.rrss-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}

.rrss-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: rrss-fadeBackdrop 0.2s ease;
}

@keyframes rrss-fadeBackdrop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.rrss-overlay-content {
    position: relative;
    width: 100%;
    max-width: 620px;
    z-index: 1;
    animation: rrss-slideDown 0.25s ease;
}

@keyframes rrss-slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rrss-overlay-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
    z-index: 2;
}

.rrss-overlay-close:hover {
    color: #E8E0D4;
}

/* In overlay, dropdown should not be position:absolute */
.rrss-overlay-content .rrss-dropdown {
    position: relative;
}

/* ── Inline inject mode (top-right of content) ── */
.rrss-inline-inject {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
    position: relative;
    z-index: 100;
}

.rrss-inline-inject .rrss-container {
    max-width: 340px;
    width: 100%;
}

.rrss-inline-inject .rrss-input {
    padding: 10px 10px;
    font-size: 13.5px;
}

.rrss-inline-inject .rrss-input-wrapper {
    border-radius: 6px;
}

.rrss-inline-inject .rrss-container.rrss-open .rrss-input-wrapper {
    border-radius: 6px 6px 0 0;
}

.rrss-inline-inject .rrss-dropdown {
    border-radius: 0 0 6px 6px;
    max-height: 440px;
    /* Override relative positioning from overlay mode */
    position: absolute;
    min-width: 480px;
    right: 0;
}

.rrss-inline-inject .rrss-search-icon {
    width: 16px;
    height: 16px;
}

/* Light theme defaults for inline (content area is usually light) */
.rrss-inline-inject .rrss-theme-light .rrss-input-wrapper {
    border-color: #D8D5CD;
}

@media ( max-width: 768px ) {
    .rrss-inline-inject {
        justify-content: stretch;
    }

    .rrss-inline-inject .rrss-container {
        max-width: 100%;
    }

    .rrss-inline-inject .rrss-dropdown {
        min-width: 100%;
        left: 0;
        right: 0;
    }
}

/* ── Header inject mode ── */
.rrss-header-inject {
    display: flex;
    justify-content: center;
    padding: 8px 16px;
}

.rrss-header-inject .rrss-container {
    max-width: 480px;
}

/* ══════════════════════════════════════════════
   13. RESPONSIVE — Overlay
   ══════════════════════════════════════════════ */
@media ( max-width: 480px ) {
    .rrss-overlay {
        padding-top: 5vh;
    }

    .rrss-overlay-content {
        margin: 0 12px;
    }

    .rrss-floating-trigger {
        bottom: 18px;
        right: 18px;
        width: 46px;
        height: 46px;
    }

    .rrss-floating-trigger::after {
        display: none;
    }
}
