/* متغيرات الألوان */
:root {
    --primary-color: #8B4513; /* بني خشبي */
    --secondary-color: #D2691E; /* برتقالي أرضي */
    --accent-color: #228B22; /* أخضر طبيعي */
    --light-brown: #DEB887; /* بني فاتح */
    --cream: #F5F5DC; /* كريمي */
    --dark-green: #006400; /* أخضر داكن */
    --text-dark: #2F4F4F; /* رمادي داكن للنصوص */
    --border-color: #D2B48C; /* بني فاتح للحدود */
    --success-color: #4CAF50; /* أخضر للنجاح */
    --warning-color: #FF9800; /* برتقالي للتحذير */
    --danger-color: #F44336; /* أحمر للخطر */
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    background: linear-gradient(135deg, var(--cream) 0%, #FAF0E6 100%);
    color: var(--text-dark);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* شريط التنقل */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
    border-bottom: 3px solid var(--accent-color);
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--cream) !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-nav .nav-link {
    color: var(--cream) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 5px;
    margin: 0 2px;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
    transform: translateY(-2px);
}

/* العناوين */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

h1 {
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 0.5rem;
    position: relative;
}

/* الأزرار */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--accent-color) 100%);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #FF8C00 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #DC143C 100%);
    border: none;
}

/* الجداول */
.table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
    width: 100%;
    table-layout: auto;
}

/* تحسين الجداول للعرض المتجاوب */
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(210, 180, 140, 0.1);
    transform: scale(1.01);
}

.table tbody td {
    border-color: var(--border-color);
    padding: 0.75rem;
    vertical-align: middle;
}

/* النماذج */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(34, 139, 34, 0.25);
    background-color: white;
}

.form-group {
    margin-bottom: 1.5rem;
}

.control-label {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* البطاقات */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    font-weight: 600;
}

/* التنقل بين الصفحات */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.page-link {
    color: var(--primary-color);
    border-color: var(--border-color);
    margin: 0 2px;
    border-radius: 6px;
}

.page-link:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-color: var(--primary-color);
}

/* التنبيهات */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(34, 139, 34, 0.1) 100%);
    border: 2px solid var(--accent-color);
    color: var(--dark-green);
    border-radius: 12px;
}

.alert-success h6 {
    color: var(--accent-color);
    font-weight: 600;
}

.alert-success .fas {
    color: var(--accent-color);
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #FF8C00 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, rgba(220, 20, 60, 0.1) 100%);
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 12px;
}

.alert-danger h6 {
    color: var(--danger-color);
    font-weight: 600;
}

.alert-danger .fas {
    color: var(--danger-color);
}

/* التذييل */
.footer {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--cream);
    text-align: center;
    padding: 1rem 0;
    margin-top: 3rem;
    box-shadow: 0 -4px 12px rgba(139, 69, 19, 0.3);
}

/* الروابط */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--dark-green);
    text-decoration: none;
}

/* تحسينات إضافية */
.container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* رسائل التحقق */
.text-danger {
    color: var(--danger-color) !important;
    font-weight: 500;
}

.text-success {
    color: var(--success-color) !important;
}

/* تحسين العرض على الأجهزة المحمولة */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin-top: 0.5rem;
    }
    
    .table-responsive {
        border-radius: 8px;
        overflow: hidden;
        border: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px; /* عرض أدنى للجدول */
    }
    
    .table thead th {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .table tbody td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    /* تحسين أزرار الإجراءات */
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .btn-group .btn i {
        font-size: 0.8rem;
    }
}

/* تحسين إضافي للشاشات الصغيرة جداً */
@media (max-width: 576px) {
    .table-responsive {
        font-size: 0.75rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.25rem 0.1rem;
        font-size: 0.7rem;
    }
    
    /* إخفاء عمود الملاحظات في جداول معينة */
    .table th:nth-child(5),
    .table td:nth-child(5) {
        display: none; /* إخفاء عمود الملاحظات في بعض الجداول */
    }
}

/* تأثيرات بصرية إضافية */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(245, 245, 220, 0.3);
}

/* تحسين أزرار الإجراءات في الجداول */
.table td a {
    margin: 0 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.table td a:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

/* تنبيه التطعيم المتأخر */
.vaccination-warning {
    color: #b80000;
    background: #ffe0e0;
    padding: 0.2em 0.6em;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1em;
}

.feeding-warning {
    color: #b80000;
    background: #ffe0e0;
    padding: 0.2em 0.6em;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1em;
}

/* تلوين صفوف السجلات المالية */
.table-success {
    background-color: rgba(76, 175, 80, 0.15) !important;
    border-left: 4px solid var(--success-color);
}

.table-success:hover {
    background-color: rgba(76, 175, 80, 0.25) !important;
}

.table-danger {
    background-color: rgba(244, 67, 54, 0.15) !important;
    border-left: 4px solid var(--danger-color);
}

.table-danger:hover {
    background-color: rgba(244, 67, 54, 0.25) !important;
}

/* تحسين مظهر القوائم المنسدلة */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

select.form-control:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23228B22' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
}

/* تحسين مظهر الـ badges */
.badge {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--accent-color) 100%) !important;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.bg-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #DC143C 100%) !important;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
}