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

:root {
    --primary-500: #2563eb;
    --primary-700: #1d4ed8;
    --primary-100: #dbeafe;
    --primary-rgb: 37, 99, 235;
    --bg: #f3f4f6;
    --surface: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
}

/* الخطوط والنصوص */
html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    /* إزالة صورة الخلفية واستبدالها بتدرج خفيف */
    background-image:
        radial-gradient(circle at 15% 10%, rgba(var(--primary-rgb), 0.10), transparent 55%),
        radial-gradient(circle at 85% 25%, rgba(var(--primary-rgb), 0.06), transparent 50%),
        linear-gradient(rgba(243, 244, 246, 0.96), rgba(243, 244, 246, 0.96));
    background-repeat: no-repeat;
    background-attachment: fixed;
    direction: rtl;
    text-align: right;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    /* تجنب كسر الكلمات حرف-بحرف (كان يسبب أزرار/نصوص عمودية في بعض الحالات) */
    overflow-wrap: break-word;
    word-break: normal;
}

input,
select,
textarea,
button {
    font: inherit;
}

/* منع التفاف النص داخل الأزرار حرف-بحرف عند ضيق العرض */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn,
a.btn {
    overflow-wrap: normal !important;
    word-break: keep-all !important;
    white-space: nowrap !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    text-wrap: nowrap;
}

@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }
}

/* تحسين القياسات على الهاتف */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .header {
        padding: 0.75rem 0;
        margin-bottom: 1rem;
    }

    .header h1 {
        font-size: 1.15rem;
    }

    .btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
        border-radius: 12px;
    }

    .floating-actions {
        bottom: 12px;
        right: 12px;
    }

    .floating-actions .fab {
        width: 56px;
        height: 56px;
        font-size: 1.45rem;
    }
}

img,
picture,
video,
canvas,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

svg {
    max-width: 100%;
    height: auto;
}

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

/* الهيدر */
.header {
    background: rgba(255, 255, 255, 0.86);
    color: var(--text);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* الأزرار */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 140ms cubic-bezier(.2,.8,.2,1),
                box-shadow 160ms cubic-bezier(.2,.8,.2,1),
                background-color 160ms ease,
                color 160ms ease,
                border-color 160ms ease,
                filter 160ms ease;
    white-space: nowrap;
}

/* الأيقونة داخل الزر تكون أوضح من النص */
.btn .btn-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1.45em;
    line-height: 1;
    transform-origin: center;
    transition: transform 140ms cubic-bezier(.2,.8,.2,1), filter 160ms ease;
}

.btn .btn-label {
    display: inline-block;
    font-size: 0.95em;
    line-height: 1.2;
}

/* Hover: تكبير خفيف للأيقونة + رفع بسيط للزر */
.btn:hover {
    transform: translateY(-1px);
}

.btn:hover .btn-ico {
    transform: translateY(-1px) scale(1.08);
    animation: btnIconPulse 900ms ease-in-out infinite;
}

/* Press: تأثير واضح وأنيق عند الضغط */
.btn:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

.btn:active .btn-ico {
    transform: translateY(0) scale(0.98);
    animation: none;
}

@keyframes btnIconPulse {
    0%, 100% { transform: translateY(-1px) scale(1.08); }
    50% { transform: translateY(-1px) scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .btn .btn-ico {
        transition-duration: 0.01ms !important;
        animation: none !important;
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.35);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-outline:hover {
    background: #111827;
    color: white;
    border-color: #111827;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: 2px solid #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* أزرار عائمة (مثل الدعم) */
.floating-actions {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

/* الواجهة الرئيسية: تكبير أزرار الدعم ووضعها يسار أسفل الشاشة */
body.home .floating-actions {
    left: 16px;
    right: auto;
    transform: none;
    flex-direction: row;
    gap: 16px;
}

body.home .floating-actions .fab {
    width: 84px;
    height: 84px;
    font-size: 2rem;
}

@media (max-width: 480px) {
    body.home .floating-actions {
        bottom: 12px;
    }

    body.home .floating-actions .fab {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }
}

.floating-actions .fab {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-actions .fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0,0,0,0.22);
}

.floating-actions .fab:focus-visible {
    outline: 3px solid rgba(var(--primary-rgb), 0.35);
    outline-offset: 3px;
}

.floating-actions .fab-support {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
    color: #fff;
}

.floating-actions .fab-support-admin {
    background: rgba(255,255,255,0.92);
    color: var(--primary-700);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

/* صفحة تسجيل الدخول */
.login-page {
    background: linear-gradient(135deg, var(--primary-500) 0%, #1e40af 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-logo-outside {
    text-align: center;
    margin-bottom: 1rem;
}

.login-logo-outside img {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,0.18));
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo .logo-img {
    display: block;
    width: 100%;
    max-width: 320px;
    height: auto;
    margin: 0 auto;
    animation: celine-logo-float 3.2s ease-in-out infinite;
    transform-origin: center;
}

.logo .logo-text {
    display: none;
    color: var(--primary-500);
    margin: 0;
    font-size: 1.5rem;
}

@keyframes celine-logo-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .logo .logo-img {
        animation: none;
    }
}

.credential-hint {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px dashed var(--primary-500);
    color: #444;
    text-align: center;
    font-size: 0.95rem;
}

.credential-hint p {
    margin-bottom: 0.35rem;
}

/* المجموعات والحقول */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* تسجيل دخول تلقائي */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* التنبيهات */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* بيانات تجريبية */
.demo-info {
    margin-top: 2rem;
    padding: 1rem;
    background: #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
}

.demo-info h3 {
    margin-bottom: 0.5rem;
    color: #495057;
}

/* شبكة المنتجات */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    min-width: 100%;
    min-height: 100%;
}

/* للصور الصغيرة - استخدم contain مع خلفية */
.product-image img.small-image {
    object-fit: contain;
    background-color: #fff;
}

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

.no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-weight: 500;
    border: 2px dashed #dee2e6;
}

.product-info {
    padding: 1.5rem;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.product-unit {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* أدوات التحكم في الكمية */
.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1.5rem 1.5rem;
}

.btn-quantity {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--primary-500);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-quantity:hover {
    background: var(--primary-700);
    transform: scale(1.1);
}

.quantity-input {
    width: 60px;
    text-align: center;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

/* الجداول القابلة للتمرير */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* أدوات التحكم في المنتجات الوزنية */
.weight-controls {
    padding: 0 1.5rem 1.5rem;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    font-weight: bold;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.weight-input {
    width: 100%;
    text-align: center;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    transition: border-color 0.3s ease;
}

.weight-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

/* ملخص السلة */
.cart-summary {
    position: sticky;
    top: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-500);
}

.cart-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* النوافذ المنبثقة */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ملخص الطلب */
.order-summary {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.order-summary h3 {
    margin-bottom: 1rem;
    color: #333;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.order-item:last-child {
    border-bottom: none;
}

.total-items {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--primary-500);
    text-align: center;
    font-size: 1.1rem;
}

/* الحالة الفارغة */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.empty-state p {
    font-size: 1.1rem;
}

/* تصميم متجاوب */

/* شاشات كبيرة جداً */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
        padding: 0 30px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 2rem;
    }
}

/* شاشات كبيرة */
@media (max-width: 1200px) {
    .container {
        padding: 0 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* شاشات متوسطة */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 0.8rem 0;
        margin-bottom: 1.5rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .header h1 {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }
    
    .user-info {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .header-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        min-width: auto;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
        padding: 1rem 0;
    }
    
    .cart-summary {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }
    
    .cart-info {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .modal {
        padding: 1rem;
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* تحسين الجداول للشاشات الصغيرة */
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        padding: 0.6rem 0;
        margin-bottom: 1rem;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .modal {
        align-items: flex-start;
        justify-content: center;
        padding: 0.5rem;
        overflow-y: auto;
    }

    .modal-content {
        width: min(95vw, 400px);
        max-width: 100%;
        border-radius: 16px;
        margin: 0.5rem auto;
        max-height: calc(100vh - 1rem);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-footer {
        align-items: stretch;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
        padding: 0.7rem;
    }

    .return-modal .return-items {
        max-height: 40vh;
    }

    .return-modal .modal-header h2 {
        font-size: 1.1rem;
    }
    
    /* تحسين النماذج للشاشات الصغيرة */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* منع التكبير التلقائي في iOS */
    }
    
    /* تحسين الجداول للشاشات الصغيرة جداً */
    table {
        font-size: 0.8rem;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 0.4rem;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 8px;
    }
    
    .header {
        padding: 0.5rem 0;
    }
    
    .header h1 {
        font-size: 1rem;
    }
    
    .login-form {
        padding: 1.2rem;
        margin: 0.5rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 0.8rem 0;
    }
    
    .product-card {
        margin: 0 auto;
        max-width: 100%;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .quantity-controls {
        padding: 0.8rem;
        gap: 0.6rem;
    }
    
    .btn-quantity {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .quantity-input {
        width: 50px;
        padding: 0.4rem;
        font-size: 0.9rem;
    }
    
    .weight-controls {
        padding: 0.8rem;
    }
    
    .weight-input {
        font-size: 1rem;
        padding: 0.6rem;
    }
    
    .cart-summary {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.75rem;
    }
    
    /* تحسين النماذج للشاشات الصغيرة جداً */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.6rem;
        font-size: 16px;
    }
    
    /* تحسين الجداول للشاشات الصغيرة جداً */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 100%;
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.3rem;
        white-space: nowrap;
    }
}

/* شاشات صغيرة جداً (أقل من 360px) */
@media (max-width: 360px) {
    .container {
        padding: 0 5px;
    }
    
    .header {
        padding: 0.4rem 0;
    }
    
    .header h1 {
        font-size: 0.9rem;
    }
    
    .login-form {
        padding: 1rem;
        margin: 0.3rem;
    }
    
    .products-grid {
        gap: 0.6rem;
        padding: 0.6rem 0;
    }
    
    .product-image {
        height: 160px;
    }
    
    .product-info {
        padding: 0.8rem;
    }
    
    .product-name {
        font-size: 1rem;
    }
    
    .product-description {
        font-size: 0.8rem;
    }
    
    .quantity-controls {
        padding: 0.6rem;
        gap: 0.4rem;
    }
    
    .btn-quantity {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    .quantity-input {
        width: 45px;
        padding: 0.3rem;
        font-size: 0.8rem;
    }
    
    .weight-controls {
        padding: 0.6rem;
    }
    
    .weight-input {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .modal-content {
        width: min(98vw, 350px);
        margin: 0.3rem auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.8rem;
    }
    
    table {
        font-size: 0.7rem;
    }
    
    th, td {
        padding: 0.2rem;
    }
}

/* تحسينات إضافية للتصميم المتجاوب */

/* تحسين الصور للشاشات المختلفة */
img {
    max-width: 100%;
    height: auto;
}

/* تحسين النماذج للشاشات الصغيرة */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* تحسين الجداول للشاشات الصغيرة */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* نقطة توقف أساسية للشاشات الصغيرة */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        margin: 0;
        padding: 0;
    }

    .container,
    .header,
    .main-content,
    .admin-container,
    .inventory-container {
        width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .header-actions .btn {
        flex: 1 1 auto;
        min-width: 140px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .product-card {
        max-width: 100%;
    }

    .movements-table,
    .orders-table,
    .returns-table {
        overflow-x: auto;
    }

    table {
        font-size: 0.9rem;
    }

    .form-section,
    .filters-section,
    .inventory-header,
    .products-section {
        padding: 15px;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 100%;
        margin: 0;
    }

    .btn {
        min-height: 44px; /* الحد الأدنى للمساحة القابلة للنقر في iOS */
        touch-action: manipulation;
    }
}

/* تحسين النوافذ المنبثقة للشاشات الصغيرة */
@media (max-width: 768px) {
    .modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
}

/* تحسين القوائم للشاشات الصغيرة */
@media (max-width: 768px) {
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .header-actions .btn {
        margin: 0.2rem;
        flex: 1;
        min-width: 120px;
    }
}

/* تحسين النصوص للشاشات الصغيرة */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    h1, h2, h3 {
        line-height: 1.3;
    }
}

/* تحسين المساحات للشاشات الصغيرة */
@media (max-width: 480px) {
    .container {
        margin: 0;
    }
    
    .main-content {
        padding: 0.5rem;
    }
}

/* تحسين خاص للشاشات العمودية */
@media (orientation: portrait) and (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* تحسين خاص للشاشات الأفقية */
@media (orientation: landscape) and (max-width: 768px) {
    .header {
        padding: 0.4rem 0;
    }
    
    .header h1 {
        font-size: 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 0.8rem;
    }
}

/* طباعة */
@media print {
    .header,
    .cart-summary,
    .modal,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}