* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global select base — removes OS chrome, sets dark theme for box + popup list */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: none;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

/* var() doesn't resolve inside <option> in most browsers — use hardcoded values */
select option {
    background-color: #111111;
    color: #e2e2ea;
}

select option:checked {
    background-color: #1e3a3a;
    color: #00d4ff;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    padding: 4rem 1rem;
}

/* Background elements with animations */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    display: none;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: var(--brand-orange);
}

.blob-2 {
    bottom: -15%;
    right: -10%;
    width: 700px;
    height: 700px;
    background: var(--brand-cyan);
    animation-delay: -7s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -60px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.95); }
    100% { transform: translate(0, 0) scale(1); }
}

.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    z-index: 1;
}

header {
    text-align: center;
}

header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

header h1 span {
    color: var(--brand-orange);
    position: relative;
    display: inline-block;
}

header h1 span::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 122, 42, 0.3);
    z-index: -1;
    border-radius: 4px;
}

header p {
    color: var(--text-secondary);
    font-size: 1.15rem;
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Search container */
.search-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

#searchInput {
    width: 100%;
    height: calc(46px + 1.2rem);
    padding: 0 1.75rem;
    padding-right: 7.5rem;
    font-size: 1.2rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: none;
    border-radius: 20px;
    outline: none;
    transition: box-shadow 0.25s ease;
    box-shadow: var(--neo-inset);
}

#searchInput:focus {
    box-shadow: inset 0 0 14px var(--neo-dark), 0 0 0 2px rgba(255, 122, 42, 0.25);
}

#searchInput::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.clear-search-btn {
    position: absolute;
    top: 50%;
    right: 4rem;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0;
}

.clear-search-btn:hover {
    background: rgba(255, 80, 80, 0.15);
    color: #ff6060;
    border-color: rgba(255, 80, 80, 0.3);
}

#searchBtn {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    background: var(--brand-orange);
    color: #111111;
    border: none;
    border-radius: 14px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
    box-shadow: 0 0 10px var(--neo-dark), 0 0 16px var(--brand-orange-glow);
}

#searchBtn:hover {
    background: #ff8c3a;
    transform: translateY(-50%) translateY(-1px);
    box-shadow: 0 0 14px var(--neo-dark), 0 0 22px var(--brand-orange-glow);
}

#searchBtn:active {
    transform: translateY(-50%);
    box-shadow: var(--neo-pressed), 0 0 10px var(--brand-orange-glow);
}

/* Search results dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    border: none;
    border-radius: 20px;
    box-shadow: var(--neo-float);
    max-height: 380px;
    overflow-y: auto;
    list-style: none;
    z-index: 10;
}

.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.search-result-item {
    padding: 1.15rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 122, 42, 0.08);
}

.result-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.result-code {
    font-family: 'Space Mono', monospace;
    color: var(--brand-orange);
    font-weight: 600;
    background: rgba(255, 122, 42, 0.12);
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 122, 42, 0.2);
}

.result-chapter {
    font-size: 0.78rem;
    color: var(--brand-cyan);
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
    margin-left: auto;
    white-space: nowrap;
}

.result-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.no-results {
    padding: 1.75rem;
    text-align: center;
    color: var(--text-muted);
}

/* Error message */
.error-message {
    text-align: center;
    color: var(--error);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1.2rem;
    border-radius: 16px;
    max-width: 700px;
    margin: 0 auto;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Toast notification */
.toast-notification {
    position: fixed;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--bg-deep);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.65rem 1.4rem;
    border-radius: 12px;
    font-size: 0.88rem;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.toast-notification.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden {
    display: none !important;
}
