/* استيراد خط Cairo العربي */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&display=swap');

/* إعادة تعيين افتراضية */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --info: #06b6d4;
    --secondary: #6b7280;
    --dark: #1f2937;
    --light: #f3f4f6;
    --white: #ffffff;
    --sidebar-width: 280px;
    --navbar-height: 70px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Cairo', sans-serif;
    background: #f9fafb;
    color: var(--dark);
    line-height: 1.6;
    font-size: 16px;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    transition: var(--transition);
}

.content {
    padding: 30px;
    min-height: calc(100vh - var(--navbar-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: var(--white);
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
}

.logo img {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
}

.logo i {
    font-size: 32px;
    color: var(--primary-light);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 15px 0;
}

.nav-list {
    list-style: none;
}

.nav-list > li {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: var(--transition);
    font-size: 15px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border-right: 4px solid var(--primary-light);
}

.nav-link i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-item-group {
    margin-bottom: 5px;
    position: relative;
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
    user-select: none;
}

.nav-group-title:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-group-title i:first-child {
    font-size: 18px;
    width: 20px;
}

.toggle-icon {
    margin-right: auto;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.nav-item-group.active .toggle-icon {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
}

.nav-item-group.active .nav-submenu {
    max-height: 1000px !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 5px 0 !important;
}

.nav-submenu .nav-link {
    padding: 12px 20px 12px 52px;
    font-size: 14px;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.drawer-info {
    text-align: center;
}

.drawer-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.drawer-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--success);
}

/* Navbar */
.navbar {
    height: var(--navbar-height);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 30px;
    gap: 20px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--dark);
    cursor: pointer;
}

.navbar-title h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-right: auto;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 600;
    color: var(--dark);
}

.user-role {
    font-size: 13px;
    color: var(--secondary);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-bottom: 25px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--light);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 0;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
}

.stat-card.danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
}

.stat-card.info {
    background: linear-gradient(135deg, var(--info) 0%, #0891b2 100%);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.stat-icon {
    font-size: 32px;
    opacity: 0.8;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: var(--warning-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 17px;
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control:disabled {
    background: var(--light);
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-help {
    font-size: 13px;
    color: var(--secondary);
    margin-top: 5px;
}

.form-error {
    font-size: 13px;
    color: var(--danger);
    margin-top: 5px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.table thead {
    background: var(--light);
}

.table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid #e5e7eb;
}

.table td {
    padding: 15px;
    border-bottom: 1px solid var(--light);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: #fafafa;
}

.table-striped tbody tr:nth-child(even) {
    background: #f9fafb;
}

.table-striped tbody tr:nth-child(even):hover {
    background: #f3f4f6;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-success {
    background: #d1fae5;
    color: var(--success-dark);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger-dark);
}

.badge-warning {
    background: #fef3c7;
    color: var(--warning-dark);
}

.badge-secondary {
    background: var(--light);
    color: var(--secondary);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 20px;
}

.alert-success {
    background: #d1fae5;
    color: var(--success-dark);
    border-right: 4px solid var(--success);
}

.alert-success::before {
    content: '\f058';
}

.alert-error {
    background: #fee2e2;
    color: var(--danger-dark);
    border-right: 4px solid var(--danger);
}

.alert-error::before {
    content: '\f06a';
}

.alert-warning {
    background: #fef3c7;
    color: var(--warning-dark);
    border-right: 4px solid var(--warning);
}

.alert-warning::before {
    content: '\f071';
}

.alert-info {
    background: #cffafe;
    color: #0e7490;
    border-right: 4px solid var(--info);
}

.alert-info::before {
    content: '\f05a';
}

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    padding-right: 45px;
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 25px;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--secondary);
    font-size: 15px;
}

/* Print Styles */
@media print {
    body {
        background: var(--white);
    }
    
    .sidebar,
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
    }
    
    .content {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .navbar-title h1 {
        font-size: 18px;
    }
    
    .user-info {
        display: none;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 10px;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-secondary { color: var(--secondary); }

.bg-primary { background: var(--primary); }
.bg-success { background: var(--success); }
.bg-danger { background: var(--danger); }
.bg-warning { background: var(--warning); }
.bg-light { background: var(--light); }
