/* General App Styles */
body {
  background-color: #f4f7f6;
  font-family: 'Cairo', sans-serif; /* A nice Arabic font */
}

.app-container {
  display: flex;
  direction: rtl;
}

.main-content {
  flex-grow: 1;
  padding: 20px;
  transition: margin-right 0.3s;
}

.sidebar-modern.collapsed + .main-content {
  margin-right: 0;
}

/* Add a bit of style to the flash messages */
.alert {
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- General UI Enhancements --- */

body {
  background-color: #f8f9fa; /* A lighter, cleaner background */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.main-content {
  background: linear-gradient(to top, #ffffff, #f8f9fa 90%);
}

.btn-primary {
  background: linear-gradient(45deg, #007bff, #0056b3);
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn-info {
    background: linear-gradient(45deg, #17a2b8, #117a8b);
    border: none;
}

.datatable {
    background-color: #fff;
    border-radius: 8px;
    padding: 1rem;
}

/* --- Toast Notification --- */
.toast-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  background-color: #28a745;
  color: white;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 1060;
  opacity: 0;
  transition: opacity 0.3s, bottom 0.3s;
}
.toast-notification.show {
  opacity: 1;
  bottom: 40px;
}
.toast-notification.error {
  background-color: #dc3545;
}

/* --- Simple Modal --- */
.simple-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.5);
  z-index: 1050;
  display: flex;
  justify-content: center;
  align-items: center;
}
.simple-modal {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.simple-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 10px;
  margin-bottom: 15px;
}
.simple-modal-header h5 {
  margin: 0;
}
.simple-modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
}
.simple-modal-body {
  margin-bottom: 15px;
}
.simple-modal-footer {
  text-align: left;
}

/* Top Navigation Bar Styles */
.top-navbar {
  background: #ffffff;
  border-bottom: 1px solid #e9ecef;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: fixed;
  top: 0;
  right: 280px;
  left: 0;
  z-index: 999;
  height: 60px;
  transition: right 0.3s ease;
}

.sidebar-modern.collapsed + .main-content .top-navbar {
  right: 0;
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 20px;
}

.navbar-left .page-title {
  color: #2c3e50;
  font-weight: 600;
  font-size: 1.25rem;
}

.navbar-right {
  display: flex;
  align-items: center;
}

.user-menu {
  position: relative;
}

.user-info-dropdown {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

.user-info-dropdown:hover {
  background: #e9ecef;
  border-color: #dee2e6;
}

.user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(45deg, #007bff, #0056b3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-name {
  font-weight: 500;
  color: #2c3e50;
  font-size: 14px;
}

.user-info-dropdown i {
  color: #6c757d;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.user-menu:hover .user-info-dropdown i {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.user-menu:hover .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #2c3e50;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
}

.dropdown-item:hover {
  background: #f8f9fa;
  color: #007bff;
  text-decoration: none;
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  color: #6c757d;
}

.dropdown-divider {
  height: 1px;
  background: #e9ecef;
  margin: 4px 0;
}

.logout-item {
  color: #dc3545 !important;
}

.logout-item:hover {
  background: #f8d7da !important;
  color: #721c24 !important;
}

.logout-item i {
  color: #dc3545 !important;
}

/* Adjust main content to account for top navbar */
.main-content {
  margin-top: 60px;
  padding-top: 20px;
}

/* Dark theme adjustments */
[data-theme="dark"] .top-navbar {
  background: #2c3e50;
  border-bottom-color: #34495e;
}

[data-theme="dark"] .navbar-left .page-title {
  color: #ecf0f1;
}

[data-theme="dark"] .user-info-dropdown {
  background: #34495e;
  border-color: #4a5f7a;
  color: #ecf0f1;
}

[data-theme="dark"] .user-info-dropdown:hover {
  background: #4a5f7a;
  border-color: #5a6f8a;
}

[data-theme="dark"] .user-name {
  color: #ecf0f1;
}

[data-theme="dark"] .user-info-dropdown i {
  color: #bdc3c7;
}

[data-theme="dark"] .user-dropdown-menu {
  background: #34495e;
  border-color: #4a5f7a;
}

[data-theme="dark"] .dropdown-item {
  color: #ecf0f1;
}

[data-theme="dark"] .dropdown-item:hover {
  background: #4a5f7a;
  color: #3498db;
}

[data-theme="dark"] .dropdown-item i {
  color: #bdc3c7;
}

[data-theme="dark"] .dropdown-divider {
  background: #4a5f7a;
}