/* Global Styles */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  margin: 0;
}

/* Dashboard Layout */
.wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
  min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  min-width: 250px;
  max-width: 250px;
  background: #343a40;
  color: #fff;
  transition: all 0.3s;
  box-shadow: 0 0 35px 0 rgba(154, 161, 171, 0.15);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 999;
}

.sidebar-header {
  padding: 20px;
  background: #2c3237;
  border-bottom: 1px solid #495057;
}

.sidebar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
}

.sidebar-brand i {
  margin-right: 10px;
  color: #007bff;
}

.sidebar-content {
  padding: 0;
  height: calc(100vh - 80px);
  overflow-y: auto;
}

.sidebar-user {
  padding: 20px;
  border-bottom: 1px solid #495057;
  background: #2c3237;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-header {
  padding: 10px 20px;
  font-size: 0.875rem;
  color: #adb5bd;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 20px;
  border-bottom: 1px solid #495057;
}

.sidebar-item {
  position: relative;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: #adb5bd;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  border-left: 3px solid transparent;
}

.sidebar-link:hover,
.sidebar-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-left-color: #007bff;
}

.sidebar-link.active {
  color: #fff;
  background: rgba(0, 123, 255, 0.1);
  border-left-color: #007bff;
}

.sidebar-link i {
  width: 20px;
  margin-right: 10px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-badge {
  margin-left: auto;
  font-size: 0.75rem;
}

.sidebar-dropdown {
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-dropdown .sidebar-link {
  padding-left: 50px;
  font-size: 0.875rem;
}

/* Main Content */
.main {
  width: 100%;
  min-height: 100vh;
  transition: all 0.3s;
  margin-left: 250px;
  display: flex;
  flex-direction: column;
}

/* Top Navigation */
.navbar-bg {
  background: #fff !important;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 1rem 1.5rem;
}

.sidebar-toggle {
  color: #495057;
  text-decoration: none;
  margin-right: 15px;
}

.sidebar-toggle:hover {
  color: #007bff;
}

.navbar-align {
  margin-left: auto;
}

.nav-icon {
  color: #495057;
  text-decoration: none;
  padding: 0.5rem;
}

.nav-icon:hover {
  color: #007bff;
}

/* Content Area */
.content {
  flex: 1;
  padding: 2rem 1.5rem;
}

/* Footer */
.footer {
  background: #fff;
  border-top: 1px solid #dee2e6;
  padding: 0.25rem 1.5rem;
  margin-top: auto;
  font-size: 0.875rem;
  min-height: auto;
}

.footer .container-fluid {
  padding: 0;
}

.footer .row {
  margin: 0;
  min-height: auto;
}

.footer p,
.footer ul {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

/* Cards */
.card {
  border: none;
  border-radius: 8px;
  box-shadow: 0 0 35px 0 rgba(154, 161, 171, 0.15);
  margin-bottom: 1.5rem;
}

.card-header {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 1rem 1.5rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Statistics Cards */
.stats-card {
  text-align: center;
  padding: 2rem;
  border-left: 4px solid #007bff;
}

.stats-card.success {
  border-left-color: #28a745;
}

.stats-card.warning {
  border-left-color: #ffc107;
}

.stats-card.danger {
  border-left-color: #dc3545;
}

.stats-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: #495057;
}

.stats-label {
  color: #6c757d;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
}

/* Tables */
.table {
  background: #fff;
}

.table th {
  border-top: none;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  color: #495057;
  font-size: 0.875rem;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  border-radius: 6px;
  font-weight: 500;
  padding: 0.5rem 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Forms */
.form-control:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    margin-left: -250px;
  }
  
  .sidebar.active {
    margin-left: 0;
  }
  
  .main {
    margin-left: 0;
  }
  
  .main.active {
    margin-left: 250px;
  }
}

/* Utilities */
.text-primary-custom {
  color: #667eea !important;
}

.bg-gradient-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* Alert Improvements */
.alert {
  border: none;
  border-radius: 8px;
}

.alert-success {
  background-color: #d1e7dd;
  color: #0a3622;
}

.alert-danger {
  background-color: #f8d7da;
  color: #58151c;
}

/* Dashboard specific styles */
.page-title {
  margin-bottom: 2rem;
  color: #495057;
}

.breadcrumb {
  background: none;
  padding: 0;
  margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "→";
  color: #6c757d;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(3px);
}

#loading-overlay .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Responsive enhancements */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main {
    margin-left: 0;
  }
  
  .stats-card {
    margin-bottom: 1rem;
  }
}

/* Arabic RTL Support */
[dir="rtl"] {
  .sidebar {
    right: 0;
    left: auto;
  }
  
  .main {
    margin-right: 250px;
    margin-left: 0;
  }
  
  .sidebar-link i {
    margin-right: 0;
    margin-left: 10px;
  }
  
  .sidebar-toggle {
    margin-left: 15px;
    margin-right: 0;
  }
}

[dir="rtl"] @media (max-width: 768px) {
  .main {
    margin-right: 0;
  }
}

/* User Profile Header Styles */
.user-profile-header {
  display: flex;
  align-items: center;
}

.user-profile-header .profile-picture {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.user-profile-header .profile-picture:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.user-profile-header .profile-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.user-profile-header .profile-placeholder:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.dropdown-header .profile-picture {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e9ecef;
}

.dropdown-header .profile-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  border: 2px solid #e9ecef;
}

/* Responsive adjustments for profile pictures */
@media (max-width: 576px) {
  .user-profile-header .profile-picture,
  .user-profile-header .profile-placeholder {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}