/**
 * =====================================================
 * أذكاري - حصنك اليومي
 * ملف الأنماط الرئيسي - تصميم أنيق وبسيط
 * =====================================================
 */

/* ============ المتغيرات ============ */
:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #d1fae5;
    --bg: #ffffff;
    --bg-alt: #f9fafb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.06);
    --radius: 12px;
    --radius-lg: 16px;
    --font: 'Tajawal', system-ui, sans-serif;
}

/* ============ إعادة التعيين ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============ الهيدر ============ */
.header {
    position: sticky;
    top: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 700;
}

.header-logo i { font-size: 1.4rem; }

.header-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.header-btn:hover { background: var(--primary-light); }

/* ============ القائمة الجانبية ============ */
.sidebar {
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    height: 100%;
    background: var(--bg);
    z-index: 200;
    padding: 20px;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

.sidebar.open { right: 0; }

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    float: left;
}

.sidebar-nav {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    border-radius: var(--radius);
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav a i { color: var(--primary); font-size: 1.1rem; }

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ============ الحاوية ============ */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

/* ============ القسم الرئيسي ============ */
.hero {
    text-align: center;
    padding: 32px 16px 40px;
}

.hero-icon {
    width: 72px;
    height: 72px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
}

.hero-title {
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.8;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ============ البحث ============ */
.search-section { margin-bottom: 32px; }

.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    font-family: var(--font);
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus { border-color: var(--primary); }

.search-box .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

.search-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.search-empty i {
    font-size: 3rem;
    color: var(--primary-light);
    margin-bottom: 12px;
}

/* ============ العناوين ============ */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-right: 12px;
    border-right: 3px solid var(--primary);
}

/* ============ شبكة التصنيفات ============ */
.categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 500px) {
    .categories { grid-template-columns: repeat(2, 1fr); }
}

/* ============ بطاقة التصنيف ============ */
.category-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.category-card h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.category-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.category-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ============ الفوتر ============ */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 12px;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}

/* ============ صفحة المفضلة ============ */
.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary);
}

.page-title i { margin-left: 8px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--primary-light);
    transition: background 0.2s;
}

.back-link:hover { background: #a7f3d0; }

.category-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s;
}

.remove-btn:hover { transform: scale(1.1); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 12px;
    display: block;
}

/* ============ صفحة 404 ============ */
body.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

.error-container {
    max-width: 440px;
    width: 100%;
    text-align: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px 28px;
    box-shadow: var(--shadow-lg);
}

.error-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.error-container h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 12px;
}

.error-message {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 28px;
    line-height: 1.6;
}

.home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
    border: none;
    cursor: pointer;
}

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

.home-btn i { color: #fff; }

.suggestions {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.suggestions p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.suggestions-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.suggestions-links a {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 40px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.2s;
}

.suggestions-links a:hover { background: #a7f3d0; }

/* ============ مساعد ============ */
.hidden { display: none !important; }