/* Arabic-friendly minimalistic design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border: #e5e7eb;
    --highlight: #fef3c7;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
    line-height: 1.8;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    background: white;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.search-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.search-btn:active {
    transform: translateY(0);
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: white;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Results Section */
.results-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.stats {
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Result Item */
.result-item {
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.result-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.result-meta {
    flex: 1;
}

.book-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.author-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.page-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.result-context {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    line-height: 2;
    color: var(--text-primary);
    border-right: 3px solid var(--primary);
}

.result-context mark {
    background: var(--highlight);
    color: var(--text-primary);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 600;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
}

.page-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.page-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: white;
}

.empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.empty-state p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.error-state svg {
    color: #ef4444;
    margin-bottom: 1.5rem;
}

.error-state h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.error-state p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
    }

    .logo {
        font-size: 2rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .results-section {
        padding: 1.25rem;
    }

    .result-header {
        flex-direction: column;
    }

    .pagination {
        flex-direction: column;
        gap: 1rem;
    }

    .page-btn {
        width: 100%;
        justify-content: center;
    }
}
