/* مصنع الجرحى - تصميم بسيط ومتجاوب */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

/* السيد بار */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: #2c3e50;
    color: white;
    padding: 20px 0;
    z-index: 1000;
    overflow-y: auto;
    border-left: 1px solid #34495e;
}

.sidebar-header {
    text-align: center;
    padding: 0 20px 30px;
    border-bottom: 1px solid #34495e;
    margin-bottom: 30px;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: white;
    font-weight: 600;
}

.sidebar-header p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.sidebar-menu {
    list-style: none;
    padding: 0 20px;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 400;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #34495e;
}

.sidebar-menu a i {
    margin-left: 15px;
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

/* زر إغلاق السيد بار (الهاتف فقط) */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2c3e50;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    z-index: 1001;
    display: none;
}

.sidebar-toggle i {
    font-size: 1.2rem;
}

/* المحتوى الرئيسي */
.main-content {
    margin-right: 280px;
    padding: 20px;
    min-height: 100vh;
}

/* الهيدر */
.header {
    background: white;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header h1 {
    color: #333;
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-info span {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 400;
}

/* الكروت */
.card {
    background: white;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    background: #34495e;
    color: white;
    padding: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

/* الجداول */
.table-container {
    overflow-x: auto;
    border-radius: 5px;
    border: 1px solid #ddd;
}

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

th, td {
    padding: 15px 12px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

tr:hover {
    background: #f8f9fa;
}

/* الأزرار */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    text-align: center;
    min-width: 100px;
    font-family: 'Cairo', Arial, sans-serif;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-width: 80px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 5px 13px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9rem;
    background: white;
    font-family: 'Cairo', Arial, sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

.form-control:invalid {
    border-color: #e74c3c;
}

/* التنبيهات */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.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;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* الإحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 5px;
    border: 1px solid #ddd;
    text-align: center;
}

.stat-card h3 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-card p {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
    font-weight: 400;
}

/* البحث والفلترة */
.search-filter {
    background: white;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.search-filter input,
.search-filter select {
    flex: 1;
    min-width: 200px;
}

/* الصور */
.product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* الشارات */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 3px;
    text-align: center;
    min-width: 30px;
}

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

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

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* مجموعات الأزرار */
.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* التنسيق المتجاوب */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-right: 0;
        padding: 15px;
    }
    
    .header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header-info {
        justify-content: center;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .search-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-filter input,
    .search-filter select {
        min-width: auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-sm {
        width: auto;
        margin: 2px;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 10px;
    }
    
    .header {
        padding: 10px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .product-image {
        width: 40px;
        height: 40px;
    }
    
    .stat-card h3 {
        font-size: 2rem;
    }
    
    .stat-card p {
        font-size: 1rem;
    }
}

/* تحسينات للهاتف المحمول */
@media (max-width: 768px) {
    /* تحسين التمرير */
    body {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* تحسين الأزرار لللمس */
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* تحسين النماذج */
    .form-control {
        min-height: 44px;
        font-size: 16px; /* منع التكبير التلقائي على iOS */
    }
    
    /* تحسين الجداول */
    .table-container {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* تحسين السيد بار */
    .sidebar {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
}

/* تحسينات للطباعة */
@media print {
    .sidebar,
    .sidebar-toggle,
    .btn,
    .search-filter {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    .table-container {
        overflow: visible !important;
    }
    
    table {
        font-size: 12px !important;
    }
    
    th, td {
        padding: 8px 4px !important;
    }
    
    /* إخفاء أعمدة الأرباح في الجدول عند الطباعة فقط */
    .profit-column,
    .profit-margin-column {
        display: none !important;
    }
    
    /* إخفاء ملخص الأرباح بالكامل عند الطباعة */
    .profit-summary-section {
        display: none !important;
    }
}

/* زر تسجيل الخروج في السيد بار */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    border-top: 1px solid #34495e;
    background: #2c3e50;
}

.logout-btn {
    display: block;
    width: 100%;
    padding: 12px 15px;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background: #c0392b;
    color: white;
    text-decoration: none;
}

.logout-btn i {
    margin-left: 8px;
}

/* تحسين زر تسجيل الخروج للهاتف */
@media (max-width: 768px) {
    .sidebar-footer {
        padding: 15px;
    }
    
    .logout-btn {
        padding: 15px;
        font-size: 1rem;
    }
}