/* ==================================================
   E-MIR Platform - Component Styles
   Reusable component-specific styles
   ================================================== */

/* ========== Toast Notifications ========== */
.toast-container {
  position: fixed !important;
  top: 80px !important; /* Below header which is 60px */
  right: 20px !important;
  z-index: 10000 !important; /* Above everything including modals (1055) and header */
  pointer-events: none;
}

.toast-container .toast {
  pointer-events: auto;
  min-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: none;
}

.toast.show {
  display: block;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.z-9999 {
  z-index: 9999 !important;
}

/* ========== Upload Wizard Process Flow ========== */
.process-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.process-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.step-icon.step-1 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
}

.step-icon.step-2 {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border-color: #f093fb;
}

.step-icon.step-3 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  border-color: #4facfe;
}

.step-icon.step-4 {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: white;
  border-color: #43e97b;
}

.step-content {
  flex: 1;
  padding-bottom: 0.5rem;
}

.step-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.step-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.step-connector {
  width: 2px;
  height: 24px;
  background: linear-gradient(to bottom, var(--border-color) 0%, transparent 100%);
  margin-left: 19px; /* Center with icon (40px / 2 - 1px) */
}

.progress-20 {
  height: 20px;
}

.progress-upload {
  height: 25px;
}

.result-item {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ========== Table Width Utilities ========== */
.w-60px {
  width: 60px;
}

.w-200px {
  width: 200px;
}

.w-50px {
  width: 50px;
}

/* ========== User Profile Dropdown ========== */
.user-profile-dropdown {
  position: relative;
}

.user-profile-dropdown .dropdown-menu {
  min-width: 250px;
  right: 0;
  left: auto;
  position: absolute;
  top: 100%;
  margin-top: 0.125rem;
}

.user-profile-dropdown .dropdown-menu.show {
  display: block;
}

.user-profile-dropdown .dropdown-header {
  padding: 0.75rem 1rem;
}

.user-profile-dropdown .dropdown-item.text-danger:hover {
  background-color: #dc3545;
  color: white !important;
}

/* ========== Badge Sizes ========== */
.badge-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.badge-lg {
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
}

/* ========== ROI Editor & Image Enhancement ========== */
.roi-editor-container canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: block;
}

/* ========== Loading & Empty States ========== */
.empty-state {
  padding: 3rem 1rem;
  text-center;
}

.empty-state-icon {
  font-size: 4rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.loading-spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* ========== Routing Rules ========== */
.rules-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rule-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  background: white;
  transition: all 0.2s;
}

.rule-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.rule-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
}

.rule-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ========== Transaction Upload ========== */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
  background: var(--bg-secondary);
  transition: all 0.3s;
  cursor: pointer;
}

.upload-zone:hover {
  border-color: var(--primary-color);
  background: var(--bg-primary);
}

.upload-zone.dragover {
  border-color: var(--primary-color);
  background: rgba(0, 85, 111, 0.05);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

/* ========== Transaction Results & Review ========== */
.transaction-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  background: white;
  transition: all 0.2s;
  margin-bottom: 1rem;
}

.transaction-card:hover {
  box-shadow: var(--shadow-md);
}

.transaction-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.ocr-result-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin: 0.75rem 0;
}

.ocr-plate-display {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 0.75rem;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  margin: 0.5rem 0;
}

/* ========== Queue Assignments ========== */
.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.assignment-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  background: white;
  transition: all 0.2s;
}

.assignment-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.assignment-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

/* ========== Supervisor Conflict Resolution ========== */
.conflict-container {
  max-width: 1400px;
  margin: 0 auto;
}

.reviewer-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

.reviewer-card {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  background: white;
}

.reviewer-card.selected {
  border-color: var(--primary-color);
  background: rgba(0, 85, 111, 0.05);
}

.mismatch-indicator {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 0.75rem;
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mismatch-indicator i {
  color: #ff6b00;
  font-size: 1.25rem;
}

/* ========== Agency Details ========== */
.agency-overview {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  color: white;
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.agency-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.agency-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1.25rem;
  backdrop-filter: blur(10px);
}

.agency-stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.agency-stat-label {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* ========== Select Modal ========== */
.select-modal-body {
  max-height: 500px;
  overflow-y: auto;
}

.selectable-item {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.selectable-item:hover {
  border-color: var(--primary-color);
  background: rgba(0, 85, 111, 0.05);
}

.selectable-item.selected {
  border-color: var(--primary-color);
  border-width: 2px;
  background: rgba(0, 85, 111, 0.1);
}

/* ========== Error Pages ========== */
.error-container {
  min-height: 100vh;
  background-color: #f8f9fa;
}

.error-alert-box {
  max-width: 600px;
}

.error-404-container {
  font-size: 3rem;
  color: var(--text-light);
}

.error-404-icon {
  font-size: 4rem;
  color: var(--warning-color);
}

.error-details-summary {
  cursor: pointer;
}

.error-stacktrace {
  font-size: 0.85rem;
  max-height: 400px;
  overflow: auto;
}

/* ========== Responsive Utilities ========== */
@media (max-width: 768px) {
  .reviewer-comparison {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .agency-stats-grid {
    grid-template-columns: 1fr;
  }

  .transaction-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}
