/* استيراد الخطوط */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;600;700&display=swap');

/* المتغيرات العامة */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.3s ease;
    --transition-slow: all 0.5s ease;
}

/* إعدادات أساسية محسنة */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    line-height: 1.6;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* الحاوية الرئيسية */
.ai-tools-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    position: relative;
}

.ai-tools-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color)10, transparent 70%);
    border-radius: 0 0 2rem 2rem;
    z-index: -1;
}

/* الهيدر المحسن */
.ai-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
}

.ai-header h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.ai-header .subtitle {
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 300;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* أيقونات التصنيفات المحسنة */
.categories-icons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
    padding: 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.category-icon-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-icon {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.category-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color)10, var(--accent-color)10);
    opacity: 0;
    transition: var(--transition-normal);
    border-radius: inherit;
}

.category-icon:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.category-icon:hover::before {
    opacity: 1;
}

.category-icon img {
    width: 45px;
    height: 45px;
    margin-bottom: 0.5rem;
    transition: var(--transition-normal);
    position: relative;
    z-index: 1;
}

.category-icon:hover img {
    transform: scale(1.1);
}

.category-name {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    position: relative;
    z-index: 1;
    margin-top: 0.25rem;
}

/* قسم التصنيف */
.category-section {
    margin-top: 5rem;
    position: relative;
}

.category-title {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    padding-right: 1rem;
}

.category-title::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-sm);
}

/* شبكة الأدوات المحسنة */
.ai-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

/* بطاقة الأداة المحسنة */
.ai-tool-card {
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-normal);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(10px);
}

.ai-tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: var(--transition-normal);
}

.ai-tool-card:hover {
    transform: translateY(-12px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-hover);
}

.ai-tool-card:hover::before {
    opacity: 1;
}

.tool-logo {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.tool-logo img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    transition: var(--transition-normal);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.ai-tool-card:hover .tool-logo img {
    transform: scale(1.1);
}

.tool-content {
    padding: 1.5rem;
    flex-grow: 1;
}

.tool-title {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
}

.tool-description {
    font-size: 1rem;
    color: var(--text-secondary);
    min-height: 80px;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.tool-meta {
    margin-top: 1.5rem;
}

.tool-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-badge,
.pricing-badge,
.account-badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-xl);
    font-weight: 500;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.account-badge {
    background-color:#00FFF6;
}

.account-badge.true {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #991b1b;
    border-color: #f87171;
}

.category-badge {
    background-color: var(--bg-tertiary);
    color: #1d4ed8;
}

.pricing-badge.free {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border-color: #86efac;
}

.pricing-badge.freemium {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border-color: #fbbf24;
}

.pricing-badge.paid {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #991b1b;
    border-color: #f87171;
}

.pricing-badge.open_source {
    background: linear-gradient(135deg, #cffafe, #a5f3fc);
    color: #155e75;
    border-color: #22d3ee;
}

.pricing-badge.trial {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #475569;
    border-color: #94a3b8;
}

.language-support {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.language-label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* زر التجربة المحسن */
.tool-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    background: var(--bg-secondary);
}

.visit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: var(--transition-normal);
    border: none;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.visit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition-normal);
}

.visit-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.visit-btn:hover::before {
    left: 100%;
}

.visit-btn .icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: var(--transition-fast);
}

.visit-btn:hover .icon {
    transform: translateX(-2px);
}

/* فاصل محسن */
hr {
    margin: 5rem 0;
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    position: relative;
}

hr::after {
    content: '⭐';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 0 1rem;
    font-size: 1.5rem;
}

/* تحسينات للأنيميشن */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-tool-card {
    animation: fadeInUp 0.6s ease forwards;
}

.ai-tool-card:nth-child(2) { animation-delay: 0.1s; }
.ai-tool-card:nth-child(3) { animation-delay: 0.2s; }
.ai-tool-card:nth-child(4) { animation-delay: 0.3s; }

/* تصميم متجاوب محسن */
@media (max-width: 1024px) {
    .ai-tools-container {
        padding: 2rem 1rem;
    }
    
    .categories-icons {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .ai-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .ai-tools-container {
        padding: 1.5rem 1rem;
    }
    
    .category-icon {
        width: 90px;
        height: 90px;
    }

    .category-icon img {
        width: 35px;
        height: 35px;
    }
    
    .categories-icons {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        padding: 1rem;
    }

    .ai-tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .tool-title {
        font-size: 1.1rem;
    }

    .tool-description {
        font-size: 0.9rem;
        min-height: 60px;
    }
    
    .visit-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .ai-header h2 {
        font-size: 2rem;
    }
    
    .categories-icons {
        padding: 0.75rem;
    }
    
    .category-icon {
        width: 70px;
        height: 70px;
    }
    
    .category-icon img {
        width: 28px;
        height: 28px;
    }
    
    .category-name {
        font-size: 0.75rem;
    }
}

/* تحسينات إضافية للشاشات الكبيرة */
@media (min-width: 1400px) {
    .ai-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2.5rem;
    }
}

/* تحسينات الأداء */
.ai-tool-card,
.category-icon,
.visit-btn {
    will-change: transform;
}

/* تحسين التركيز للوصولية */
.visit-btn:focus,
.category-icon-link:focus .category-icon {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
