/* Global admin theme */
html, body { height: 100%; }
body { background-color: #f8fafc; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* App bar and search */
.appbar { background-image: linear-gradient(90deg, #0d6efd, #3b82f6); }
.appbar .navbar-brand { font-weight: 600; }
.appbar .app-search .form-control::placeholder { color: rgba(255,255,255,0.9); }
.appbar .app-search .form-control, .appbar .app-search .input-group-text { color: #fff; }
.avatar { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }

/* Modern Metric Cards */
.metric-card-modern {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  background: white;
}

.metric-card-modern:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.metric-card-modern .card-body {
  padding: 1.5rem;
}

/* Colored Metric Cards */
.metric-card-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
}

.metric-card-primary .metric-title {
  color: rgba(255, 255, 255, 0.8);
}

.metric-card-primary .metric-value-large {
  color: white;
}

.metric-card-warning {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: none;
  color: white;
}

.metric-card-warning .metric-title {
  color: rgba(255, 255, 255, 0.8);
}

.metric-card-warning .metric-value-large {
  color: white;
}

.metric-card-success {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border: none;
  color: white;
}

.metric-card-success .metric-title {
  color: rgba(255, 255, 255, 0.8);
}

.metric-card-success .metric-value-large {
  color: white;
}

.metric-card-info {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  border: none;
  color: #2d3748;
}

.metric-card-info .metric-title {
  color: #4a5568;
}

.metric-card-info .metric-value-large {
  color: #2d3748;
}

.metric-title {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.metric-value-large {
  font-size: 2.25rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.metric-icon-modern {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.25rem;
}

.metric-icon-primary {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.metric-icon-warning {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.metric-icon-success {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.metric-icon-info {
  background: rgba(45, 55, 72, 0.1);
  color: #4a5568;
}

/* Cards */
.card { 
  border: 1px solid #e2e8f0; 
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  background: white;
}
.card .card-header { 
  background: white; 
  border-bottom: 1px solid #e2e8f0; 
  font-weight: 600;
  padding: 1rem 1.5rem;
  color: #1e293b;
}

.card-title {
  color: #1e293b;
  font-weight: 600;
}

/* Table hover */
.table tr { transition: background-color .15s ease-in-out; }
.table tr:hover { background: #f8fafc; }

/* Small utilities */
.cursor-pointer { cursor: pointer; }

/* Legacy metric cards (keep for compatibility) */
.metric-card { position: relative; overflow: hidden; border-radius: .75rem; }
.metric-card .metric-icon { position: absolute; right: .75rem; top: .75rem; font-size: 1.25rem; opacity: .15; }
.metric-card .metric-value { font-size: 2.25rem; font-weight: 700; line-height: 1; }
.metric-card .metric-label { font-size: .875rem; opacity: .9; }
.metric-delta { font-size: .8rem; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .25rem .6rem; font-size: .8125rem; font-weight: 600; }
.chip .bi { font-size: .9em; }
.chip-neutral { background: #eef2f7; color: #506690; }
.chip-success { background: #e8f6ef; color: #0f5132; }
.chip-warning { background: #fff3cd; color: #664d03; }
.chip-danger { background: #f8d7da; color: #842029; }
.chip-info { background: #e7f1ff; color: #084298; }

/* Compact tables */
.table.compact th,
.table.compact td { padding-top: .5rem; padding-bottom: .5rem; vertical-align: middle; }

/* Dropdown panel (notifications/inbox) */
.dropdown-menu-panel { width: 340px; max-height: 60vh; overflow: auto; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.dropdown-menu-panel .panel-header { padding: .5rem .75rem; border-bottom: 1px solid rgba(0,0,0,.06); font-weight: 600; }
.dropdown-menu-panel .panel-item { padding: .5rem .75rem; }
.dropdown-menu-panel .panel-item:hover { background: rgba(13,110,253,.06); }
.dropdown-menu-panel .panel-empty { padding: 1rem; color: #6c757d; }

/* Dropdown form items */
.dropdown-item-form { margin: 0; }
.dropdown-item-form .dropdown-item { border: none; background: none; width: 100%; text-align: left; }
.dropdown-item-form .dropdown-item:hover { background: var(--bs-dropdown-link-hover-bg); }

/* Document View Enhancements */
.detail-grid {
  display: grid;
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6c757d;
  display: flex;
  align-items: center;
}

.detail-value {
  font-size: 0.95rem;
  color: #212529;
}

.description-box {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Enhanced Timeline Styling */
.timeline-container {
  position: relative;
  padding: 1rem;
}

.timeline-item {
  position: relative;
  padding-left: 2.5rem;
  padding-bottom: 1.5rem;
  border-left: 2px solid #e9ecef;
  margin-left: 0.75rem;
}

.timeline-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline-item.timeline-latest {
  border-left-color: #198754;
}

.timeline-marker {
  position: absolute;
  left: -0.5rem;
  top: 0.25rem;
  width: 1rem;
  height: 1rem;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-latest .timeline-marker {
  border-color: #198754;
  background: #198754;
}

.timeline-marker i {
  font-size: 0.5rem;
  color: #e9ecef;
}

.timeline-latest .timeline-marker i {
  color: #fff;
}

.timeline-content {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.timeline-latest .timeline-content {
  border-color: #198754;
  box-shadow: 0 2px 8px rgba(25,135,84,0.15);
}

.timeline-note {
  margin: 0.5rem 0;
  line-height: 1.5;
}

.timeline-meta {
  font-size: 0.875rem;
  color: #6c757d;
  border-top: 1px solid #f8f9fa;
  padding-top: 0.5rem;
  margin-top: 0.75rem;
}

/* Status Badge Enhancements */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-received { background: #cff4fc; color: #055160; }
.status-processing { background: #d1ecf1; color: #0c5460; }
.status-completed { background: #d1e7dd; color: #0f5132; }
.status-on-hold { background: #fff3cd; color: #664d03; }
.status-cancelled { background: #f8d7da; color: #842029; }

/* Form Enhancements */
.update-form .form-label,
.reopen-form .form-label,
.reopen-request-form .form-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.update-form .form-control:focus,
.reopen-form .form-control:focus,
.reopen-request-form .form-control:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Enhanced Alert Styling */
.alert-dismissible .btn-close {
  padding: 0.75rem 1rem;
}

/* Remove auto-hiding for notifications - keep them visible until manually dismissed */
.alert {
  /* Remove any transition or fade effects that auto-hide */
}

/* Ensure alerts stay visible */
.alert.fade.show {
  opacity: 1 !important;
  display: block !important;
}

/* Keep dismiss button visible and functional */
.alert-dismissible .btn-close {
  padding: 0.75rem 1rem;
  opacity: 0.8;
}

.alert-dismissible .btn-close:hover {
  opacity: 1;
}

/* Print Button Styling */
.btn-outline-secondary:hover {
  background-color: #6c757d;
  border-color: #6c757d;
  color: #fff;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .detail-grid {
    gap: 0.75rem;
  }
  
  .timeline-item {
    padding-left: 2rem;
  }
  
  .timeline-marker {
    left: -0.4rem;
    width: 0.8rem;
    height: 0.8rem;
  }
  
  .timeline-content {
    padding: 0.75rem;
  }
}
