/* Base & Resets */
:root {
    /* Deep Navy Blue and Majestic Gold theme for Hadith */
    --bg-color: #f0f4f8;
    --primary-dark: #0f172a;
    /* Deep Navy */
    --primary-light: #334155;
    --gold: #d4af37;
    --gold-light: #fef08a;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --card-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(15, 23, 42, 0.1);
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Background Shapes (Glassmorphism effect) */
.bg-shape {
    position: absolute;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.5;
    animation: float 12s ease-in-out infinite alternate;
}

.shape-1 {
    top: -50px;
    right: -50px;
    width: 350px;
    height: 350px;
    background: var(--gold-light);
    border-radius: 50%;
}

.shape-2 {
    bottom: -150px;
    left: -100px;
    width: 600px;
    height: 600px;
    background: #93c5fd;
    /* Soft blue */
    border-radius: 50%;
    animation-delay: -6s;
}

@keyframes float {
    0% {
        transform: translateY(0px) scale(1);
    }

    100% {
        transform: translateY(40px) scale(1.1);
    }
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    position: relative;
    z-index: 1;
}

.main-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 900px) {
    .main-layout {
        flex-direction: row;
    }

    .content-area {
        flex: 1;
    }

    .sidebar {
        width: 320px;
        flex-shrink: 0;
    }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 2px solid rgba(15, 23, 42, 0.05);
    padding-bottom: 2rem;
}

@media (min-width: 900px) {
    .header {
        text-align: right;
    }
}

.header-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    background: var(--primary-dark);
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.text-gold {
    color: var(--gold);
}

.title {
    font-family: 'Amiri', serif;
    font-size: 2.3rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

@media (min-width: 768px) {
    .title {
        font-size: 3.2rem;
    }
}

.subtitle {
    font-size: 1.1rem;
    color: var(--primary-light);
    line-height: 1.6;
    max-width: 800px;
}

/* Glass Card Component */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1.2rem;
    box-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.08);
    padding: 1.5rem;
}

/* Search Form */
.search-form {
    margin-bottom: 2.5rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 1.2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
}

.search-input-wrapper input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 1.4rem 1.4rem 1.4rem 4.5rem;
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
    color: var(--text-primary);
    border-radius: inherit;
}

.search-btn {
    position: absolute;
    left: 0.6rem;
    background: var(--primary-dark);
    color: var(--gold);
    border: none;
    border-radius: 1rem;
    padding: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.search-btn:hover:not(:disabled) {
    background: var(--primary-light);
    transform: scale(1.08) rotate(5deg);
}

.search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner Animation */
.spinner {
    animation: spin 1s linear infinite;
    color: var(--gold);
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Error & Messages */
.error-msg {
    margin-top: 1rem;
    padding: 1rem;
    background: #ffe4e6;
    color: #be123c;
    border: 1px solid #fecdd3;
    border-radius: 0.8rem;
}

.no-results {
    text-align: center;
    padding: 3.5rem 1rem;
    background: #fff;
    border-radius: 1.2rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
    border: 2px dashed #cbd5e1;
}

.hidden {
    display: none !important;
}

/* Results Cards */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.result-card {
    background: #fff;
    border-radius: 1.2rem;
    padding: 1.8rem 2.2rem;
    border-right: 6px solid var(--primary-dark);
    border-bottom: 2px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fade-in-up 0.5s ease backwards;
}

.result-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    border-right-color: var(--gold);
}

.result-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.2rem;
}

.result-title {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1.2rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-topic {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-rank {
    margin-right: auto;
    background: var(--primary-dark);
    color: var(--gold);
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    font-family: 'Amiri', serif;
    font-size: 1.1rem;
}

.result-text {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    line-height: 2.4;
    color: #1e293b;
    white-space: pre-wrap;
}

/* Sidebar Styling */
.sidebar-content {
    position: sticky;
    top: 2rem;
}

.sidebar-title {
    font-size: 1.4rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed rgba(15, 23, 42, 0.1);
}

.sidebar-subtitle {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 700;
}

.slider {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold);
    border: 3px solid var(--primary-dark);
    cursor: pointer;
    transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.features-list {
    list-style: none;
    font-size: 1rem;
    color: var(--text-secondary);
}

.features-list li {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0.5rem;
}

.icon {
    font-size: 1.2rem;
}

.footer-credit {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid rgba(15, 23, 42, 0.05);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: center;
}

/* Animations */
.animate-fade-in-up {
    animation: fade-in-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.delay-1 {
    animation-delay: 0.15s;
}

.delay-2 {
    animation-delay: 0.3s;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}