/* Reusable Components for Noor Hospital System */
/* File: assets/css/components.css */

/* Loading Spinner Component */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

.loading-spinner.lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.loading-spinner.primary {
  border-color: rgba(var(--primary-rgb), 0.3);
  border-top-color: var(--primary-color);
}

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

/* Custom Modal Component */
.modal-custom {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-custom .modal-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-bottom: none;
  padding: 1.5rem 2rem;
}

.modal-custom .modal-title {
  font-weight: var(--font-semibold);
}

.modal-custom .btn-close {
  filter: brightness(0) invert(1);
}

.modal-custom .modal-body {
  padding: 2rem;
}

.modal-custom .modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 1.5rem 2rem;
}

/* Toast Component */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-tooltip);
}

.toast-custom {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-width: 300px;
}

.toast-custom.toast-success {
  border-left: 4px solid var(--success-color);
}

.toast-custom.toast-error {
  border-left: 4px solid var(--danger-color);
}

.toast-custom.toast-warning {
  border-left: 4px solid var(--warning-color);
}

.toast-custom.toast-info {
  border-left: 4px solid var(--info-color);
}

.toast-custom .toast-header {
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-light);
  font-weight: var(--font-medium);
}

.toast-custom .toast-body {
  padding: 1rem 1.5rem;
}

/* Breadcrumb Component */
.breadcrumb-custom {
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}

.breadcrumb-custom .breadcrumb-item {
  color: var(--text-muted);
}

.breadcrumb-custom .breadcrumb-item.active {
  color: var(--primary-color);
  font-weight: var(--font-medium);
}

.breadcrumb-custom .breadcrumb-item + .breadcrumb-item::before {
  content: "←";
  margin: 0 0.5rem;
  color: var(--text-light);
}

/* Pagination Component */
.pagination-custom .page-link {
  border: none;
  color: var(--primary-color);
  padding: 0.75rem 1rem;
  margin: 0 0.125rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.pagination-custom .page-link:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.pagination-custom .page-item.active .page-link {
  background-color: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* Progress Bar Component */
.progress-custom {
  height: 8px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-gray);
  overflow: hidden;
}

.progress-custom .progress-bar {
  border-radius: var(--radius-sm);
  transition: width 0.6s ease;
}

.progress-custom.lg {
  height: 12px;
}

.progress-custom.xl {
  height: 16px;
}

/* Timeline Component */
.timeline {
  position: relative;
  padding: 2rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  right: 50%;
  transform: translateX(50%);
  width: 2px;
  height: 100%;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
}

.timeline-item:nth-child(odd) {
  flex-direction: row-reverse;
}

.timeline-item:nth-child(odd) .timeline-content {
  text-align: right;
  margin-right: 2rem;
}

.timeline-item:nth-child(even) .timeline-content {
  margin-left: 2rem;
}

.timeline-marker {
  position: absolute;
  right: 50%;
  transform: translateX(50%);
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border: 4px solid white;
  border-radius: var(--radius-round);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

.timeline-content {
  flex: 1;
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.timeline-date {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.timeline-title {
  color: var(--primary-color);
  font-weight: var(--font-semibold);
  margin-bottom: 0.5rem;
}

/* Avatar Component */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-medium);
  overflow: hidden;
}

.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

.avatar.lg {
  width: 56px;
  height: 56px;
  font-size: 1.2rem;
}

.avatar.xl {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.status {
  position: relative;
}

.avatar.status::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: var(--radius-round);
  background: var(--success-color);
}

.avatar.status.offline::after {
  background: var(--text-light);
}

.avatar.status.busy::after {
  background: var(--danger-color);
}

/* Badge Component Extensions */
.badge-custom {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: var(--font-medium);
}

.badge-custom.rounded-pill {
  border-radius: 50rem;
}

.badge-custom.badge-outline {
  background: transparent;
  border: 1px solid currentColor;
}

/* Dropdown Component */
.dropdown-custom .dropdown-menu {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  margin-top: 0.5rem;
}

.dropdown-custom .dropdown-item {
  padding: 0.75rem 1.25rem;
  transition: all var(--transition-fast);
  border-radius: 0;
}

.dropdown-custom .dropdown-item:hover {
  background-color: var(--primary-color);
  color: white;
}

.dropdown-custom .dropdown-divider {
  margin: 0.5rem 0;
  border-color: var(--border-light);
}

/* Tabs Component */
.nav-tabs-custom {
  border-bottom: 2px solid var(--border-light);
}

.nav-tabs-custom .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: var(--font-medium);
  padding: 1rem 1.5rem;
  transition: all var(--transition-fast);
}

.nav-tabs-custom .nav-link:hover {
  color: var(--primary-color);
  border-bottom-color: var(--primary-light);
}

.nav-tabs-custom .nav-link.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: transparent;
}

/* Pills Component */
.nav-pills-custom .nav-link {
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.5rem;
  margin: 0 0.25rem;
  transition: all var(--transition-fast);
  color: var(--text-muted);
  font-weight: var(--font-medium);
}

.nav-pills-custom .nav-link:hover {
  background-color: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-color);
}

.nav-pills-custom .nav-link.active {
  background-color: var(--primary-color);
  color: white;
}

/* Accordion Component */
.accordion-custom .accordion-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

.accordion-custom .accordion-header {
  border-radius: var(--radius-lg);
}

.accordion-custom .accordion-button {
  background: var(--bg-light);
  color: var(--text-color);
  font-weight: var(--font-medium);
  padding: 1.25rem 1.5rem;
  border: none;
  border-radius: var(--radius-lg);
}

.accordion-custom .accordion-button:not(.collapsed) {
  background: var(--primary-color);
  color: white;
  box-shadow: none;
}

.accordion-custom .accordion-button::after {
  filter: brightness(0) saturate(100%);
}

.accordion-custom .accordion-button:not(.collapsed)::after {
  filter: brightness(0) saturate(100%) invert(1);
}

.accordion-custom .accordion-body {
  padding: 1.5rem;
  border-top: 1px solid var(--border-light);
}

/* List Group Component */
.list-group-custom .list-group-item {
  border: 1px solid var(--border-light);
  padding: 1rem 1.25rem;
  transition: all var(--transition-fast);
}

.list-group-custom .list-group-item:first-child {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.list-group-custom .list-group-item:last-child {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.list-group-custom .list-group-item:hover {
  background-color: var(--bg-light);
  transform: translateX(5px);
}

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

/* Input Group Component */
.input-group-custom .input-group-text {
  background: var(--bg-light);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: var(--font-medium);
}

.input-group-custom .form-control {
  border: 2px solid var(--border-color);
}

.input-group-custom .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: none;
}

.input-group-custom .form-control:focus ~ .input-group-text {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Floating Labels Component */
.form-floating-custom {
  position: relative;
}

.form-floating-custom .form-control {
  height: calc(3.5rem + 2px);
  padding: 1rem 0.75rem;
  border-radius: var(--radius-lg);
}

.form-floating-custom label {
  position: absolute;
  top: 0;
  right: 0.75rem;
  height: 100%;
  padding: 1rem 0;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 100% 0;
  transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
  color: var(--text-muted);
}

.form-floating-custom .form-control:focus ~ label,
.form-floating-custom .form-control:not(:placeholder-shown) ~ label {
  opacity: 0.65;
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Switch Component */
.switch-custom {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch-custom input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 28px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.switch-custom input:checked + .switch-slider {
  background-color: var(--primary-color);
}

.switch-custom input:checked + .switch-slider:before {
  transform: translateX(22px);
}

/* Rating Component */
.rating-custom {
  display: flex;
  direction: ltr;
  justify-content: flex-end;
}

.rating-custom .star {
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: 0.25rem;
}

.rating-custom .star:hover,
.rating-custom .star.active {
  color: var(--warning-color);
  transform: scale(1.1);
}

.rating-custom .star:hover ~ .star {
  color: var(--warning-color);
}

/* Responsive Utilities for Components */
@media (max-width: 768px) {
  .timeline::before {
    right: 30px;
  }
  
  .timeline-item {
    flex-direction: row !important;
  }
  
  .timeline-item .timeline-content {
    margin-right: 0 !important;
    margin-left: 3rem !important;
    text-align: right !important;
  }
  
  .timeline-marker {
    right: 30px !important;
    transform: none !important;
  }
  
  .modal-custom .modal-body,
  .modal-custom .modal-header,
  .modal-custom .modal-footer {
    padding: 1rem 1.5rem;
  }
  
  .toast-container {
    right: 10px;
    left: 10px;
  }
  
  .toast-custom {
    min-width: auto;
  }
}content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
