 :root {
    --primary-color: #d55053;
    --primary-dark: #b03c3f;
    --primary-light: #e57376;
    --secondary-color: #30232d;
    --secondary-light: #4a3a4d;
    --accent-color: #f1c095;
    --light-color: #fae9d7;
    --text-dark: #2c2c2c;
    --text-light: #777;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: var(--text-dark);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== تنسيقات التسجيل والدخول ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border: 1px solid var(--border-color);
    transform: translateY(0);
    transition: var(--transition);
}

.login-box:hover {
    transform: translateY(-5px);
}

.login-logo {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo h1 {
    color: var(--primary-color);
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.login-logo span {
    color: var(--secondary-color);
    font-size: 16px;
    font-weight: 500;
    opacity: 0.9;
}

/* ===== تنسيقات القائمة الجانبية ===== */
.sidebar {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    width: 280px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    padding-top: 25px;
    box-shadow: var(--shadow);
    z-index: 1000;
    border-left: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    padding: 25px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 25px;
}

.sidebar-brand h2 {
    color: white;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.sidebar-brand span {
    color: var(--light-color);
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
    padding: 0 15px;
}

.sidebar-menu a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 600;
    font-size: 15px;
}

.sidebar-menu a:hover {
    background: linear-gradient(90deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    color: white;
    transform: translateX(-5px);
}

.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-right: 4px solid var(--light-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.sidebar-menu i {
    margin-left: 12px;
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0,0,0,0.1);
}

.sidebar-footer .user-info {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    font-weight: 600;
}

.sidebar-footer .user-info i {
    margin-left: 10px;
    font-size: 16px;
}

.sidebar-footer .system-info {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    text-align: center;
}

/* ===== المحتوى الرئيسي ===== */
.main-content {
    margin-right: 280px;
    padding: 30px;
    background: #f8f9fa;
    min-height: 100vh;
}

/* ===== رأس الصفحة ===== */
.header {
    background: white;
    padding: 25px 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    color: var(--secondary-color);
    font-size: 28px;
    font-weight: 800;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    background: var(--light-color);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    color: var(--secondary-color);
}

.user-info i {
    margin-left: 10px;
    font-size: 18px;
    color: var(--primary-color);
}

/* ===== البطاقات ===== */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--light-color) 0%, #fff8f0 100%);
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header i {
    margin-left: 10px;
    color: var(--primary-color);
    font-size: 20px;
}

.card-body {
    padding: 25px;
}

/* ===== البطاقات الإحصائية ===== */
.stat-card {
    background: linear-gradient(135deg, white 0%, #fafafa 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-card i {
    font-size: 2.8rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--light-color) 0%, #fff8f0 100%);
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    display: inline-block;
}

.stat-card h3 {
    font-size: 2.2rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-weight: 800;
}

.stat-card p {
    color: var(--text-light);
    margin: 0;
    font-weight: 600;
    font-size: 15px;
}

/* ===== الجداول ===== */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.table th {
    background: linear-gradient(135deg, var(--light-color) 0%, #fff8f0 100%);
    color: var(--secondary-color);
    padding: 18px 20px;
    text-align: right;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    transition: var(--transition);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: linear-gradient(90deg, rgba(241, 192, 149, 0.1) 0%, transparent 100%);
}

.table tbody tr:hover td {
    transform: translateX(5px);
}

/* ===== الأزرار ===== */
.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn i {
    margin-left: 8px;
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(213, 80, 83, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #9a3134 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(213, 80, 83, 0.4);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-light) 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-light) 0%, #5c4a5f 100%);
    transform: translateY(-2px);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c82333 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: translateY(-2px);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #218838 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-2px);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #138496 100%);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    transform: translateY(-2px);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

/* ===== النماذج ===== */
.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 15px;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(213, 80, 83, 0.1);
    transform: translateY(-1px);
}

.form-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    background: white 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='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat left 0.75rem center;
    background-size: 16px 12px;
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(213, 80, 83, 0.1);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ===== التنبيهات ===== */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 25px;
    border: 1px solid transparent;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.alert i {
    margin-left: 10px;
    font-size: 18px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* ===== الشبكة ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-12 {
    padding: 0 12px;
    margin-bottom: 25px;
}

.col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-md-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

/* ===== تنسيقات متجاوبة ===== */
@media (max-width: 1200px) {
    .sidebar {
        width: 250px;
    }
    .main-content {
        margin-right: 250px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 230px;
    }
    .main-content {
        margin-right: 230px;
        padding: 20px;
    }
    .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }
    .main-content {
        margin-right: 0;
        padding: 15px;
    }
    .col-md-3, .col-md-4, .col-md-6, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    .user-info {
        margin-top: 15px;
        width: 100%;
    }
    .login-box {
        padding: 30px 25px;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 20px 15px;
    }
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    .table {
        font-size: 14px;
    }
    .table th,
    .table td {
        padding: 12px 8px;
    }
}

/* ===== تنسيقات إضافية ===== */
.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* ===== تنسيقات خاصة بالفواتير ===== */
.invoice-header {
    background: linear-gradient(135deg, var(--light-color) 0%, #fff8f0 100%);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.invoice-details {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.invoice-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 25px 0;
}

.invoice-table th,
.invoice-table td {
    padding: 15px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.invoice-table th {
    background: linear-gradient(135deg, var(--light-color) 0%, #fff8f0 100%);
    color: var(--secondary-color);
    font-weight: 700;
}

.invoice-total {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    font-weight: 700;
    text-align: left;
    margin-top: 20px;
}

/* ===== تأثيرات للرسوم المتحركة ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* ===== تنسيقات الطباعة ===== */
@media print {
    .sidebar, .header, .btn {
        display: none !important;
    }
    .main-content {
        margin-right: 0 !important;
        padding: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
/* تنسيقات خاصة ببطاقة الإيرادات */
.revenue-card {
    position: relative;
}

.revenue-amount {
    font-size: 1.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    direction: ltr; /* للأرقام الكبيرة التي تكتب من اليسار إلى اليمين */
}

/* تكبير الخط للأرقام الصغيرة وتصغيره للأرقام الكبيرة */
.revenue-amount {
    font-size: calc(1.5rem - 0.2vw);
}

@media (max-width: 1200px) {
    .revenue-amount {
        font-size: 1.3rem;
    }
}

@media (max-width: 992px) {
    .revenue-amount {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .revenue-amount {
        font-size: 1.1rem;
    }
}

/* تلميح عند التمرير لعرض الرقم الكامل */
.revenue-card {
    position: relative;
}

.revenue-card:hover::after {
    content: attr(data-full-amount);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 100;
    font-size: 0.9rem;
}

.revenue-card {
    position: relative;
    cursor: pointer;
}

.revenue-card .revenue-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 100;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.revenue-card:hover .revenue-tooltip {
    display: block;
}