:root {
  --primary-color: #02254b;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
}

/* Select2 RTL Styles */
.select2-container--classic {
  width: 100% !important;
}

.select2-container--classic .select2-selection--multiple {
  border-radius: 4px !important;
  border: 1px solid #ced4da !important;
  min-height: 38px !important;
}

.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
  padding: 0 8px !important;
}

.select2-container--classic .select2-selection--multiple .select2-selection__choice {
  background-color: var(--primary-color) !important;
  color: white !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 2px 8px !important;
  margin: 4px !important;
}

.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
  color: white !important;
  margin-right: 5px !important;
  margin-left: -4px !important;
}

.select2-container--classic .select2-selection--multiple .select2-search__field {
  margin-top: 4px !important;
}

.select2-container--classic .select2-dropdown {
  border-color: #ced4da !important;
}

.select2-container--classic .select2-results__option--highlighted[aria-selected] {
  background-color: var(--primary-color) !important;
}

/* Fix for Select2 in Bootstrap Modal */
.modal-open .select2-container--open {
  z-index: 1056 !important; /* Bootstrap modal has z-index: 1055 */
}

.select2-container--open .select2-dropdown {
  z-index: 1056 !important;
}

.select2-container {
  z-index: 1056 !important;
}

/* Ensure the dropdown is wide enough in the modal */
.modal .select2-container {
  width: 100% !important;
  min-width: 100% !important;
}

/* Fix for modal scrollbar shift */
body.modal-open {
  padding-right: 0 !important;
  overflow-y: auto !important;
}

.modal {
  padding-right: 0 !important;
}

.theme-blue {
  --primary-color: #02254b;
}

.theme-green {
  --primary-color: #28a745;
}

.theme-purple {
  --primary-color: #6f42c1;
}

.theme-orange {
  --primary-color: #fd7e14;
}

.theme-teal {
  --primary-color: #20c997;
}

.body {
  direction: rtl;
  text-align: right;
}

.sidebar {
  background-color: var(--primary-color);
  min-height: 100vh;
  position: fixed;
  top: 0;
  right: 0;
  width: 250px;
  z-index: 1000;
  transition: all 0.3s;
}

.sidebar.collapsed {
  width: 80px;
}

.main-content {
  margin-right: 250px;
  transition: all 0.3s;
  min-height: 100vh;
  background-color: #f8f9fa;
}

.main-content.expanded {
  margin-right: 80px;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li a {
  color: white;
  text-decoration: none;
  padding: 15px 20px;
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background-color: rgba(255, 255, 255, 0.1);
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.appointment-card {
  border-right: 4px solid var(--primary-color);
}

.status-pending {
  border-right-color: var(--warning-color);
}

.status-confirmed {
  border-right-color: var(--success-color);
}

.status-cancelled {
  border-right-color: var(--danger-color);
}

.status-completed {
  border-right-color: var(--info-color);
}

.stat-card {
  background: var(--primary-color);
  color: white;
  border-radius: 10px;
}

.table-responsive {
  border-radius: 8px;
  overflow: scroll;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  opacity: 0.9;
}

.color-picker {
  position: absolute;
  top: 60px;
  left: 20px;
  z-index: 1001;
}

.color-option {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 5px;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pagination-info {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-top: 20px;
}

/* Loading spinner */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Image Preview Styles */
#image-preview,
#edit-image-preview {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  background-color: #f8f9fa;
  transition: all 0.3s ease;
}

#image-preview:hover,
#edit-image-preview:hover {
  border-color: var(--primary-color);
  background-color: #fff;
}

#image-preview img,
#edit-image-preview img {
  border: 1px solid #ddd;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

#image-preview img:hover,
#edit-image-preview img:hover {
  transform: scale(1.05);
}

.image-upload-section {
  position: relative;
}

.image-upload-section .form-control[type="file"] {
  position: relative;
  z-index: 2;
}

.image-upload-section .form-control[type="file"]:focus {
  box-shadow: 0 0 0 0.2rem rgba(2, 37, 75, 0.25);
  border-color: var(--primary-color);
}

/* Appointment Booking Modal Styles */
.stepper-wrapper {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

.stepper-wrapper::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #e9ecef;
  z-index: 0;
}

.stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
}

.step-counter {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e9ecef;
  border: 2px solid #e9ecef;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  color: #6c757d;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.stepper-item.active .step-counter {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.stepper-item.completed .step-counter {
  background-color: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.stepper-item.completed .step-counter::before {
  content: '✓';
  font-size: 16px;
}

.step-name {
  font-size: 12px;
  text-align: center;
  color: #6c757d;
  font-weight: 500;
}

.stepper-item.active .step-name,
.stepper-item.completed .step-name {
  color: var(--primary-color);
  font-weight: 600;
}

.step-content {
  display: none;
}

.step-content.active {
  display: block;
}

/* Patient and Doctor Selection Cards */
.selection-card {
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.selection-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(2, 37, 75, 0.1);
}

.selection-card.selected {
  border-color: var(--primary-color);
  background-color: rgba(2, 37, 75, 0.05);
}

.selection-card .card-header {
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 10px;
}

.selection-card .card-body {
  padding: 0;
}

/* Time Slot Selection */
.time-slot {
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 4px;
  cursor: pointer;
  text-align: center;
  background-color: #f8f9fa;
  transition: all 0.3s ease;
  display: inline-block;
  min-width: 100px;
}

.time-slot:hover {
  border-color: var(--primary-color);
  background-color: rgba(2, 37, 75, 0.1);
}

.time-slot.selected {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: white;
}

.time-slot.unavailable {
  background-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.availability-date-header {
  background-color: var(--light-color);
  border-radius: 6px;
  padding: 10px 15px;
  margin: 15px 0 10px 0;
  font-weight: 600;
  color: var(--primary-color);
}

/* Modal Enhancements */
.modal-xl {
  max-width: 1200px;
}

.list-group-item {
  cursor: pointer;
  transition: all 0.3s ease;
}

.list-group-item:hover {
  background-color: rgba(2, 37, 75, 0.05);
}

.list-group-item.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.patient-info, .doctor-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.patient-details, .doctor-details {
  flex: 1;
}

.patient-actions, .doctor-actions {
  margin-left: 10px;
}

/* Search Results Animation */
.search-results {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .stepper-wrapper {
    flex-direction: column;
    align-items: center;
  }
  
  .stepper-wrapper::before {
    display: none;
  }
  
  .stepper-item {
    flex-direction: row;
    margin-bottom: 15px;
    width: 100%;
    justify-content: flex-start;
  }
  
  .step-counter {
    margin-right: 15px;
    margin-bottom: 0;
  }
  
  .step-name {
    text-align: left;
  }

  /* Mobile Sidebar Styles */
  .sidebar {
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    z-index: 1050;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
  }

  .sidebar.collapsed {
    transform: translateX(100%);
    width: 250px;
  }

  /* Ensure brand text and nav text are visible on mobile when open */
  .sidebar.mobile-open #brand-text,
  .sidebar.mobile-open .nav-text {
    display: inline !important;
  }

  .main-content {
    margin-right: 0;
    width: 100%;
  }

  .main-content.expanded {
    margin-right: 0;
  }

  /* Overlay for mobile sidebar */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.show {
    display: block;
    opacity: 1;
  }

  /* Touch-friendly hamburger button */
  .btn[onclick="toggleSidebar()"] {
    padding: 0.75rem;
    margin: -0.5rem;
    touch-action: manipulation;
  }

  /* Mobile close button styles */
  #mobile-close-btn {
    padding: 0.5rem;
    margin: -0.5rem;
    touch-action: manipulation;
    transition: all 0.2s ease;
    border-radius: 4px;
    opacity: 0.8;
  }

  #mobile-close-btn:hover,
  #mobile-close-btn:active {
    transform: scale(1.1) rotate(90deg);
    background-color: rgba(255, 255, 255, 0.2) !important;
    opacity: 1;
  }

  #mobile-close-btn:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    outline: none;
  }

  /* Larger touch targets for navigation */
  .sidebar-nav li a {
    padding: 20px;
    font-size: 1.1rem;
    touch-action: manipulation;
  }
}

/* Notifications specific styles */
.notifications-table {
  font-size: 0.9rem;
}

.notifications-table th {
  background-color: var(--light-color);
  font-weight: 600;
  border-bottom: 2px solid var(--primary-color);
  white-space: nowrap;
}

.notifications-table td {
  vertical-align: middle;
}

.notifications-table .text-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status badges */
.badge.bg-primary {
  background-color: #3B82F6 !important;
}

.badge.bg-success {
  background-color: #10B981 !important;
}

.badge.bg-danger {
  background-color: #EF4444 !important;
}

.badge.bg-secondary {
  background-color: #6B7280 !important;
}

/* Filter panel styles */
.filter-panel {
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.filter-panel .card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

/* Loading spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0,0,0,.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state styles */
.empty-state {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Action buttons */
.btn-group-sm .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Pagination styles */
.pagination .page-link {
  color: var(--primary-color);
  border-color: #dee2e6;
}

.pagination .page-link:hover {
  color: var(--primary-color);
  background-color: #e9ecef;
  border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
  background-color: var(--info-color);
  border-color: var(--info-color);
}

/* Modal content adjustments */
.modal-lg {
  max-width: 800px;
}

.modal-body .row {
  margin-bottom: 1rem;
}

/* Responsive adjustments for notifications */
@media (max-width: 768px) {
  .notifications-table {
    font-size: 0.8rem;
  }
  
  .notifications-table .text-truncate {
    max-width: 100px;
  }
  
  .btn-group-sm .btn {
    padding: 0.125rem 0.25rem;
    font-size: 0.75rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .filter-panel .row .col-md-2,
  .filter-panel .row .col-md-3,
  .filter-panel .row .col-md-4 {
    margin-bottom: 1rem;
  }
}

/* Table hover effects */
.table-hover tbody tr:hover {
  background-color: rgba(0,0,0,.075);
}

/* Card shadows */
.card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  border: 1px solid rgba(0,0,0,.125);
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Select2 adjustments for notifications */
.select2-container--classic .select2-selection--multiple {
  min-height: calc(1.5em + 0.75rem + 2px);
}

/* Notification content display */
.notification-content {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.75rem;
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
}
