/* ========================================
   الملف: style.css
   التصميم الكامل للموقع
   ======================================== */

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

:root {
    --primary: #6C5CE7;
    --secondary: #FD79A8;
    --bg-light: #F8F9FA;
    --white: #FFFFFF;
    --dark: #2D3436;
    --gray: #636E72;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.1);
    --radius: 18px;
    --radius-sm: 12px;
}

body {
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    background: var(--bg-light);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 16px;
    position: relative;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* ===== عناصر زخرفية ===== */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    opacity: 0.04;
    z-index: 0;
    pointer-events: none;
}

.bg-shape-1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #6C5CE7, #FD79A8);
    top: -100px;
    right: -80px;
    animation: floatBg 20s ease-in-out infinite;
}

.bg-shape-2 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #FDCB6E, #E17055);
    bottom: -60px;
    left: -60px;
    animation: floatBg 18s ease-in-out infinite reverse;
}

.bg-shape-3 {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #00B894, #0984E3);
    top: 50%;
    right: 2%;
    animation: floatBg 15s ease-in-out infinite 2s;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(15px, -20px) scale(1.05) rotate(5deg); }
}

/* ===== الحاوية ===== */
.container {
    max-width: 1200px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ========================================
   الهيدر
   ======================================== */
.header {
    text-align: center;
    background: var(--white);
    padding: 30px 20px 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.3s, box-shadow 0.3s;
}

.header::before {
    content: '';
    display: block;
    width: calc(100% + 40px);
    height: 4px;
    background: linear-gradient(90deg, #6C5CE7, #FD79A8, #FDCB6E, #00B894, #0984E3);
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -30px -20px 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #6C5CE7, #FD79A8);
    color: white;
    padding: 5px 18px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--dark);
    transition: color 0.3s;
}

.header .subhead {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--gray);
    margin-top: -5px;
    transition: color 0.3s;
}

.highlight {
    background: linear-gradient(135deg, #6C5CE7, #FD79A8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #6C5CE7, #FD79A8);
    margin: 10px auto;
    border-radius: 4px;
}

.header .description {
    font-size: 0.95rem;
    color: var(--gray);
    transition: color 0.3s;
}

.header .description i {
    margin-left: 5px;
    color: #6C5CE7;
}

/* ===== زر التسوق ===== */
.btn-primary {
    background: linear-gradient(135deg, #6C5CE7, #A29BFE);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 60px;
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 18px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Tajawal', sans-serif;
    box-shadow: 0 8px 30px rgba(108, 92, 231, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(108, 92, 231, 0.5);
}

.btn-primary i {
    font-size: 1.1rem;
}

/* ========================================
   شبكة الأقسام الرئيسية (3 أعمدة)
   ======================================== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 10px;
}

.category-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

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

.category-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px 25px;
    text-align: center;
    background: var(--bg-light);
    min-height: 190px;
    justify-content: center;
    transition: background 0.3s;
}

.category-cover-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    margin-bottom: 12px;
    transition: all 0.4s;
}

.category-card:hover .category-cover-icon {
    transform: scale(1.1) rotate(-6deg);
}

.category-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0 0 4px;
    transition: color 0.3s;
}

.category-tools-count {
    font-size: 0.75rem;
    color: var(--gray);
    transition: color 0.3s;
}

.category-arrow {
    margin-top: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    transition: all 0.4s;
}

.category-card:hover .category-arrow {
    transform: translateX(-6px);
}

/* ========================================
   رأس صفحة القسم
   ======================================== */
.page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 25px;
    padding: 18px 22px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    transition: background 0.3s, box-shadow 0.3s;
}

.page-header .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 50px;
    background: var(--bg-light);
    transition: all 0.3s;
    font-size: 0.85rem;
}

.page-header .back-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-4px);
}

.page-header .page-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.page-header .page-title {
    flex: 1;
}

.page-header .page-title h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
    transition: color 0.3s;
}

.page-header .page-title p {
    color: var(--gray);
    margin: 2px 0 0;
    font-size: 0.8rem;
    transition: color 0.3s;
}

.page-header .tools-count-badge {
    background: var(--bg-light);
    padding: 4px 14px;
    border-radius: 50px;
    font-weight: 600;
    color: var(--gray);
    font-size: 0.75rem;
    transition: background 0.3s, color 0.3s;
}

/* ========================================
   شبكة الأدوات - عرض Grid
   ======================================== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 5px;
}

.tool-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px 16px 18px;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.tool-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 12px;
    transition: all 0.3s;
}

.tool-card:hover .tool-card-icon {
    transform: scale(1.08) rotate(-5deg);
}

.tool-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
    transition: color 0.3s;
}

.tool-card-desc {
    font-size: 0.8rem;
    color: var(--gray);
    line-height: 1.5;
    margin-bottom: 14px;
    transition: color 0.3s;
    flex: 1;
}

.tool-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 18px;
    border-radius: 50px;
    color: white;
    border: none;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Tajawal', sans-serif;
    width: 100%;
    justify-content: center;
}

.tool-card-btn:hover {
    transform: translateY(-2px) scale(1.04);
    filter: brightness(1.1);
}

.tool-card-btn i {
    font-size: 0.7rem;
}

/* ========================================
   الإحصائيات
   ======================================== */
.stats-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 16px 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-top: 20px;
    transition: background 0.3s, box-shadow 0.3s;
}

/* ===== رأس الإحصائيات ===== */
.stats-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stats-header .stats-icon {
    font-size: 1.3rem;
    color: #6C5CE7;
}

.stats-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    transition: color 0.3s;
}

.stats-header .live-badge {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.15);
    color: #E74C3C;
    padding: 2px 12px;
    border-radius: 50px;
    font-size: 0.6rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    animation: livePulse 1.5s infinite;
}

.stats-header .live-badge i {
    font-size: 0.35rem;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== شبكة الإحصائيات ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* ===== بطاقة الإحصائية ===== */
.stat-item {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    text-align: center;
    transition: all 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-item .stat-number {
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #6C5CE7, #FD79A8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.stat-item .stat-number.updating {
    animation: numberBounce 0.5s ease;
}

@keyframes numberBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.2); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.stat-item .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray);
    margin-top: 4px;
    transition: color 0.3s;
}

.stat-item .stat-label i {
    margin-left: 4px;
    font-size: 0.7rem;
    color: #6C5CE7;
}

.stat-item .stat-sub {
    font-size: 0.6rem;
    color: #B2BEC3;
    margin-top: 2px;
    transition: color 0.3s;
}

/* ===== تذييل الإحصائيات ===== */
.stats-footer {
    margin-top: 14px;
    font-size: 0.7rem;
    color: #B2BEC3;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: color 0.3s;
}

.stats-footer i {
    color: #6C5CE7;
}

/* ========================================
   زر تبديل الوضع المظلم
   ======================================== */
.dark-mode-toggle {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--white);
    color: var(--dark);
    border: 2px solid var(--bg-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.dark-mode-toggle i {
    transition: transform 0.4s;
}

.dark-mode-toggle:hover i {
    transform: rotate(20deg);
}

/* ========================================
   زر تبديل اللغة
   ======================================== */
.lang-toggle {
    position: fixed;
    bottom: 82px;
    left: 24px;
    padding: 0 16px;
    height: 44px;
    border-radius: 50px;
    background: var(--white);
    color: var(--dark);
    border: 2px solid var(--bg-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    white-space: nowrap;
}

.lang-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* ========================================
   الوضع المظلم (Dark Mode)
   ======================================== */
body.dark-mode {
    --bg-light: #1a1a2e;
    --white: #16213e;
    --dark: #ffffff;
    --gray: #a8b2d1;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.5);
    background: #0f0f1a;
}

body.dark-mode .bg-shape {
    opacity: 0.08;
}

body.dark-mode .header,
body.dark-mode .category-card,
body.dark-mode .page-header,
body.dark-mode .tool-card,
body.dark-mode .stats-section,
body.dark-mode .stat-item {
    background: var(--white);
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .category-cover {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .category-cover-icon {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .header h1,
body.dark-mode .category-name,
body.dark-mode .tool-card-title,
body.dark-mode .page-header .page-title h1,
body.dark-mode .stats-header h2 {
    color: #ffffff;
}

body.dark-mode .header .subhead,
body.dark-mode .header .description,
body.dark-mode .category-tools-count,
body.dark-mode .tool-card-desc,
body.dark-mode .page-header .page-title p,
body.dark-mode .stat-label,
body.dark-mode .stat-sub,
body.dark-mode .stats-footer {
    color: #a8b2d1;
}

body.dark-mode .page-header .back-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

body.dark-mode .page-header .back-btn:hover {
    background: var(--primary);
}

body.dark-mode .dark-mode-toggle {
    background: var(--white);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .dark-mode-toggle i {
    color: #FDCB6E;
}

body.dark-mode .lang-toggle {
    background: var(--white);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .badge {
    background: linear-gradient(135deg, #6C5CE7, #FD79A8);
}

body.dark-mode .btn-primary {
    background: linear-gradient(135deg, #6C5CE7, #A29BFE);
}

body.dark-mode .divider {
    background: linear-gradient(90deg, #6C5CE7, #FD79A8);
}

body.dark-mode .highlight {
    background: linear-gradient(135deg, #6C5CE7, #FD79A8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .stat-number {
    background: linear-gradient(135deg, #6C5CE7, #FD79A8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .live-badge {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.25);
}

body.dark-mode .category-card:hover {
    border-color: var(--primary);
}

body.dark-mode .tool-card:hover {
    border-color: var(--primary);
}

body.dark-mode .stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ========================================
   استجابة للشاشات
   ======================================== */

@media (max-width: 992px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    .header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    .container {
        max-width: 100%;
    }
    .header {
        padding: 20px 16px 18px;
        border-radius: 14px;
        margin-bottom: 20px;
    }
    .header h1 {
        font-size: 1.6rem;
    }
    .header .subhead {
        font-size: 1rem;
    }
    .header .description {
        font-size: 0.85rem;
    }
    .btn-primary {
        padding: 10px 28px;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }
    .categories-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
    .category-cover {
        min-height: 150px;
        padding: 20px 14px 18px;
    }
    .category-cover-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        border-radius: 16px;
    }
    .category-name {
        font-size: 1rem;
    }
    .category-tools-count {
        font-size: 0.65rem;
    }
    .category-arrow {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    .page-header {
        padding: 14px 16px;
        gap: 10px;
    }
    .page-header .page-title h1 {
        font-size: 1.1rem;
    }
    .page-header .page-title p {
        font-size: 0.7rem;
    }
    .page-header .page-icon {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
    .page-header .back-btn {
        font-size: 0.75rem;
        padding: 5px 12px;
    }
    .page-header .tools-count-badge {
        font-size: 0.65rem;
        padding: 3px 10px;
    }
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .tool-card {
        padding: 18px 12px 14px;
    }
    .tool-card-icon {
        width: 52px;
        height: 52px;
        font-size: 1.6rem;
    }
    .tool-card-title {
        font-size: 0.9rem;
    }
    .tool-card-desc {
        font-size: 0.7rem;
    }
    .tool-card-btn {
        padding: 5px 14px;
        font-size: 0.7rem;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-item .stat-number {
        font-size: 1.5rem;
    }
    .stats-header h2 {
        font-size: 1rem;
    }
    .stats-section {
        padding: 16px 12px 14px;
    }
    .dark-mode-toggle {
        bottom: 16px;
        left: 16px;
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    .lang-toggle {
        bottom: 66px;
        left: 16px;
        height: 38px;
        font-size: 0.7rem;
        padding: 0 12px;
    }
    .bg-shape {
        display: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    .container {
        padding: 0;
    }
    .header {
        padding: 16px 12px 14px;
        border-radius: 12px;
    }
    .header h1 {
        font-size: 1.3rem;
    }
    .header .subhead {
        font-size: 0.85rem;
    }
    .header .description {
        font-size: 0.75rem;
    }
    .badge {
        font-size: 0.6rem;
        padding: 3px 12px;
    }
    .btn-primary {
        padding: 8px 18px;
        font-size: 0.8rem;
    }
    .categories-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .category-cover {
        min-height: 120px;
        padding: 16px 10px 14px;
    }
    .category-cover-icon {
        width: 48px;
        height: 48px;
        font-size: 1.6rem;
        border-radius: 12px;
    }
    .category-name {
        font-size: 0.8rem;
    }
    .category-tools-count {
        font-size: 0.55rem;
    }
    .category-arrow {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    .page-header {
        padding: 10px 12px;
        gap: 8px;
    }
    .page-header .page-title h1 {
        font-size: 0.9rem;
    }
    .page-header .page-title p {
        font-size: 0.6rem;
    }
    .page-header .page-icon {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }
    .page-header .back-btn {
        font-size: 0.65rem;
        padding: 4px 10px;
    }
    .page-header .tools-count-badge {
        font-size: 0.55rem;
        padding: 2px 8px;
    }
    .tools-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .tool-card {
        padding: 14px 10px 12px;
        border-radius: 12px;
    }
    .tool-card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        border-radius: 12px;
    }
    .tool-card-title {
        font-size: 0.75rem;
    }
    .tool-card-desc {
        font-size: 0.6rem;
        margin-bottom: 10px;
    }
    .tool-card-btn {
        padding: 4px 10px;
        font-size: 0.6rem;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stats-section {
        padding: 12px 10px 12px;
        border-radius: 12px;
    }
    .stat-item {
        padding: 10px 6px;
        border-radius: 8px;
    }
    .stat-item .stat-number {
        font-size: 1.3rem;
    }
    .stat-item .stat-label {
        font-size: 0.65rem;
    }
    .stat-item .stat-sub {
        font-size: 0.5rem;
    }
    .stats-header h2 {
        font-size: 0.85rem;
    }
    .stats-header .live-badge {
        font-size: 0.5rem;
        padding: 2px 8px;
    }
    .stats-footer {
        font-size: 0.55rem;
    }
    .dark-mode-toggle {
        bottom: 12px;
        left: 12px;
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    .lang-toggle {
        bottom: 54px;
        left: 12px;
        height: 32px;
        font-size: 0.55rem;
        padding: 0 8px;
    }
}