/**
 * Search Component Styles
 * Extracted and enhanced for SP Archive Legislative Search
 */

/* ============================================
   SEARCH GUIDE BOX
   ============================================ */
.search-guide-box {
    background: linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.08) 100%);
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 8px auto;
    max-width: 900px;
    text-align: left;
}

.search-guide-box .guide-title {
    font-size: 14px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    text-align: center;
}

.search-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 13px;
}

.guide-item {
    background: white;
    padding: 8px 10px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guide-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.guide-item.exact-phrase {
    border-left-color: #667eea;
}

.guide-item.exact-phrase strong {
    color: #667eea;
}

.guide-item.topic-search {
    border-left-color: #764ba2;
}

.guide-item.topic-search strong {
    color: #764ba2;
}

.guide-item.by-number {
    border-left-color: #f5576c;
}

.guide-item.by-number strong {
    color: #f5576c;
}

.guide-item.include-exclude {
    border-left-color: #10b981;
}

.guide-item.include-exclude strong {
    color: #10b981;
}

.guide-item code {
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Monaco', 'Consolas', monospace;
}

.guide-item.exact-phrase code {
    background: rgba(102,126,234,0.1);
}

.guide-item.topic-search code {
    background: rgba(118,75,162,0.1);
}

.guide-item.by-number code {
    background: rgba(245,87,108,0.1);
}

.guide-item.include-exclude code {
    background: rgba(16,185,129,0.1);
}

.guide-item .hint {
    color: #777;
    font-size: 11px;
    display: block;
    margin-top: 2px;
}

/* ============================================
   RESEARCH HEADER
   ============================================ */
.research-header {
    text-align: center;
    margin: 0 auto 15px auto;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.08) 100%);
    border-radius: 15px;
    max-width: 1200px;
}

.research-header h2 {
    font-size: 32px;
    font-weight: 900;
    text-align: center;
    margin: 0 0 6px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.research-header h2 span {
    font-size: 24px;
}

/* AI Capabilities Badge */
.ai-capabilities-badge {
    margin: 6px 0 0 0;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(118,75,162,0.15) 100%);
    border-radius: 25px;
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
}

.ai-capabilities-badge span:nth-child(1) { color: #667eea; }
.ai-capabilities-badge span:nth-child(2) { color: #764ba2; }
.ai-capabilities-badge span:nth-child(3) { color: #f5576c; }
.ai-capabilities-badge span:nth-child(4) { color: #10b981; }

/* ============================================
   INITIAL SEARCH BOX
   ============================================ */
.initial-search-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 30px;
    border-radius: 15px;
    margin: 10px 0 15px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.initial-search-box h2 {
    color: white;
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 5px 0;
    letter-spacing: 0.5px;
}

.initial-search-box p {
    color: rgba(255,255,255,0.95);
    font-size: 14px;
    margin: 0 0 15px 0;
    font-weight: 500;
}

/* ============================================
   DOCUMENT TYPE SELECTOR
   ============================================ */
.doc-type-selector {
    max-width: 800px;
    margin: 0 auto 12px auto;
}

.doc-type-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.doc-type-label {
    color: white;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.doc-type-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    font-size: 14px;
    font-weight: 800;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.doc-type-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
}

.doc-type-btn.ordinances:hover {
    background: rgba(102,126,234,0.15);
}

.doc-type-btn.resolutions:hover {
    background: rgba(245,87,108,0.15);
    box-shadow: 0 5px 15px rgba(245,87,108,0.4);
}

.doc-type-btn.both:hover {
    background: rgba(16,185,129,0.15);
    box-shadow: 0 5px 15px rgba(16,185,129,0.4);
}

.doc-type-btn .icon {
    font-size: 18px;
}

.doc-type-btn.ordinances .text {
    color: #667eea;
    font-size: 15px;
}

.doc-type-btn.resolutions .text {
    color: #f5576c;
    font-size: 15px;
}

.doc-type-btn.both .text {
    background: linear-gradient(135deg, #667eea 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 15px;
}

/* Selected state for document type buttons */
label:has(input[name="initialDocumentType"]:checked) {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.2) !important;
    box-shadow: 0 0 0 3px #10b981, 0 5px 20px rgba(16, 185, 129, 0.4) !important;
    transform: scale(1.05) !important;
}

/* Warning message */
.doc-type-warning {
    margin-top: 8px;
    padding: 8px 16px;
    background: rgba(255, 87, 108, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    text-align: center;
    display: none;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 87, 108, 0.3);
    animation: pulse 1.5s infinite;
}

/* ============================================
   SEARCH INPUT
   ============================================ */
.search-input-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    min-width: 400px;
}

.search-input-enhanced {
    width: 100%;
    padding: 14px 150px 14px 20px;
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: #ffffff;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.search-input-enhanced:focus {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    outline: none;
}

.search-input-enhanced::placeholder {
    color: #999;
    font-weight: 500;
}

/* Clear Button */
.search-clear-btn {
    position: absolute;
    right: 110px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    padding: 8px 12px;
    border-radius: 50%;
    border: 2px solid #dc3545;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
    width: 36px;
    height: 36px;
    line-height: 1;
}

.search-clear-btn:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

/* Search Button */
.search-submit-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #2c3e50;
    padding: 10px 24px;
    border-radius: 25px;
    border: none;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.5);
}

.search-submit-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.8);
}

/* Selection Display Badge */
.selection-display-badge {
    background: white;
    color: #667eea;
    padding: 12px 20px;
    border-radius: 25px;
    border: 2px solid #667eea;
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
    min-width: 150px;
    text-align: center;
    transition: all 0.3s ease;
}

/* ============================================
   INTEGRATED FILTERS
   ============================================ */
.integrated-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    margin-top: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    justify-content: center;
    align-items: center;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.integrated-filter-select,
.integrated-filter-input {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    transition: all 0.2s ease;
}

.integrated-filter-select:focus,
.integrated-filter-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Filter Pills */
.filter-pill {
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.filter-pill.include {
    border: 2px solid #27ae60;
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.filter-pill.include:focus {
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.2);
}

.filter-pill.exclude {
    border: 2px solid #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

.filter-pill.exclude:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.filter-pill.relevance {
    border: 2px solid #9b59b6;
    background: rgba(155, 89, 182, 0.1);
    color: #8e44ad;
}

/* AI Toggle Button */
.ai-toggle-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.ai-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.ai-toggle-btn.off {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    box-shadow: 0 2px 8px rgba(149, 165, 166, 0.4);
}

/* Clear Filters Button */
.clear-filters-btn {
    padding: 8px 14px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: #c0392b;
    transform: scale(1.05);
}

/* ============================================
   STREAMLINED SEARCH BAR
   ============================================ */
.streamlined-search-bar {
    display: none;
    position: relative;
    top: auto;
    z-index: 1;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.98), rgba(118, 75, 162, 0.98));
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    margin: 10px 0 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(255, 255, 255, 0.1) inset;
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: slideDown 0.4s ease-out;
    pointer-events: auto;
}

.streamlined-search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 1000px;
    margin: 0 auto;
}

.streamlined-input {
    width: 100%;
    padding: 14px 50px 14px 20px;
    border-radius: 50px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    background: #ffffff;
    color: #2c3e50;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: text;
    pointer-events: auto;
    z-index: 10;
    position: relative;
}

.streamlined-input:focus {
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(102, 126, 234, 0.4) !important;
    background: #ffffff;
    border-color: #FFD700;
    transform: translateY(-2px);
}

.compact-search-btn {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #2c3e50;
    padding: 14px 28px;
    border-radius: 50px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    white-space: nowrap;
    pointer-events: auto;
    z-index: 10;
    position: relative;
}

.compact-search-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6);
}

/* Results Counter */
.results-counter {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 16px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    color: #667eea;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
}

/* LLA Document Type Filter */
.lla-doc-type-filter {
    margin: 8px auto;
    text-align: center;
}

.lla-filter-options {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    background: rgba(255,255,255,0.15);
    padding: 4px 8px;
    border-radius: 20px;
}

.lla-filter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 3px 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.lla-filter-btn:hover {
    transform: scale(1.05);
}

label:has(input[name="llaDocumentType"]:checked) {
    border-color: #667eea !important;
    background: rgba(102, 126, 234, 0.25) !important;
    box-shadow: 0 0 0 1px #667eea !important;
}

/* ============================================
   CODIFIED BY SUBJECT
   ============================================ */
.codified-subject-section {
    margin: 15px 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    padding: 16px;
}

.codified-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.codified-header h3 {
    margin: 0;
    color: #000;
    font-size: 18px;
    font-weight: 700;
}

.codified-search-input {
    min-width: 240px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    transition: border-color 0.2s ease;
}

.codified-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pillars-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.pillar-column {
    border-radius: 12px;
    padding: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pillar-column:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.pillar-column[data-pillar="P1"] {
    background: #e8f4fd;
    border: 2px solid #1976d2;
}

.pillar-column[data-pillar="P2"] {
    background: #f3e5f5;
    border: 2px solid #7b1fa2;
}

.pillar-column[data-pillar="P3"] {
    background: #e8f5e8;
    border: 2px solid #388e3c;
}

.pillar-column[data-pillar="P4"] {
    background: #fff3e0;
    border: 2px solid #f57c00;
}

.pillar-column[data-pillar="P5"] {
    background: #fce4ec;
    border: 2px solid #c2185b;
}

.pillar-title {
    font-weight: 900;
    font-size: 14px;
    margin-bottom: 10px;
}

.pillar-column[data-pillar="P1"] .pillar-title { color: #1976d2; }
.pillar-column[data-pillar="P2"] .pillar-title { color: #7b1fa2; }
.pillar-column[data-pillar="P3"] .pillar-title { color: #388e3c; }
.pillar-column[data-pillar="P4"] .pillar-title { color: #f57c00; }
.pillar-column[data-pillar="P5"] .pillar-title { color: #c2185b; }

/* Subject Detail View */
.subject-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.back-to-pillars-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-to-pillars-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.clear-btn {
    transition: all 0.3s ease;
}

.clear-btn:hover {
    transform: rotate(90deg);
    color: #ff4444;
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */
@media (max-width: 768px) {
    .research-header h2 {
        font-size: 24px;
    }

    .research-header h2 span {
        font-size: 18px;
    }

    .search-guide-grid {
        grid-template-columns: 1fr;
    }

    .doc-type-options {
        flex-direction: column;
    }

    .search-input-wrapper {
        min-width: 100%;
    }

    .search-input-container {
        flex-direction: column;
    }

    .integrated-filters {
        padding: 10px;
    }

    .pillars-grid {
        grid-template-columns: 1fr;
    }

    .streamlined-search-container {
        flex-direction: column;
        gap: 8px;
    }

    .codified-header {
        flex-direction: column;
        align-items: stretch;
    }

    .codified-search-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .initial-search-box {
        padding: 15px;
    }

    .search-input-enhanced {
        padding: 12px 100px 12px 15px;
        font-size: 14px;
    }

    .search-clear-btn {
        right: 80px;
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .search-submit-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .integrated-filter-select,
    .integrated-filter-input {
        font-size: 12px;
        padding: 6px 10px;
    }

    .ai-capabilities-badge {
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* ============================================
   SEARCH HIGHLIGHT STYLES
   ============================================ */
.search-highlight,
mark.search-highlight {
    background: linear-gradient(135deg, #fff700 0%, #ffeb3b 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #000;
    box-shadow: 0 1px 3px rgba(255, 235, 59, 0.4);
    display: inline;
    margin: 0 1px;
}

/* Alternative highlight for inline marks */
mark {
    background: linear-gradient(135deg, #fff700 0%, #ffeb3b 100%);
    padding: 1px 3px;
    border-radius: 2px;
    color: #000;
}

/* Highlight animation for emphasis */
@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 1px 3px rgba(255, 235, 59, 0.4);
    }
    50% {
        box-shadow: 0 2px 8px rgba(255, 235, 59, 0.8);
    }
}

.search-highlight.animated {
    animation: highlightPulse 2s ease-in-out infinite;
}
