/* إعادة تعريف القواعد الأساسية */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #f9f9f9;
    margin: 0;
    padding: 0;
}

/* تنسيقات الـ Navbar */
.navbar {
    background-color: #007bff;
    color: #fff;
    padding: 10px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: padding 0.3s ease;
    width: 100%;
}

/*.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
     Adjust height as needed 
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1050;
    /* Ensure navbar is on top 
    transition: all 0.3s ease;
}*/

.navbar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar .logo img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.navbar .logo span {
    font-size: 1.5em;
    font-weight: 700;
}

.navbar .search-bar {
    padding: 8px;
    border: none;
    border-radius: 5px;
    width: 300px;
    font-family: 'Cairo', sans-serif;
    font-size: 1em;
}

.navbar .user-btn {
    background-color: #0056b3;
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.navbar .user-btn:hover {
    background-color: #003d82;
}

.navbar .toggle-btn {
    display: none;
    font-size: 1.5em;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}

/* تنسيقات الـ Sidebar 
.sidebar {
    position: fixed;
    /*top: 40px;*/
/* width: 250px;
    /*height: calc(100% - 60px);*/
/* height: 90vh;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: transform 0.3s ease;
    
}*/

html[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    direction: rtl;
}

html[dir="ltr"] .sidebar {
    left: 0;
    right: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    direction: ltr;
}

.sidebar.hidden {
    transform: translateX(100%);
}

html[dir="ltr"] .sidebar.hidden {
    transform: translateX(-100%);
}

body.sidebar-visible .sidebar {
    transform: translateX(0);
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin-bottom: 15px;
}

.sidebar ul li a {
    text-decoration: none;
    color: #333;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    background-color: #007bff;
    color: #fff;
}

.sidebar ul li a i {
    font-size: 1.2em;
}

/* تنسيقات الـ Container */
.container {
    padding: 20px 20px;
    /* تعديل الـ padding لزيادة الفراغ */
    margin-top: 60px;
    transition: transform 0.3s ease;
}

html[dir="rtl"] .container {
    margin-right: 250px;
    margin-left: 0;
}

html[dir="ltr"] .container {
    margin-left: 250px;
    margin-right: 0;
}

html[dir="rtl"] body.sidebar-hidden .container {
    margin-right: 0;
}

html[dir="ltr"] body.sidebar-hidden .container {
    margin-left: 0;
}

/* تنسيقات الـ Main */
main {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

html[dir="rtl"] main {
    padding-right: 40px;
    padding-left: 0;
    text-align: right;
}

html[dir="ltr"] main {
    padding-left: 40px;
    padding-right: 0;
    text-align: left;
}

h2,
h3 {
    color: #333;
    margin-bottom: 20px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

label {
    font-weight: 700;
    color: #333;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"],
input[type="email"],
select,
textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Cairo', sans-serif;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease;
    width: 100%;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="file"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    border-color: #007bff;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select[multiple] {
    height: 120px;
}

button {
    padding: 10px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

.message {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
}

.back-link,
.add-link {
    display: inline-block;
    margin-top: 20px;
    margin-left: 10px;
    color: #007bff;
    text-decoration: none;
    font-family: 'Cairo', sans-serif;
}

.back-link:hover,
.add-link:hover {
    text-decoration: underline;
}

/* تنسيقات الجدول */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-family: 'Cairo', sans-serif;
}

th,
td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
}

th {
    background-color: #f2f2f2;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

td {
    color: #555;
    white-space: nowrap;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

/* تنسيقات مربعات الاختيار في الجدول */
input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* تنسيقات الأزرار في الجدول */
.edit-link,
.delete-link {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    color: #fff;
    margin: 0 5px;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.edit-link {
    background-color: #007bff;
}

.edit-link:hover {
    background-color: #0056b3;
}

.delete-link {
    background-color: #dc3545;
}

.delete-link:hover {
    background-color: #b02a37;
}

/* تنسيقات صفحة تسجيل الدخول */
body.login-page {
    background: linear-gradient(135deg, #007bff 0%, #00c6ff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.login-container {
    background-color: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 1s ease-in-out;
}

.login-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: bounceIn 1s ease-in-out;
}

.login-container h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
    animation: slideIn 0.8s ease-out;
}

.login-container p {
    color: #dc3545;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-container label {
    font-weight: 700;
    color: #333;
    font-size: 1em;
}

.login-container input[type="text"],
.login-container input[type="password"],
.login-container input[type="email"] {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Cairo', sans-serif;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus,
.login-container input[type="email"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.login-container button {
    padding: 12px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.login-container button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.forgot-password-link {
    display: inline-block;
    margin-top: 15px;
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.forgot-password-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* تنسيقات صفحة نسيت كلمة المرور */
body.forgot-password-page {
    background: linear-gradient(135deg, #007bff 0%, #00c6ff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

/* تنسيقات الـ Dashboard */
.dashboard-welcome {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.dashboard-card i {
    font-size: 2em;
    color: #007bff;
    margin-bottom: 10px;
}

.dashboard-card h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.dashboard-card p {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 15px;
}

.dashboard-card a {
    text-decoration: none;
    color: #007bff;
    font-weight: 700;
    transition: color 0.3s ease;
}

.dashboard-card a:hover {
    color: #0056b3;
}

/* تنسيقات الرسوم البيانية */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.chart-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
}

/* تأثيرات حركية */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* تنسيقات متجاوبة */
@media (max-width: 1024px) {
    .container {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 15px;
    }

    .sidebar {
        transform: translateX(100%);
    }

    html[dir="ltr"] .sidebar {
        transform: translateX(-100%);
    }

    main {
        padding: 15px;
    }

    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .navbar {
        justify-content: space-between;
    }

    .navbar .logo span {
        font-size: 1.2em;
    }

    .navbar .search-bar {
        max-width: 200px;
    }

    .navbar .user-btn {
        font-size: 0.9em;
    }

    .navbar .toggle-btn {
        display: block;
    }

    .sidebar {
        transform: translateX(100%);
        z-index: 1040;
        /* Lower than navbar */
    }

    body.sidebar-visible .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 250px;
        height: 100vh;
        transform: translateX(0);
        z-index: 1060;
        /* Ensure sidebar is on top of content but can be under navbar */
    }

    html[dir="rtl"] body.sidebar-visible .sidebar {
        transform: translateX(0);
    }

    html[dir="ltr"] body.sidebar-visible .sidebar {
        left: 0;
        transform: translateX(0);
    }

    .container {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 70px 10px 10px;
        transform: translateX(0);
        transition: transform 0.3s ease;
    }

    main {
        padding: 10px;
    }

    html[dir="rtl"] main {
        padding-right: 10px;
    }

    html[dir="ltr"] main {
        padding-left: 10px;
    }

    h2,
    h3 {
        font-size: 1.2em;
    }

    table {
        font-size: 0.9em;
    }

    th,
    td {
        padding: 8px;
    }

    .dashboard-welcome {
        font-size: 1.2em;
    }

    .dashboard-card {
        padding: 15px;
    }

    .dashboard-card i {
        font-size: 1.5em;
    }

    .dashboard-card h3 {
        font-size: 1em;
    }

    .dashboard-card p {
        font-size: 1.2em;
    }

    .chart-container {
        padding: 15px;
    }

    .chart-container h3 {
        font-size: 1em;
    }

    .login-container {
        padding: 30px;
        max-width: 350px;
    }

    .login-container h2 {
        font-size: 1.5em;
    }

    .login-logo {
        width: 80px;
        height: 80px;
    }

    .login-container input[type="text"],
    .login-container input[type="password"],
    .login-container input[type="email"],
    .login-container button {
        font-size: 0.9em;
        padding: 10px;
    }

    .forgot-password-link {
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 8px 10px;
    }

    .navbar .logo img {
        width: 30px;
        height: 30px;
    }

    .navbar .logo span {
        font-size: 1em;
    }

    .navbar .search-bar {
        display: none;
    }

    .navbar .user-btn {
        font-size: 0.8em;
    }

    .container {
        padding: 60px 10px 10px;
    }

    main {
        padding: 8px;
    }

    h2,
    h3 {
        font-size: 1em;
    }

    table {
        font-size: 0.8em;
    }

    th,
    td {
        padding: 6px;
    }

    .edit-link,
    .delete-link {
        padding: 4px 8px;
        font-size: 0.8em;
    }

    .dashboard-welcome {
        font-size: 1em;
    }

    .dashboard-card {
        padding: 10px;
    }

    .dashboard-card i {
        font-size: 1.2em;
    }

    .dashboard-card h3 {
        font-size: 0.9em;
    }

    .dashboard-card p {
        font-size: 1em;
    }

    .chart-container {
        padding: 10px;
    }

    .login-container {
        padding: 20px;
        max-width: 300px;
    }

    .login-container h2 {
        font-size: 1.2em;
    }

    .login-logo {
        width: 60px;
        height: 60px;
    }

    .login-container input[type="text"],
    .login-container input[type="password"],
    .login-container input[type="email"],
    .login-container button {
        font-size: 0.8em;
        padding: 8px;
    }

    .forgot-password-link {
        font-size: 0.7em;
    }
}