/**
 * IRL Theme Browser - Mad Libs Discovery Bar
 * Modern sentence-based filter UI with inline dropdowns
 */

/* ========================================
   CONTAINER
   ======================================== */

.irl-theme-browser {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   MAD LIBS SENTENCE
   ======================================== */

.irl-madlibs {
    font-size: 22px;
    line-height: 2.4;
    color: #334155;
    text-align: center;
    padding: 32px 24px;
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.irl-madlibs-text {
    font-weight: 500;
}

/* ========================================
   FILTER PILLS (Inline Dropdowns)
   ======================================== */

.irl-filter-pill {
    position: relative;
    display: inline-block;
    margin: 0 4px;
}

.irl-pill-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 2px dashed #cbd5e1;
    border-radius: 24px;
    color: #64748b;
    font-weight: 600;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.irl-pill-trigger:hover {
    border-color: #7d92ff;
    border-style: solid;
    color: #7d92ff;
    background: #f8faff;
}

.irl-pill-trigger.has-selection {
    border-style: solid;
    border-color: #7d92ff;
    background: linear-gradient(135deg, #7d92ff 0%, #6b7ff0 100%);
    color: white;
}

/* Level-specific colors when selected */
.irl-filter-pill[data-filter="levels"] .irl-pill-trigger.has-selection.level-start-here,
.irl-filter-pill[data-filter="levels"] .irl-pill-trigger.has-selection.level-start_here {
    background: linear-gradient(135deg, #7dffa9 0%, #5ce892 100%);
    border-color: #7dffa9;
    color: #1a5a32;
}

.irl-filter-pill[data-filter="levels"] .irl-pill-trigger.has-selection.level-beginner {
    background: linear-gradient(135deg, #7dffea 0%, #5ce8d5 100%);
    border-color: #7dffea;
    color: #1a4a5a;
}

.irl-filter-pill[data-filter="levels"] .irl-pill-trigger.has-selection.level-intermediate {
    background: linear-gradient(135deg, #a97dff 0%, #9060f0 100%);
    border-color: #a97dff;
    color: white;
}

.irl-filter-pill[data-filter="levels"] .irl-pill-trigger.has-selection.level-delf {
    background: linear-gradient(135deg, #ffa97d 0%, #f09060 100%);
    border-color: #ffa97d;
    color: #5a3a1a;
}

.irl-filter-pill[data-filter="levels"] .irl-pill-trigger.has-selection.level-dalf {
    background: linear-gradient(135deg, #ff7d92 0%, #f0607a 100%);
    border-color: #ff7d92;
    color: white;
}

.irl-pill-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.irl-filter-pill.open .irl-pill-chevron {
    transform: rotate(180deg);
}

/* ========================================
   DROPDOWN MENU
   ======================================== */

.irl-pill-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: max-content;
    min-width: 180px;
    max-width: 90vw;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.irl-filter-pill.open .irl-pill-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.irl-dropdown-options {
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
}

.irl-dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    color: #475569;
    white-space: nowrap;
}

.irl-dropdown-option:hover {
    background: #f8fafc;
}

.irl-dropdown-option.selected {
    background: #f0f4ff;
    color: #7d92ff;
    font-weight: 600;
}

.irl-dropdown-option input[type="checkbox"] {
    display: none;
}

.irl-option-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.irl-dropdown-option.selected .irl-option-checkbox {
    background: #7d92ff;
    border-color: #7d92ff;
}

.irl-option-checkbox svg {
    width: 12px;
    height: 12px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}

.irl-dropdown-option.selected .irl-option-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.irl-option-label {
    flex: 1;
}

.irl-option-detail {
    font-size: 12px;
    color: #94a3b8;
}

/* Level color indicators in dropdown */
.irl-dropdown-option[data-level="start-here"] .irl-option-checkbox,
.irl-dropdown-option[data-level="start_here"] .irl-option-checkbox { border-color: #7dffa9; }
.irl-dropdown-option[data-level="beginner"] .irl-option-checkbox { border-color: #7dffea; }
.irl-dropdown-option[data-level="intermediate"] .irl-option-checkbox { border-color: #a97dff; }
.irl-dropdown-option[data-level="delf"] .irl-option-checkbox { border-color: #ffa97d; }
.irl-dropdown-option[data-level="dalf"] .irl-option-checkbox { border-color: #ff7d92; }

.irl-dropdown-option[data-level="start-here"].selected .irl-option-checkbox,
.irl-dropdown-option[data-level="start_here"].selected .irl-option-checkbox { background: #7dffa9; border-color: #7dffa9; }
.irl-dropdown-option[data-level="beginner"].selected .irl-option-checkbox { background: #7dffea; border-color: #7dffea; }
.irl-dropdown-option[data-level="intermediate"].selected .irl-option-checkbox { background: #a97dff; border-color: #a97dff; }
.irl-dropdown-option[data-level="delf"].selected .irl-option-checkbox { background: #ffa97d; border-color: #ffa97d; }
.irl-dropdown-option[data-level="dalf"].selected .irl-option-checkbox { background: #ff7d92; border-color: #ff7d92; }

/* ========================================
   SUBMIT BUTTON
   ======================================== */

.irl-submit-container {
    text-align: center;
    margin-top: 24px;
}

.irl-submit-button {
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #7d92ff 0%, #6b7ff0 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(125, 146, 255, 0.35);
    transition: all 0.3s ease;
}

.irl-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(125, 146, 255, 0.45);
}

.irl-submit-button:active {
    transform: translateY(0);
}

.irl-reset-link {
    display: inline-block;
    margin-left: 20px;
    color: #94a3b8;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
}

.irl-reset-link:hover {
    color: #64748b;
    text-decoration: underline;
}

/* ========================================
   ACTIVE FILTERS DISPLAY
   ======================================== */

.irl-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    min-height: 0;
}

.irl-active-filters:empty {
    display: none;
}

.irl-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 16px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.irl-remove-filter {
    width: 16px;
    height: 16px;
    background: #cbd5e1;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.irl-remove-filter:hover {
    background: #94a3b8;
}

.irl-clear-all-filters {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #fca5a5;
    border-radius: 16px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.irl-clear-all-filters:hover {
    background: #fef2f2;
}

/* ========================================
   RESULTS GRID
   ======================================== */

.esirl-series-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    font-size: 18px;
}

/* ========================================
   PAGINATION
   ======================================== */

.irl-theme-browser-pagination {
    margin-top: 32px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px 0;
}

.irl-theme-browser-pagination .button {
    padding: 12px 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.irl-theme-browser-pagination .button:hover {
    border-color: #7d92ff;
    color: #7d92ff;
}

.irl-theme-browser-pagination span {
    color: #64748b;
    font-size: 14px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .irl-madlibs {
        font-size: 16px;
        line-height: 1.6;
        padding: 20px 16px;
        text-align: left;
    }

    .irl-madlibs-text {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 6px;
    }

    .irl-filter-pill {
        margin: 0;
    }

    .irl-pill-trigger {
        font-size: 14px;
        padding: 6px 10px;
    }

    .irl-pill-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(100%);
        max-width: 100%;
        min-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 70vh;
    }

    .irl-filter-pill.open .irl-pill-dropdown {
        transform: translateY(0);
    }

    .irl-dropdown-options {
        max-height: 50vh;
    }

    .irl-submit-container {
        margin-top: 16px;
    }

    .irl-submit-button {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }

    .irl-reset-link {
        display: block;
        margin: 12px 0 0 0;
        text-align: center;
    }

    .irl-active-filters {
        justify-content: flex-start;
        margin-top: 12px;
    }

    .irl-filter-chip {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* ========================================
   OVERLAY (for mobile)
   ======================================== */

.irl-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 999;
}

.irl-dropdown-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   UTILITY
   ======================================== */

.irl-hide {
    display: none !important;
}

.irl-fade-in {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
