/* أساسيات التنسيق - معدل */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c5530;
    --secondary: #4a7c59;
    --success: #38b000;
    --warning: #ff9e00;
    --danger: #d00000;
    --light: #f8f9fa;
    --dark: #2b2d42;
    --gray: #6c757d;
    --sidebar: #2c5530;
    --sidebar-hover: #3a6b3f;
}

body {
    font-family: 'Segoe UI', 'Tahoma', 'Geneva', 'Verdana', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* صفحة تسجيل الدخول - معدل */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-section {
    margin-bottom: 30px;
}

.logo-section h1 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 700;
}

.logo-section p {
    color: var(--gray);
    font-size: 16px;
}

.login-form .form-group {
    margin-bottom: 25px;
    text-align: right;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.login-form input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
    transform: translateY(-2px);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(44, 85, 48, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(44, 85, 48, 0.4);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.login-info {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    border-radius: 12px;
    border: 1px solid #c3e6cb;
}

.credentials {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    border: 1px solid #b8daff;
}

/* لوحة التحكم - معدل */
.dashboard {
    display: flex;
    min-height: 100vh;
    background: #f8f9fa;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--sidebar), #1e3a28);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 30px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
    font-weight: 700;
}

.sidebar-header p {
    color: #bdc3c7;
    font-size: 13px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 18px 25px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 4px solid transparent;
    margin: 5px 0;
    font-size: 15px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
    border-right-color: var(--secondary);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-right-color: var(--secondary);
}

.nav-item.logout {
    color: #ff6b6b;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 25px;
}

.nav-item.logout:hover {
    background: rgba(255, 107, 107, 0.1);
    border-right-color: #ff6b6b;
}

.main-content {
    flex: 1;
    margin-right: 280px;
    background: #f8f9fa;
}

.content-header {
    background: white;
    padding: 25px 35px;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.content-header h1 {
    color: var(--primary);
    font-size: 28px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.datetime {
    background: var(--light);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--gray);
}

.content {
    padding: 35px;
}

/* بطاقات الإحصائيات - معدل */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid #f1f3f4;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 48px;
    margin-left: 20px;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(44, 85, 48, 0.1);
}

.stat-icon.incoming { color: var(--success); background: rgba(56, 176, 0, 0.1); }
.stat-icon.outgoing { color: var(--warning); background: rgba(255, 158, 0, 0.1); }
.stat-icon.recipes { color: var(--secondary); background: rgba(74, 124, 89, 0.1); }
.stat-icon.balance { color: var(--primary); background: rgba(44, 85, 48, 0.1); }

.stat-info h3 {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    color: var(--dark);
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

/* الإجراءات السريعة - معدل */
.quick-actions {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    border: 1px solid #f1f3f4;
}

.quick-actions h2 {
    margin-bottom: 25px;
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.action-btn {
    background: var(--light);
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.action-btn:hover {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(74, 124, 89, 0.3);
}

/* البطاقات - معدل */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    border: 1px solid #f1f3f4;
    overflow: hidden;
}

.card-header {
    padding: 25px 30px;
    border-bottom: 1px solid #e1e8ed;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.card-header h3 {
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.card-body {
    padding: 30px;
}

/* الجداول - معدل */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.data-table th,
.data-table td {
    padding: 16px 20px;
    text-align: right;
    border-bottom: 1px solid #e1e8ed;
}

.data-table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 700;
    color: var(--dark);
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* النماذج - معدل */
.form-group {
    margin-bottom: 25px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #e1e8ed;
}

/* التنبيهات - معدل */
.alert {
    padding: 18px 22px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-weight: 500;
    border: 1px solid transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-color: #b8daff;
}

.alert-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-color: #f5c6cb;
}

/* المودال - معدل */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease-out;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-60px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.modal-header h2 {
    color: var(--primary);
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.close {
    color: var(--gray);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: var(--dark);
    background: #f8f9fa;
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

/* شارات الحالة - معدل */
.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    text-align: center;
    min-width: 70px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #b8daff;
}

.status-badge.expired {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* تحسينات التجاوب */
@media (max-width: 1200px) {
    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .content {
        padding: 20px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .content-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        padding: 20px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .content {
        padding: 15px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* تأثيرات إضافية */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* تحسينات الشريط الجانبي */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* تأثيرات التحميل */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* تنسيقات خاصة للنظام الزراعي */
.agricultural-theme {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.grain-icon {
    background: linear-gradient(135deg, #ff9a00, #ff6a00);
}

.animal-feed-icon {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}