:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --primary-blue: #0984e3;
    --primary-purple: #6c5ce7;
    --primary-green: #00b894;
    --text-light: #f5f6fa;
    --card-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

body.search-system-page {
    background:
        linear-gradient(rgba(15, 17, 26, 0.85), rgba(15, 17, 26, 0.85)),
        url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?ixlib=rb-1.2.1&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;
    color: var(--text-light);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

body.search-system-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.18) 3px, transparent 3px);
    background-size: 50px 50px;
    z-index: -1;
    pointer-events: none;
    animation: gridMove 60s linear infinite;
    opacity: 0.8;
}

@keyframes gridMove {
    from {
        transform: translate(-25%, -25%);
    }

    to {
        transform: translate(0, 0);
    }
}

/* Dynamic Background Blobs */
.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: blobFloat 20s infinite alternate;
    opacity: 0.3;
}

@keyframes blobFloat {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(50px, 50px) scale(1.2);
    }
}

.search-main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease;
}

.search-header h1 {
    font-size: 3.2rem;
    font-weight: 900;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    display: inline-block;
}

.search-header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 4px;
    background: #fbc531;
    border-radius: 2px;
    box-shadow: 0 0 20px #fbc531;
}

/* Tabs Navigation */
.search-tabs {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    margin: 0 auto 40px auto;
    width: max-content;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 20px 10px 15px 10px;
    /* Added top padding to prevent clipping */
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 10;
}

.search-tabs::-webkit-scrollbar {
    height: 5px;
}

.search-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 18px 40px;
    border-radius: 20px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.2rem;
    white-space: nowrap;
}

.tab-btn i {
    font-size: 1.4rem;
    transition: transform 0.3s ease;
}

.tab-btn:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.tab-btn:hover i {
    transform: scale(1.2) rotate(10deg);
}

.tab-btn:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
}

.tab-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.8);
}

.tab-btn.active[data-target="booksSection"] {
    background: var(--primary-blue);
    border-color: transparent;
}

.tab-btn.active[data-target="thesesSection"] {
    background: var(--primary-purple);
    border-color: transparent;
}

.tab-btn.active[data-target="discsSection"] {
    background: var(--primary-green);
    border-color: transparent;
}

.tab-btn.active[data-target="magazinesSection"] {
    background: linear-gradient(135deg, #fbc531 0%, #e17055 100%);
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(251, 197, 49, 0.3);
}

/* Form Card */
.search-form-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 40px;
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.8s ease;
}

.search-section {
    display: none;
}

.search-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-label {
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
}

.form-control,
.form-select {
    background: rgba(30, 41, 59, 0.8) !important;
    border: 2px solid rgba(99, 102, 241, 0.5) !important;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    color: white !important;
    border-radius: 15px !important;
    padding: 14px 20px !important;
    font-size: 1.1rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.form-control:focus,
.form-select:focus {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: #fbc531 !important;
    box-shadow: 0 0 15px rgba(251, 197, 49, 0.3), inset 0 2px 10px rgba(0, 0, 0, 0.4) !important;
    color: white !important;
    transform: translateY(-2px);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.form-select option {
    background: #2d3436;
    color: white;
}

.btn-search {
    background: linear-gradient(135deg, #fbc531 0%, #e17055 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1.4rem;
    margin-top: 40px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100%;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(251, 197, 49, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-search::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

.btn-search:hover::before {
    left: 100%;
}

.btn-search:hover {
    transform: scale(1.02) translateY(-5px);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.5);
}

/* Utils */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Select2 Custom Styling */
.select2-container--default .select2-selection--single {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 15px !important;
    height: 55px !important;
    transition: all 0.3s ease !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: white;
    padding-right: 15px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px;
}

.select2-dropdown {
    background: #2d3436;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    z-index: 9999;
}

.select2-search__field {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 8px !important;
}

.select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-blue) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(255, 255, 255, 0.1);
}

.select2-results__option {
    padding: 10px 15px;
}

@media (max-width: 992px) {
    .search-header h1 {
        font-size: 2.6rem;
    }

    .tab-btn {
        padding: 15px 30px;
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    body.search-system-page {
        padding: 20px 0;
    }

    .search-header h1 {
        font-size: 2.22rem;
    }

    .search-form-card {
        padding: 25px;
        border-radius: 20px;
    }

    .tab-btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}