/* assets/css/style.css */
:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --dark-color: #5a5c69;
    --light-color: #f8f9fc;
    
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --border-radius: 10px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background-color: #f5f6fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
}

/* القائمة الجانبية */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, #224abe 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* افتراضيًا نجهز موقع الشريط بالنسبة لاتجاه الصفحة */
[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

[dir="ltr"] .sidebar {
    left: 0;
    right: auto;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-user {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.2);
    margin-bottom: 10px;
}

.sidebar-user .user-info strong {
    display: block;
    font-size: 1rem;
}

.sidebar-user .user-info small {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* قائمة التنقل */
.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    margin: 5px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover,
.nav-item.active > .nav-link {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link i:first-child {
    width: 20px;
    margin-left: 10px;
    font-size: 1.1rem;
}

.nav-link span {
    flex: 1;
}

.nav-link .submenu-toggle {
    transition: var(--transition);
}

.nav-item.active .submenu-toggle {
    transform: rotate(-90deg);
}

/* القوائم الفرعية */
.submenu {
    display: none;
    background: rgba(0,0,0,0.2);
    padding: 5px 0;
}

.nav-item.active .submenu {
    display: block;
}

.submenu-link {
    display: block;
    padding: 8px 30px 8px 50px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.submenu-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* تذييل القائمة الجانبية */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-btn {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 10px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--danger-color);
    color: white;
}

.logout-btn i {
    margin-left: 10px;
}

/* المحتوى الرئيسي */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed + .main-content {
    margin-right: var(--sidebar-collapsed-width);
}

/* الشريط العلوي */
.top-bar {
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.menu-toggle {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--dark-color);
    cursor: pointer;
    display: none;
}

.page-title h1 {
    font-size: 1.3rem;
    margin: 0;
    color: var(--dark-color);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-top: 5px;
}

.breadcrumbs a {
    color: var(--secondary-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
}

.breadcrumbs i {
    font-size: 0.8rem;
    margin: 0 5px;
}

/* قائمة المستخدم */
.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.user-menu-button:hover {
    background: var(--light-color);
}

.user-menu-button img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-left: 10px;
}

.user-menu-button span {
    margin-left: 5px;
    color: var(--dark-color);
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
}

.user-menu-dropdown a:hover {
    background: var(--light-color);
}

.user-menu-dropdown a i {
    width: 20px;
    margin-left: 10px;
}

.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 5px 0;
}

/* المحتوى */
.content {
    padding: 20px;
    flex: 1;
}

/* Overlay للشاشة الصغيرة */
.sidebar-overlay {
    display: none;
}

.sidebar-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 995;
}

/* تصرفات الشريط الجانبي على الشاشات الصغيرة */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 50vw;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar {
        width: var(--sidebar-width);
        height: 100vh;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 1000;
        box-shadow: -4px 0 12px rgba(0,0,0,0.2);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    /* لا نجعل المحتوى يتأثر بمساحة الشريط الجانبي عند إغلاقه */
    .main-content {
        margin-right: 0;
    }

    /* عند فتح الشريط، ضع طبقة تغطي المحتوى */
    .sidebar.show ~ .sidebar-overlay,
    .sidebar-overlay.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 995;
    }

    /* اجعل القوائم الفرعية تتصرف بشكل مناسب داخل الشاشة الصغيرة */
    .submenu-link {
        padding-left: 30px;
    }
}

/* البطاقات الإحصائية */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
}

.stat-icon i {
    font-size: 1.8rem;
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* البطاقات */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--dark-color);
}

.card-header h3 i {
    margin-left: 8px;
    color: var(--primary-color);
}

.card-body {
    padding: 20px;
}

/* الجداول */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--light-color);
    padding: 12px;
    text-align: right;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid #eee;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: #fafafa;
}

/* معلومات المستخدم */
.user-info {
    display: flex;
    align-items: center;
}

.user-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
}

.user-info div {
    display: flex;
    flex-direction: column;
}

.user-info small {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* الشارات */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* قائمة النشاطات */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    background: var(--light-color);
    border-radius: var(--border-radius);
}

.activity-icon {
    margin-left: 15px;
}

.activity-icon i {
    color: var(--primary-color);
    font-size: 0.8rem;
}

.activity-content {
    flex: 1;
}

.activity-title {
    margin-bottom: 5px;
}

.activity-title strong {
    color: var(--dark-color);
}

.activity-title span {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-right: 8px;
}

.activity-description {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.activity-time {
    font-size: 0.8rem;
    color: #999;
}

/* النماذج */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--dark-color);
    font-weight: 500;
}

.form-group label i {
    margin-left: 5px;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 10px center;
    padding-left: 30px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* مربعات الاختيار */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding-right: 25px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: #eee;
    border-radius: 3px;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #ccc;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    right: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* الأزرار */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm {
    padding: 5px 15px;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2e59d9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 115, 223, 0.3);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

/* صفحة تسجيل الدخول */
.auth-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.auth-header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.auth-header p {
    opacity: 0.9;
}

.auth-form {
    padding: 30px;
}

.auth-footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid #eee;
}

/* حقل كلمة المرور */
.password-input {
    position: relative;
}

.password-input input {
    padding-left: 40px;
}

.toggle-password {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
}

/* الإشعارات */
.notification {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-success {
    background: #d4edda;
    border-right: 4px solid var(--success-color);
    color: #155724;
}

.notification-error {
    background: #f8d7da;
    border-right: 4px solid var(--danger-color);
    color: #721c24;
}

.notification-warning {
    background: #fff3cd;
    border-right: 4px solid var(--warning-color);
    color: #856404;
}

.notification-info {
    background: #d1ecf1;
    border-right: 4px solid var(--info-color);
    color: #0c5460;
}

.notification i {
    font-size: 1.2rem;
    margin-left: 10px;
}

.notification-close {
    margin-right: auto;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
}

.notification-close:hover {
    opacity: 1;
}

/* التجاوب مع الشاشات */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 50vw;
    }

    /* غطاء للخلفية عند فتح الشريط الجانبي */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        display: none;
        z-index: 900;
        transition: opacity 0.2s ease;
        opacity: 0;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

    .sidebar {
        right: calc(-1 * var(--sidebar-width));
        width: var(--sidebar-width);
        transition: right 0.25s ease;
        z-index: 1000;
    }

    .sidebar.show {
        right: 0;
    }
    
    .sidebar-close {
        display: block;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .user-menu-button span {
        display: none;
    }
    
    .auth-container {
        margin: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-right: 200px;
    }
}