/* ============================================
   ملف التنسيقات المتجاوب للجوال والكمبيوتر
   ============================================ */

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

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 10px;
    --box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    direction: rtl;
    color: #333;
    line-height: 1.6;
    padding: 0;
    margin: 0;
}

/* التمرير الناعم */
html {
    scroll-behavior: smooth;
}

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

/* الترويسة */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    text-align: center;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1%, transparent 1%);
    background-size: 20px 20px;
    opacity: 0.3;
}

.header h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.header p {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* نظام الشبكة المتجاوب */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-1 { width: 8.33%; }
.col-2 { width: 16.66%; }
.col-3 { width: 25%; }
.col-4 { width: 33.33%; }
.col-5 { width: 41.66%; }
.col-6 { width: 50%; }
.col-7 { width: 58.33%; }
.col-8 { width: 66.66%; }
.col-9 { width: 75%; }
.col-10 { width: 83.33%; }
.col-11 { width: 91.66%; }
.col-12 { width: 100%; }

[class*="col-"] {
    padding: 0 10px;
    margin-bottom: 20px;
}

/* الكروت */
.card {
    background: white;
    border-radius: var(--border-radius);
    padding: clamp(15px, 3vw, 25px);
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
    height: 100%;
}

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

.card h3 {
    color: var(--dark-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h3 i {
    color: var(--primary-color);
}

/* النماذج */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: var(--transition);
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

/* الأزرار */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    min-height: 44px; /* للجوال */
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e4606d 100%);
    color: white;
}

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

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-block {
    width: 100%;
    display: block;
}

/* الجداول */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 15px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

.table tr:hover {
    background: var(--light-color);
}

/* boxes الملخص */
.summary-box {
    background: linear-gradient(135deg, var(--light-color) 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 20px;
    margin: 10px 0;
    border-right: 5px solid var(--primary-color);
    transition: var(--transition);
}

.summary-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.summary-box h3 {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: #666;
    margin-bottom: 10px;
}

.summary-box p {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: bold;
    color: var(--dark-color);
    margin: 0;
}

/* التنبيهات */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    border-right: 5px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

/* شريط التنقل للجوال */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 10px;
}

/* فلاتر التقارير */
.report-filter {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
}

/* الطباعة */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12px;
        background: white;
        padding: 0;
    }
    
    .receipt {
        width: 80mm !important;
        margin: 0 !important;
        padding: 5mm !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .btn, .alert, .header {
        display: none !important;
    }
}

/* ============================================
   التجاوب مع الشاشات المختلفة
   ============================================ */

/* للشاشات الكبيرة (أكثر من 1200px) */
@media (min-width: 1200px) {
    .container {
        padding: 20px 40px;
    }
}

/* للأجهزة اللوحية (768px إلى 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
    .col-md-6 {
        width: 50%;
    }
    
    .col-md-12 {
        width: 100%;
    }
    
    .card {
        padding: 20px;
    }
}

/* للجوال (أقل من 768px) */
@media (max-width: 767px) {
    /* نظام شبكة الجوال */
    [class*="col-"] {
        width: 100%;
        padding: 0 5px;
    }
    
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 15px 10px;
        margin-bottom: 15px;
    }
    
    .card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card h3 {
        font-size: 1.2rem;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    /* تحسين النماذج للجوال */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* لمنع تكبير الآيفون */
    }
    
    /* الأزرار على الجوال */
    .btn {
        width: 100%;
        margin-bottom: 10px;
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    /* الجداول على الجوال */
    .table-responsive {
        border: none;
        margin: 10px -10px;
    }
    
    .table {
        min-width: 100%;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
    
    /* إخفاء بعض الأعمدة على الجوال */
    .table .mobile-hide {
        display: none;
    }
    
    /* تحسين شريط التنقل */
    .nav-menu {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 80%;
        height: 100vh;
        background: white;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        z-index: 1000;
        padding: 20px;
        flex-direction: column;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-toggle {
        display: block;
    }
    
    /* تحسين الملخص */
    .summary-box {
        padding: 15px;
        margin: 8px 0;
    }
    
    .summary-box h3 {
        font-size: 0.9rem;
    }
    
    .summary-box p {
        font-size: 1.3rem;
    }
    
    /* تحسين الفلاتر */
    .report-filter .row {
        flex-direction: column;
    }
    
    .report-filter .col-6 {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* للشاشات الصغيرة جداً (أقل من 480px) */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.3rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .card {
        padding: 12px;
        border-radius: 6px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    /* تقليل حجم الخطوط */
    body {
        font-size: 14px;
    }
}

/* تحسينات للشاشات الطويلة */
@media (min-height: 800px) {
    .container {
        padding-top: 30px;
        padding-bottom: 30px;
    }
}

/* دعم التوجيه الأفقي على الجوال */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .card {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
}

/* تحسين الرموز على الجوال */
.fas, .fab, .far {
    font-size: clamp(1rem, 3vw, 1.2rem);
}

/* تحسين المسافات على الجوال */
.mobile-mb-1 { margin-bottom: 0.5rem; }
.mobile-mb-2 { margin-bottom: 1rem; }
.mobile-mb-3 { margin-bottom: 1.5rem; }

.mobile-p-1 { padding: 0.5rem; }
.mobile-p-2 { padding: 1rem; }
.mobile-p-3 { padding: 1.5rem; }

/* تحسين العرض على جميع الأجهزة */
img, svg, video {
    max-width: 100%;
    height: auto;
}

/* تحسين قابلية النقر على الجوال */
button, a, input[type="submit"], input[type="button"] {
    -webkit-tap-highlight-color: transparent;
}

/* تحسين تجربة اللمس */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        box-shadow: 0 0 0 2px var(--primary-color);
    }
}

/* عرض رسالة للشاشات الصغيرة جداً */
.mobile-only {
    display: none;
}

@media (max-width: 320px) {
    .mobile-only {
        display: block;
        text-align: center;
        padding: 10px;
        background: var(--warning-color);
        color: #856404;
        margin-bottom: 10px;
        border-radius: 5px;
    }
}
/* ============================================
   أنماط إضافية للصفحة الرئيسية
   ============================================ */

/* تذييل الصفحة */
.footer {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow);
}

.footer-content {
    color: #666;
}

.footer-links {
    margin-top: 10px;
}

.footer-link {
    color: #667eea;
    text-decoration: none;
    margin: 0 5px;
}

.footer-separator {
    color: #ddd;
    margin: 0 10px;
}

/* إحصائيات اليوم */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    border: 2px solid;
    transition: transform 0.3s;
}

.stat-box:hover {
    transform: translateY(-5px);
}

.stat-box.primary {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), transparent);
}

.stat-box.success {
    border-color: #28a745;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), transparent);
}

.stat-box.info {
    border-color: #17a2b8;
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.1), transparent);
}

.stat-box.warning {
    border-color: #ffc107;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), transparent);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.stat-box.primary .stat-icon { color: #667eea; }
.stat-box.success .stat-icon { color: #28a745; }
.stat-box.info .stat-icon { color: #17a2b8; }
.stat-box.warning .stat-icon { color: #ffc107; }

.stat-content h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-content h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

/* آخر الفواتير */
.recent-invoices {
    max-height: 300px;
    overflow-y: auto;
}

.invoice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
}

.invoice-item:hover {
    background: #f8f9fa;
}

.invoice-info {
    flex: 1;
}

.invoice-number {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.invoice-number i {
    color: #667eea;
    margin-left: 5px;
}

.invoice-customer {
    font-size: 0.9rem;
    color: #666;
}

.invoice-amount {
    font-weight: bold;
    color: #28a745;
    margin-left: 10px;
}

/* الروابط السريعة */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-link {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.quick-link:hover {
    background: white;
    border-color: #667eea;
    transform: translateX(-5px);
}

.quick-link-icon {
    width: 40px;
    height: 40px;
    background: linear
    /* QR Code Styles */
.qr-code {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px dashed #ddd;
}

.qr-code img {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    display: block;
    border: 1px solid #ddd;
    padding: 5px;
    background: white;
}

.qr-placeholder {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    background: white;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    text-align: center;
}

/* تحسينات للطباعة */
@media print {
    .qr-code {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .qr-code img {
        width: 100px !important;
        height: 100px !important;
    }
}

/* للجوال */
@media (max-width: 767px) {
    .qr-code img {
        width: 150px;
        height: 150px;
    }
    
    .qr-placeholder {
        width: 150px;
        height: 150px;
    }
}