/*
Theme Name: Affiliate Deals Pro
Description: قالب احترافي للتسويق بالعمولة مع عرض المنتجات في 4 أعمدة وإدارة متقدمة
Author: Your Name
Version: 1.0
Text Domain: affiliate-deals
*/

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

/* المتغيرات الأساسية للألوان */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --light-bg: #ecf0f1;
    --dark-bg: #34495e;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.15);
    --shadow-heavy: 0 8px 30px rgba(0,0,0,0.2);
}

/* الخطوط الأساسية */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--light-bg);
    direction: rtl;
}

body.en {
    direction: ltr;
}

/* الحاوي الرئيسي */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* الشريط العلوي */
.top-header {
    background: var(--gradient-primary);
    padding: 10px 0;
    color: var(--white);
    text-align: center;
    font-size: 14px;
    box-shadow: var(--shadow-light);
}

/* الهيدر الرئيسي */
.main-header {
    background: var(--white);
    box-shadow: var(--shadow-medium);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background-image: url('images/logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.logo-text {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* أزرار الترجمة */
.language-switcher {
    display: flex;
    gap: 10px;
}

.lang-btn {
    padding: 8px 15px;
    background: var(--gradient-secondary);
    color: var(--white);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.lang-btn.active {
    background: var(--accent-color);
}

/* رسالة الترحيب */
.welcome-section {
    background: var(--gradient-primary);
    background-image: url('images/hero-bg.png'), var(--gradient-primary);
    background-size: cover, cover;
    background-position: center, center;
    background-blend-mode: overlay;
    color: var(--white);
    text-align: center;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.welcome-title {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
}

.welcome-subtitle {
    font-size: 24px;
    margin-bottom: 30px;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

/* مؤقت العد التنازلي */
.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    position: relative;
    z-index: 2;
}

.countdown-item {
    background: rgba(255,255,255,0.2);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    min-width: 80px;
}

.countdown-number {
    font-size: 36px;
    font-weight: bold;
    display: block;
}

.countdown-label {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 5px;
}

/* شبكة المنتجات */
.products-section {
    padding: 80px 0;
    background: var(--white);
}

.section-title {
    text-align: center;
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 50px;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--gradient-accent);
    border-radius: 2px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* بطاقة المنتج */
.product-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 25px;
}

.product-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.5;
}

.product-price {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.product-btn {
    width: 100%;
    padding: 15px;
    background: var(--gradient-secondary);
    color: var(--white);
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.product-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* الفوتر */
.main-footer {
    background: var(--dark-bg);
    color: var(--white);
    padding: 50px 0 20px;
    text-align: center;
}

.footer-content {
    margin-bottom: 30px;
}

.footer-logo {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.footer-text {
    opacity: 0.8;
    line-height: 1.6;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 20px;
    opacity: 0.6;
}

/* التجاوب */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .welcome-title {
        font-size: 32px;
    }
    
    .welcome-subtitle {
        font-size: 18px;
    }
    
    .countdown-timer {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .countdown-item {
        min-width: 60px;
        padding: 15px;
    }
    
    .countdown-number {
        font-size: 24px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .section-title {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .welcome-title {
        font-size: 24px;
    }
    
    .welcome-subtitle {
        font-size: 16px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* أنيميشن التحميل */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* تأثيرات إضافية */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}


/* صفحة المنتج الواحد */
.single-product {
    padding: 40px 0;
}

.single-product-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-bottom: 80px;
    align-items: start;
}

.product-gallery {
    position: sticky;
    top: 120px;
}

.product-main-image {
    width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
    transition: transform 0.3s ease;
}

.product-main-image:hover {
    transform: scale(1.02);
}

.product-image-placeholder.large {
    height: 400px;
    background: var(--gradient-primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
    font-weight: bold;
}

.product-details .product-title {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
    line-height: 1.2;
}

.product-price.large {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 30px;
    padding: 15px 25px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 15px;
    display: inline-block;
}

.product-description {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 40px;
}

.product-description p {
    margin-bottom: 20px;
}

.product-actions {
    margin-bottom: 40px;
}

.product-btn.large {
    padding: 20px 40px;
    font-size: 20px;
    font-weight: bold;
    min-width: 200px;
    display: inline-block;
    text-align: center;
}

.product-meta {
    padding: 25px;
    background: var(--light-bg);
    border-radius: 15px;
    border-right: 4px solid var(--secondary-color);
}

.product-meta p {
    margin-bottom: 10px;
    font-size: 16px;
}

.product-meta strong {
    color: var(--primary-color);
}

/* المنتجات ذات الصلة */
.related-products {
    margin-top: 80px;
    padding-top: 40px;
    border-top: 2px solid var(--light-bg);
}

/* التجاوب للصفحة الواحدة */
@media (max-width: 768px) {
    .single-product-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .product-gallery {
        position: static;
    }
    
    .product-details .product-title {
        font-size: 28px;
    }
    
    .product-price.large {
        font-size: 24px;
        padding: 12px 20px;
    }
    
    .product-btn.large {
        padding: 15px 30px;
        font-size: 18px;
        width: 100%;
    }
}

/* أنماط إضافية للإدارة */
.admin-notice {
    background: #fff;
    border-right: 4px solid #00a0d2;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin: 20px 0;
    padding: 12px;
}

.admin-notice.error {
    border-right-color: #dc3232;
}

.admin-notice.success {
    border-right-color: #46b450;
}

.secret-code-field {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
    padding: 15px;
    margin: 10px 0;
}

.secret-code-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.secret-code-field p {
    margin: 5px 0 0;
    font-style: italic;
    color: #856404;
}

/* تحسينات أداء الصور */
.product-image, .product-main-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* تأثيرات التحميل */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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


/* تأثيرات المؤقت المحسنة */
.countdown-number.flip {
    transform: rotateX(90deg);
    transition: transform 0.15s ease-in;
}

.countdown-timer.urgent .countdown-item {
    background: rgba(255, 193, 7, 0.3);
    border: 2px solid #ffc107;
    animation: urgentPulse 1s infinite;
}

.countdown-timer.critical .countdown-item {
    background: rgba(220, 53, 69, 0.3);
    border: 2px solid #dc3545;
    animation: criticalPulse 0.5s infinite;
}

.countdown-timer.expired .countdown-item {
    background: rgba(108, 117, 125, 0.3);
    border: 2px solid #6c757d;
    opacity: 0.6;
}

.countdown-timer.pulse-effect {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.countdown-expired {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    z-index: 10;
}

@keyframes urgentPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
}

@keyframes criticalPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
        background: rgba(220, 53, 69, 0.3);
    }
    50% { 
        box-shadow: 0 0 0 15px rgba(220, 53, 69, 0);
        background: rgba(220, 53, 69, 0.5);
    }
}

/* تحسينات إضافية للرسائل الترحيبية */
.welcome-title {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% {
        text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    }
    100% {
        text-shadow: 2px 2px 8px rgba(255,255,255,0.5), 0 0 20px rgba(255,255,255,0.3);
    }
}

.welcome-subtitle {
    animation: subtitleFloat 4s ease-in-out infinite;
}

@keyframes subtitleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* تأثيرات الجسيمات للخلفية */
.welcome-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.1) 2px, transparent 2px),
        radial-gradient(circle at 50% 10%, rgba(255,255,255,0.05) 1px, transparent 1px),
        radial-gradient(circle at 10% 90%, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 100px 100px, 150px 150px, 80px 80px, 120px 120px;
    animation: particleFloat 20s linear infinite;
    pointer-events: none;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-20px) rotate(360deg);
    }
}

/* تحسينات للأيقونات */
.logo-icon::before {
    content: '🛍️';
    font-size: 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

/* تأثيرات hover محسنة */
.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.product-card:hover .product-image {
    transform: scale(1.1);
}

.product-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* تأثيرات التحميل المحسنة */
.theme-loaded .fade-in-up {
    animation: fadeInUpImproved 0.8s ease-out forwards;
}

@keyframes fadeInUpImproved {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* تحسينات الاستجابة للمؤقت */
@media (max-width: 480px) {
    .countdown-timer {
        gap: 10px;
    }
    
    .countdown-item {
        min-width: 50px;
        padding: 10px;
    }
    
    .countdown-number {
        font-size: 20px;
    }
    
    .countdown-label {
        font-size: 12px;
    }
    
    .countdown-expired {
        font-size: 16px;
        padding: 10px 20px;
    }
}

