/* استجابة متقدمة لجميع الشاشات */

/* الهواتف الصغيرة (أقل من 375px) */
@media screen and (max-width: 374px) {
    .tawkid-document-container.modal-mode {
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    
    .document-header {
        padding: 0.75rem 1rem !important;
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .document-header h1 {
        font-size: 1.1rem !important;
        margin-bottom: 5px !important;
    }
    
    .document-grid {
        padding: 0.75rem !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    .card-title {
        padding: 0.75rem !important;
        font-size: 1rem !important;
    }
    
    .info-table,
    .barcode-section,
    .verification-section,
    .codes-grid,
    .actions-grid {
        padding: 0.75rem !important;
    }
    
    .barcode-number {
        font-size: 0.9rem !important;
        padding: 8px !important;
    }
    
    .actions-grid {
        grid-template-columns: 1fr !important;
    }
    
    .action-button {
        padding: 10px !important;
        font-size: 0.9rem !important;
    }
    
    .system-info {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 0.75rem !important;
    }
}

/* الهواتف (375px - 767px) */
@media screen and (min-width: 375px) and (max-width: 767px) {
    .tawkid-document-container.modal-mode {
        width: 95vw !important;
        max-height: 95vh !important;
    }
    
    .document-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .info-row {
        flex-direction: row !important;
    }
    
    .codes-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* الأجهزة اللوحية (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .tawkid-document-container.modal-mode {
        width: 90vw !important;
    }
    
    .document-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .card-actions {
        grid-column: span 2 !important;
    }
}

/* الحواسيب الصغيرة (1024px - 1279px) */
@media screen and (min-width: 1024px) and (max-width: 1279px) {
    .tawkid-document-container.modal-mode {
        width: 85vw !important;
    }
    
    .document-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* الحواسيب الكبيرة (1280px فأكثر) */
@media screen and (min-width: 1280px) {
    .tawkid-document-container.modal-mode {
        width: 1200px !important;
    }
}

/* دعم اللمس للأجهزة المحمولة */
@media (hover: none) and (pointer: coarse) {
    .code-actions {
        opacity: 1 !important;
        background: rgba(255, 255, 255, 0.9) !important;
        padding: 5px !important;
    }
    
    .action-button {
        padding: 12px !important;
        min-height: 60px !important;
    }
    
    .copy-btn,
    .action-btn {
        width: 44px !important;
        height: 44px !important;
    }
}

/* التوجيه الأفقي */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .tawkid-document-container.modal-mode {
        max-height: 85vh !important;
    }
    
    .document-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .card-title {
        font-size: 1rem !important;
        padding: 0.75rem !important;
    }
}

/* دعم الوضع الداكن */
@media (prefers-color-scheme: dark) {
    .tawkid-document-container.page-mode {
        background: #1a1a1a !important;
        color: #ffffff !important;
    }
    
    .card {
        background: #2d2d2d !important;
        border-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .card-title {
        background: #333333 !important;
        border-color: #404040 !important;
    }
    
    .barcode-number,
    .verification-link {
        background: #333333 !important;
        color: #ffffff !important;
    }
    
    .info-label {
        color: #cccccc !important;
    }
}

/* الطباعة */
@media print {
    .tawkid-document-container {
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .modal-mode {
        position: static !important;
        transform: none !important;
    }
    
    .close-modal-btn,
    .copy-btn,
    .action-btn,
    .code-actions,
    .alert-close,
    .modal-backdrop {
        display: none !important;
    }
    
    .document-header {
        border-bottom: 2px solid #000 !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    @page {
        margin: 1cm;
    }
}