/* =====================================================
   إصلاحات الجوال - متجر إلكتروني
   ===================================================== */

/* إصلاح مشكلة الصور المفقودة في الجوال */
.product-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* معالجة الصور المفقودة */
.product-image img[src*="placeholder.jpg"],
.product-image img[src=""],
.product-image img:not([src]) {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
    position: relative;
}

.product-image img[src*="placeholder.jpg"]::before,
.product-image img[src=""]::before,
.product-image img:not([src])::before {
    content: "صورة غير متوفرة";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

/* إصلاح مشكلة الرموز المفقودة */
.product-image img[src*="placeholder.jpg"]::after,
.product-image img[src=""]::after,
.product-image img:not([src])::after {
    content: "\f03e"; /* رمز الصورة من Font Awesome */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: #cbd5e1;
    opacity: 0.5;
}

/* إصلاح عدد المنتجات في الجوال */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-image img {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .product-image img {
        height: 120px;
    }
}

/* إصلاح الفلتر يغطي المنتجات */
.filters-section {
    z-index: 10;
    position: relative;
}

/* إصلاح الخلفية السوداء */
body {
    background: #f8fafc !important;
}

/* إصلاح الترويسة في الجوال */
@media (max-width: 768px) {
    .main-header {
        padding: 10px 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }
    
    .search-box {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }
    
    /* إصلاح تداخل الأيقونات في الجوال */
    .auth-buttons-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        min-width: 0;
    }
    
    .auth-btn {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
        min-width: auto;
        flex-shrink: 0;
    }
    
    .register-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border-radius: 6px;
        text-decoration: none;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }
    
    .register-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    
    .login-btn {
        background: transparent;
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 6px;
        text-decoration: none;
        transition: all 0.3s ease;
    }
    
    .login-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    /* إصلاح أدوات المستخدم */
    .user-tools {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }
    
    .tool-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: white;
        text-decoration: none;
        position: relative;
        flex-shrink: 0;
        transition: all 0.3s ease;
    }
    
    .tool-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-1px);
    }
    
    /* زر القائمة الجانبية للجميع */
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 8px;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-1px);
    }
    
    /* إصلاح قائمة المستخدم في الجوال */
    .user-menu {
        position: relative;
        flex-shrink: 0;
    }
    
    .user-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        background: transparent;
        border: none;
        color: white;
        padding: 8px 12px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .user-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .user-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        min-width: 0;
    }
    
    .user-name {
        font-size: 12px;
        font-weight: 600;
        line-height: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 80px;
        color: white;
    }
    
    .user-status {
        font-size: 10px;
        opacity: 0.8;
        line-height: 1;
        color: white;
    }
    
    .user-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-radius: 8px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        display: none;
        min-width: 200px;
        margin-top: 5px;
    }
    
    .user-dropdown.show {
        display: block;
    }
    
    .dropdown-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
        color: #4a5568;
        text-decoration: none;
        transition: all 0.3s ease;
        border-bottom: 1px solid #f1f5f9;
    }
    
    .dropdown-item:last-child {
        border-bottom: none;
    }
    
    .dropdown-item:hover {
        background: #f8fafc;
        color: #667eea;
    }
    
    .dropdown-item.logout {
        color: #e53e3e;
    }
    
    .dropdown-item.logout:hover {
        background: #fed7d7;
        color: #c53030;
    }
    
    .dropdown-divider {
        height: 1px;
        background: #e2e8f0;
        margin: 8px 0;
    }
    
    /* إصلاح الشعار */
    .logo-link {
        display: flex;
        align-items: center;
        gap: 10px;
        text-decoration: none;
        color: white;
        flex-shrink: 0;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        flex-shrink: 0;
        transition: all 0.3s ease;
    }
    
    .logo-icon:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }
    
    .logo-text {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }
    
    .logo-title {
        font-size: 16px;
        font-weight: 700;
        margin: 0;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: white;
    }
    
    .logo-subtitle {
        font-size: 12px;
        opacity: 0.8;
        margin: 0;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: white;
    }
    
    /* إصلاح شريط البحث */
    .search-box {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        padding: 8px;
        backdrop-filter: blur(10px);
    }
    
    .search-input {
        background: rgba(255, 255, 255, 0.9);
        border: none;
        border-radius: 6px;
        padding: 10px 15px;
        color: #374151;
        font-size: 14px;
    }
    
    .search-input::placeholder {
        color: #9ca3af;
    }
    
    .search-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        border-radius: 6px;
        padding: 10px 15px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .search-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
}

@media (max-width: 480px) {
    /* إصلاحات إضافية للهواتف الصغيرة */
    .header-content {
        gap: 5px;
        padding: 0 10px;
    }
    
    .auth-buttons-left {
        gap: 5px;
    }
    
    .auth-btn {
        padding: 6px 8px;
        font-size: 11px;
        min-width: 60px;
    }
    
    .user-btn {
        padding: 6px 8px;
    }
    
    .user-name {
        font-size: 10px;
        max-width: 60px;
    }
    
    .user-status {
        font-size: 8px;
    }
    
    .user-avatar {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
    
    .logo-title {
        font-size: 12px;
    }
    
    .logo-subtitle {
        font-size: 8px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .user-tools {
        gap: 5px;
    }
    
    .tool-btn,
    .mobile-menu-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .search-box {
        margin-top: 8px;
    }
    
    .search-input {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .search-btn {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    /* إصلاحات للهواتف الصغيرة جداً */
    .header-content {
        gap: 3px;
        padding: 0 5px;
    }
    
    .auth-buttons-left {
        gap: 3px;
    }
    
    .auth-btn {
        padding: 5px 6px;
        font-size: 10px;
        min-width: 50px;
    }
    
    .user-btn {
        padding: 5px 6px;
    }
    
    .user-name {
        font-size: 9px;
        max-width: 50px;
    }
    
    .user-status {
        font-size: 7px;
    }
    
    .user-avatar {
        width: 16px;
        height: 16px;
        font-size: 8px;
    }
    
    .logo-title {
        font-size: 11px;
    }
    
    .logo-subtitle {
        font-size: 7px;
    }
    
    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .user-tools {
        gap: 3px;
    }
    
    .tool-btn,
    .mobile-menu-btn {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .search-input {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .search-btn {
        width: 32px;
        height: 32px;
        font-size: 11px;
    }
    
    /* إصلاح الألوان للهواتف الصغيرة جداً */
    .main-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    }
    
    .register-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }
    
    .register-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    
    .login-btn {
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .login-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .tool-btn:hover,
    .mobile-menu-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-1px);
    }
    
    .user-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .logo-icon:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }
    
    .search-box {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
    }
    
    .search-input {
        background: rgba(255, 255, 255, 0.9);
    }
    
    .search-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .search-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
}

/* إصلاح أزرار الإجراءات في الجوال */
@media (max-width: 480px) {
    .product-actions {
        gap: 8px;
    }
    
    .action-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* إصلاح بطاقات المنتجات في الجوال */
@media (max-width: 768px) {
    .product-card {
        padding: 15px;
    }
    
    .product-title {
        font-size: 14px;
        line-height: 1.3;
    }
    
    .product-description {
        font-size: 12px;
        line-height: 1.4;
    }
    
    .price {
        font-size: 16px;
    }
    
    .add-to-cart-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* إصلاح الإحصائيات في الجوال */
@media (max-width: 480px) {
    .page-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        width: 100%;
        justify-content: center;
    }
}

/* إصلاح الفلاتر في الجوال */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .advanced-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* إصلاح البحث في الجوال */
@media (max-width: 480px) {
    .search-input {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .search-btn {
        width: 40px;
        height: 40px;
    }
}

/* إصلاح الإشعارات في الجوال */
@media (max-width: 768px) {
    .notification {
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }
    
    .notification-content {
        padding: 12px 15px;
        font-size: 14px;
    }
}

/* إصلاح التحميل البطيء للصور */
.product-image {
    background: #f8fafc;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.product-image::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    z-index: 1;
}

.product-image img {
    position: relative;
    z-index: 2;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* إخفاء تأثير التحميل بعد تحميل الصورة */
.product-image img[src]:not([src=""]) {
    animation: fadeIn 0.3s ease-in;
}

.product-image img[src]:not([src=""]) + .product-image::before {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
} 