/* ===== نظام التصميم الرئيسي ===== */
.wsm-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
}

.wsm-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 25px 20px;
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.wsm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

/* ===== العناوين ===== */
.wsm-title {
    color: #1f2937;
    text-align: center;
    margin-bottom: 30px;
    font-size: clamp(1.5rem, 4vw, 1.8rem);
    font-weight: 700;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    line-height: 1.3;
    padding: 0 10px;
}

.wsm-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #dc2626, #ef4444);
    border-radius: 2px;
}

/* ===== نظام الإشعارات المحسن ===== */
.wsm-notifications-container {
    position: fixed;
    top: 10px;
    right: 10px;
    left: 10px;
    z-index: 10000;
    max-width: 100%;
    width: auto;
}

.wsm-notification {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

.wsm-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.wsm-notification.hide {
    transform: translateY(-20px);
    opacity: 0;
}

/* أنواع الإشعارات */
.wsm-notification.success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.wsm-notification.error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2, #fecaca);
}

.wsm-notification.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.wsm-notification.info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

/* أيقونات الإشعارات */
.wsm-notification-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    margin-top: 2px;
}

.wsm-notification.success .wsm-notification-icon { background: #10b981; }
.wsm-notification.error .wsm-notification-icon { background: #ef4444; }
.wsm-notification.warning .wsm-notification-icon { background: #f59e0b; }
.wsm-notification.info .wsm-notification-icon { background: #3b82f6; }

.wsm-notification-content {
    flex: 1;
    min-width: 0;
}

.wsm-notification-title {
    font-weight: 700;
    font-size: 1em;
    margin-bottom: 4px;
    color: #1f2937;
    line-height: 1.3;
}

.wsm-notification-message {
    color: #6b7280;
    font-size: 0.9em;
    line-height: 1.4;
    word-wrap: break-word;
}

.wsm-notification-close {
    background: none;
    border: none;
    font-size: 16px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.wsm-notification-close:hover {
    color: #374151;
}

.wsm-notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.6;
    width: 100%;
    transform: scaleX(1);
    transform-origin: left;
    animation: progressBar 5s linear forwards;
}

@keyframes progressBar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* ===== نماذج الإدخال ===== */
.wsm-form-group {
    margin-bottom: 20px;
    position: relative;
}

.wsm-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 1em;
    line-height: 1.4;
}

.wsm-form-group label.required::after {
    content: '*';
    color: #ef4444;
    margin-left: 3px;
}

.wsm-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-height: 50px;
    box-sizing: border-box;
    line-height: 1.4;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.wsm-input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    transform: translateY(-1px);
}

.wsm-input.error {
    border-color: #dc2626;
    background: #fef2f2;
}

.wsm-input.input-focused {
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

.wsm-input.scan-detected {
    background-color: #f0f8ff !important;
    border-color: #007bff !important;
}

/* ===== القوائم المنسدلة المحسنة ===== */
.wsm-select {
    color: #374151 !important;
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23374151'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding: 14px 40px 14px 12px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    min-height: 50px;
    height: auto !important;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.4 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
}

.wsm-select:focus {
    color: #374151 !important;
    background-color: #ffffff !important;
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.wsm-select option {
    color: #374151 !important;
    background-color: #ffffff !important;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.4;
    height: auto;
    min-height: 40px;
    white-space: normal;
    word-wrap: break-word;
}

.wsm-select.error {
    color: #374151 !important;
    background-color: #fef2f2 !important;
    border-color: #dc2626;
}

.wsm-select.error option {
    color: #374151 !important;
    background-color: #fef2f2 !important;
}

/* ===== تأثيرات البالص المحسنة ===== */
.wsm-pulse-success { animation: pulseSuccess 2s ease-in-out; border-color: #28a745 !important; }
.wsm-pulse-error { animation: pulseError 2s ease-in-out; border-color: #dc3545 !important; }
.wsm-pulse-warning { animation: pulseWarning 2s ease-in-out; border-color: #ffc107 !important; }
.wsm-pulse-info { animation: pulseInfo 2s ease-in-out; border-color: #17a2b8 !important; }

@keyframes pulseSuccess {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

@keyframes pulseError {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

@keyframes pulseWarning {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

@keyframes pulseInfo {
    0% { box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(23, 162, 184, 0); }
    100% { box-shadow: 0 0 0 0 rgba(23, 162, 184, 0); }
}

/* ===== الأزرار المحسنة ===== */
.wsm-btn {
    padding: 14px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 50px;
    line-height: 1.4;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    -webkit-tap-highlight-color: transparent;
    gap: 8px;
}

.wsm-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.wsm-btn:hover::before {
    left: 100%;
}

.wsm-btn-primary {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.3);
}

.wsm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.4);
}

.wsm-btn:hover {
    transform: translateY(-1px);
}

.wsm-btn.hover-effect {
    transform: translateY(-1px);
}

.wsm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* تأثيرات التحميل للأزرار */
.wsm-loading-active {
    position: relative;
    overflow: hidden;
}

.wsm-loading-active:after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loadingShine 1.5s infinite;
}

@keyframes loadingShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===== نظام الخطوات ===== */
.wsm-step {
    display: none;
    animation: slideIn 0.4s ease;
}

.wsm-step.active {
    display: block;
}

.wsm-step.fade-out {
    opacity: 0;
    transform: translateX(-15px);
    transition: all 0.3s ease-in-out;
}

.wsm-step.fade-in {
    opacity: 0;
    transform: translateX(15px);
}

.wsm-step.fade-in.active {
    opacity: 1;
    transform: translateX(0);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* تأثيرات ظهور المحتوى */
.wsm-step-content {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== بطاقة المنتج ===== */
.wsm-product-card {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #bbf7d0;
    animation: bounceIn 0.5s ease;
    box-sizing: border-box;
}

.wsm-product-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    text-align: center;
}

.wsm-product-images {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.wsm-product-image img {
    max-width: 100px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s ease-in-out;
}

.wsm-product-image img.loaded {
    opacity: 1;
    transform: scale(1);
}

.wsm-brand-logo-container {
    text-align: center;
}

.wsm-brand-logo {
    margin-bottom: 6px;
}

.wsm-brand-logo img {
    max-width: 50px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s ease-in-out;
}

.wsm-brand-logo img.loaded {
    opacity: 1;
    transform: scale(1);
}

/* إخفاء اسم البراند من تحت اللوجو */
.wsm-brand-logo-container .wsm-brand-name {
    display: none !important;
}

.wsm-product-info {
    flex: 1;
    width: 100%;
}

.wsm-product-info h4 {
    color: #166534;
    font-size: 1.3em;
    margin-bottom: 8px;
    line-height: 1.3;
}

.wsm-product-info p {
    color: #374151;
    font-size: 0.95em;
    line-height: 1.4;
    margin-bottom: 10px;
}

.wsm-product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    justify-content: center;
}

.wsm-product-meta span {
    background: rgba(34, 197, 94, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    line-height: 1.3;
    text-align: center;
}

.fade-in-product {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== الشبكة والتخطيط ===== */
.wsm-form-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ===== نتائج الفحص ===== */
.wsm-result-card {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid #22c55e;
    border-radius: 10px;
    padding: 20px;
    margin-top: 25px;
    animation: slideInUp 0.4s ease;
    box-sizing: border-box;
}

.wsm-check-details {
    text-align: center;
}

.wsm-check-details.animated-check {
    animation: zoomIn 0.4s ease-out;
}

.wsm-check-details .wsm-product-images {
    justify-content: center;
    margin-bottom: 15px;
}

.wsm-status-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.wsm-status {
    padding: 5px 10px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.3s ease;
    display: inline-block;
}

.wsm-status-available { background: #f59e0b; color: white; }
.wsm-status-registered { background: #10b981; color: white; }
.wsm-status-expired { background: #ef4444; color: white; }
.wsm-status-pending { background: #8b5cf6; color: white; }

/* تأثيرات حالة السيريال المحسنة */
.status-highlighted {
    animation: statusHighlight 1.2s ease-in-out;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: bold;
    transform: scale(1);
}

.status-available {
    background-color: #d4edda;
    color: #155724;
    animation: pulse 1.5s infinite;
}

.status-registered {
    background-color: #fff3cd;
    color: #856404;
}

.status-expired {
    background-color: #f8d7da;
    color: #721c24;
}

@keyframes statusHighlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.wsm-status-active {
    background: #22c55e;
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== التغذية الراجعة ===== */
.wsm-feedback {
    margin-top: 6px;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 5px;
    animation: fadeIn 0.3s ease;
    line-height: 1.3;
}

.wsm-feedback.animated-feedback {
    animation: slideInDown 0.4s ease-out;
}

.wsm-feedback.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    animation: shake 0.4s ease-in-out;
}

.wsm-feedback.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.wsm-field-error {
    color: #dc2626;
    font-size: 0.8em;
    margin-top: 4px;
    display: none;
    line-height: 1.3;
}

/* تأثيرات الاهتزاز */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes slideInDown {
    from { transform: translateY(-15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== شريط التحميل ===== */
.wsm-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== رسائل الإدارة ===== */
.wsm-admin-message {
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 5px;
    font-weight: 500;
    font-size: 0.95em;
    line-height: 1.4;
}

.wsm-admin-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wsm-admin-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== نظام المسح الضوئي المحسن ===== */
.wsm-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.wsm-input-wrapper .wsm-input {
    padding-left: 50px !important; 
}

.wsm-scan-btn {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background-color: #f3f4f6;
    color: #374151;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
}

.wsm-scan-btn:hover {
    background-color: #e5e7eb;
    transform: translateY(-50%) scale(1.05);
}

.wsm-scan-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.wsm-scan-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wsm-scan-btn.scanning {
    background-color: #dc2626;
    color: white;
    animation: pulse 1.5s infinite;
}

/* حاوية الماسح الضوئي المحسنة */
.wsm-scanner-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    height: 400px;
    z-index: 10000;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
}

.wsm-scanner-reader {
    width: 100%;
    height: 100%;
    position: relative;
}

.wsm-scanner-reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.wsm-scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.wsm-scanner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 200px;
    border: 2px solid #00ff00;
    border-radius: 8px;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
}

.wsm-scanner-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: white;
    z-index: 10002;
}

.wsm-scanner-close-btn {
    padding: 10px 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 10003;
}

.wsm-scanner-close-btn:hover {
    background: #dc2626;
}

.wsm-scanner-message {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 14px;
}

/* طبقة الخلفية للماسح الضوئي */
.wsm-scanner-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
}

.wsm-scanner-backdrop.active {
    display: block;
}

/* ===== دعم RTL ===== */
[dir="rtl"] .wsm-select {
    background-position: left 12px center;
    padding: 14px 12px 14px 40px !important;
    text-align: right;
}

[dir="rtl"] .wsm-input-wrapper .wsm-input {
    padding-left: 16px !important;
    padding-right: 50px !important;
}

[dir="rtl"] .wsm-scan-btn {
    left: auto;
    right: 5px;
}

[dir="rtl"] .wsm-form-grid {
    direction: rtl;
}

[dir="rtl"] .wsm-input {
    text-align: right;
}

[dir="rtl"] .wsm-title::after {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

[dir="rtl"] .wsm-loading {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .wsm-product-header {
    text-align: right;
}

[dir="rtl"] .wsm-product-meta {
    justify-content: center;
}

[dir="rtl"] .wsm-step.fade-out {
    transform: translateX(15px);
}

[dir="rtl"] .wsm-step.fade-in {
    transform: translateX(-15px);
}

[dir="rtl"] .wsm-step.fade-in.active {
    transform: translateX(0);
}

[dir="rtl"] .wsm-notifications-container {
    right: 10px;
    left: 10px;
}

[dir="rtl"] .wsm-notification {
    border-left: none;
    border-right: 4px solid;
    transform: translateY(-20px);
}

[dir="rtl"] .wsm-notification.show {
    transform: translateY(0);
}

[dir="rtl"] .wsm-notification.hide {
    transform: translateY(-20px);
}

[dir="rtl"] .wsm-notification-progress {
    left: auto;
    right: 0;
    transform-origin: right;
}

/* ===== وسائط الاستعلام للاستجابة ===== */

/* للأجهزة اللوحية */
@media (min-width: 768px) and (max-width: 1024px) {
    .wsm-container {
        max-width: 90%;
        padding: 0 20px;
    }
    
    .wsm-card {
        padding: 30px 25px;
    }
    
    .wsm-form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .wsm-product-header {
        flex-direction: row;
        text-align: left;
    }
    
    .wsm-product-meta {
        justify-content: flex-start;
    }
    
    .wsm-btn {
        width: auto;
        min-width: 200px;
    }
}

/* للشاشات الكبيرة */
@media (min-width: 1025px) {
    .wsm-form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .wsm-product-header {
        flex-direction: row;
        text-align: left;
    }
    
    .wsm-product-meta {
        justify-content: flex-start;
    }
    
    .wsm-btn {
        width: auto;
        min-width: 200px;
    }
}

/* للهواتف الذكية */
@media (max-width: 767px) {
    .wsm-scanner-container {
        width: 95%;
        height: 300px;
    }
    
    .wsm-scanner-frame {
        width: 80%;
        height: 150px;
    }
    
    .wsm-scanner-controls {
        position: absolute;
        bottom: 20px;
        left: 0;
        width: 100%;
        text-align: center;
        z-index: 10001;
        padding: 0 20px;
    }
    
    .wsm-scanner-close-btn {
        padding: 15px 30px;
        border-radius: 25px;
        font-size: 16px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* للشاشات الصغيرة جداً */
@media (max-width: 480px) {
    .wsm-container {
        padding: 0 10px;
        margin: 15px auto;
    }
    
    .wsm-card {
        padding: 20px 15px;
        margin: 10px 0;
        border-radius: 10px;
    }
    
    .wsm-title {
        font-size: 1.6em;
        margin-bottom: 25px;
    }
    
    .wsm-btn {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
    }
    
    .wsm-product-images {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .wsm-product-image img {
        max-width: 90px;
    }
    
    .wsm-brand-logo img {
        max-width: 45px;
    }
    
    .wsm-status-info {
        padding: 12px;
    }
    
    .wsm-product-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .wsm-notifications-container {
        top: 5px;
        right: 5px;
        left: 5px;
    }
    
    .wsm-notification {
        padding: 12px;
        gap: 10px;
    }
    
    .wsm-form-group {
        margin-bottom: 18px;
    }
    
    .wsm-input, .wsm-select {
        padding: 12px 14px;
        min-height: 48px;
        font-size: 16px;
    }
    
    .wsm-scanner-container {
        height: 250px;
    }
    
    .wsm-scanner-frame {
        height: 120px;
    }
}

@media (max-width: 360px) {
    .wsm-container {
        padding: 0 8px;
    }
    
    .wsm-card {
        padding: 15px 12px;
    }
    
    .wsm-title {
        font-size: 1.4em;
    }
    
    .wsm-product-image img {
        max-width: 80px;
    }
    
    .wsm-brand-logo img {
        max-width: 40px;
    }
    
    .wsm-scan-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .wsm-scanner-frame {
        width: 85%;
        height: 100px;
    }
    
    .wsm-scanner-controls {
        bottom: 15px;
    }
    
    .wsm-scanner-close-btn {
        padding: 12px 25px;
        font-size: 14px;
    }
}

/* للوضع الأفقي على الموبايل */
@media (max-height: 500px) and (orientation: landscape) {
    .wsm-container {
        margin: 10px auto;
    }
    
    .wsm-card {
        padding: 15px;
    }
    
    .wsm-form-group {
        margin-bottom: 15px;
    }
    
    .wsm-input, .wsm-select {
        padding: 10px 12px;
        min-height: 44px;
    }
    
    .wsm-scanner-container {
        max-width: 100%;
        height: 250px;
    }
    
    .wsm-scanner-reader {
        height: 100%;
    }
    
    .wsm-scanner-frame {
        height: 60%;
        width: 50%;
    }
    
    .wsm-scanner-controls {
        bottom: 10px;
    }
}

/* ===== تحسينات خاصة للمتصفحات ===== */

/* تحسينات خاصة للـ iOS */
@supports (-webkit-touch-callout: none) {
    .wsm-input, .wsm-select, .wsm-btn {
        -webkit-appearance: none;
        border-radius: 8px;
    }
}

/* تحسينات خاصة للـ Android */
@supports not (-webkit-touch-callout: none) {
    .wsm-input:focus, .wsm-select:focus {
        border-color: #dc2626;
        outline: none;
    }
}

/* منع التكبير في حقول الإدخال على iOS */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="tel"],
    input[type="email"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ===== فئات مساعدة ===== */
.wsm-hidden {
    display: none;
}

.wsm-visible {
    display: block;
    animation: fadeIn 0.4s ease;
}

.wsm-select::-ms-expand {
    display: none;
}

.wsm-select option:hover {
    background-color: #f3f4f6 !important;
}

.wsm-select option:checked {
    background-color: #dc2626 !important;
    color: white !important;
}