/**
 * نظام التصميم المتجاوب المتقدم - Mosap.tech
 * يتكيف تلقائياً مع جميع أنواع الأجهزة
 */

/* متغيرات CSS للتخصيص حسب نوع الجهاز */
:root {
    --mobile-padding: 10px;
    --tablet-padding: 20px;
    --desktop-padding: 30px;
    --mobile-font-size: 14px;
    --tablet-font-size: 16px;
    --desktop-font-size: 18px;
}

/* كشف نوع الجهاز باستخدام CSS Media Queries */

/* === الهواتف الذكية === */
@media screen and (max-width: 480px) {
    .device-type::after {
        content: "mobile";
        display: none;
    }
    
    /* تخصيص للهواتف */
    .container {
        padding: var(--mobile-padding) !important;
        max-width: 100% !important;
    }
    
    .header {
        padding: 10px 0 !important;
    }
    
    .header-content {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .nav {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
    }
    
    .nav-link {
        padding: 8px 12px !important;
        font-size: 14px !important;
    }
    
    .hero-title {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 15px !important;
    }
    
    .hero-subtitle {
        font-size: 14px !important;
        margin-bottom: 20px !important;
    }
    
    .hero-features {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .feature {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    
    .tools-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .tool-card {
        padding: 15px !important;
    }
    
    .tool-card h3 {
        font-size: 16px !important;
    }
    
    .tool-card p {
        font-size: 13px !important;
    }
    
    .tool-btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
    
    .upload-area {
        padding: 20px !important;
        min-height: 150px !important;
    }
    
    .upload-area i {
        font-size: 2rem !important;
    }
    
    .upload-text {
        font-size: 14px !important;
    }
    
    .controls {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .control-group {
        width: 100% !important;
    }
    
    .process-btn {
        width: 100% !important;
        padding: 12px !important;
    }
    
    /* مخفي في الهواتف */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-hidden {
        display: none !important;
    }
}

/* === الأجهزة اللوحية الصغيرة === */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .device-type::after {
        content: "tablet-small";
        display: none;
    }
    
    .container {
        padding: var(--tablet-padding);
        max-width: 95%;
    }
    
    .tools-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    
    .hero-title {
        font-size: 2.2rem !important;
    }
    
    .nav {
        gap: 15px !important;
    }
    
    .upload-area {
        padding: 25px !important;
        min-height: 180px !important;
    }
    
    .controls {
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }
    
    .control-group {
        min-width: 45% !important;
    }
}

/* === الأجهزة اللوحية الكبيرة === */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .device-type::after {
        content: "tablet-large";
        display: none;
    }
    
    .container {
        max-width: 90%;
    }
    
    .tools-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 25px !important;
    }
    
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .upload-area {
        padding: 30px !important;
        min-height: 200px !important;
    }
    
    .tablet-hidden {
        display: none !important;
    }
}

/* === أجهزة الكمبيوتر المحمولة === */
@media screen and (min-width: 1025px) and (max-width: 1366px) {
    .device-type::after {
        content: "laptop";
        display: none;
    }
    
    .container {
        max-width: 85%;
    }
    
    .tools-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 30px !important;
    }
    
    .hero-title {
        font-size: 2.8rem !important;
    }
}

/* === الشاشات الكبيرة === */
@media screen and (min-width: 1367px) {
    .device-type::after {
        content: "desktop";
        display: none;
    }
    
    .container {
        max-width: 1200px;
    }
    
    .tools-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 35px !important;
    }
    
    .hero-title {
        font-size: 3rem !important;
    }
    
    .mobile-only {
        display: none !important;
    }
}

/* === تخصيصات الاتجاه (عمودي/أفقي) === */
@media screen and (orientation: landscape) and (max-width: 768px) {
    .hero {
        padding: 20px 0 !important;
    }
    
    .hero-title {
        font-size: 1.5rem !important;
    }
    
    .tools-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .landscape-adjust {
        height: auto !important;
        min-height: unset !important;
    }
}

/* === تحسينات اللمس للأجهزة المحمولة === */
@media (hover: none) and (pointer: coarse) {
    .tool-btn,
    .nav-link,
    .btn {
        min-height: 44px !important; /* حد أدنى لسهولة اللمس */
        touch-action: manipulation;
    }
    
    .tool-card {
        transition: transform 0.2s ease !important;
    }
    
    .tool-card:active {
        transform: scale(0.98) !important;
    }
    
    /* إزالة hover effects في الأجهزة اللمسية */
    .tool-btn:hover,
    .nav-link:hover {
        background: initial !important;
    }
}

/* === تحسينات للشاشات عالية الكثافة === */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo i,
    .tool-card i {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* === تخصيصات خاصة للـ iPhone === */
@supports (-webkit-touch-callout: none) {
    .ios-safe-area {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .upload-area {
        -webkit-appearance: none !important;
        appearance: none !important;
    }
}

/* === إعلان نصي متجاوب === */
.text-ad-banner {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.text-ad-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.text-ad-banner.hidden {
    display: none !important;
}

.text-ad-content {
    position: relative;
    z-index: 2;
}

.text-ad-title {
    font-size: 18px;
    font-weight: 700;
    color: #007AFF;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.text-ad-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.text-ad-cta {
    background: #007AFF;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.text-ad-cta:hover {
    background: #0051D5;
    color: white;
    text-decoration: none;
}

.text-ad-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.1);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    z-index: 3;
    transition: all 0.3s ease;
}

.text-ad-close:hover {
    background: rgba(0,0,0,0.2);
    color: #333;
}

/* تخصيص الإعلان النصي للأجهزة المختلفة */
@media screen and (max-width: 480px) {
    .text-ad-banner {
        padding: 12px;
        margin: 15px 0;
    }
    
    .text-ad-title {
        font-size: 16px;
    }
    
    .text-ad-description {
        font-size: 13px;
    }
    
    .text-ad-cta {
        padding: 10px 20px;
        font-size: 13px;
    }
}

@media screen and (min-width: 1025px) {
    .text-ad-banner {
        padding: 20px;
        margin: 25px 0;
    }
    
    .text-ad-title {
        font-size: 20px;
    }
    
    .text-ad-description {
        font-size: 15px;
    }
}

/* === أنيميشن لتحميل الصفحة === */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === مؤشر نوع الجهاز (مخفي) === */
.device-indicator {
    position: fixed;
    top: -100px;
    left: -100px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* === تحسينات الأداء === */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* === تحسين الطباعة === */
@media print {
    .text-ad-banner,
    .nav,
    .upload-area,
    .mobile-only {
        display: none !important;
    }
    
    body {
        font-size: 12pt !important;
        line-height: 1.4 !important;
    }
}