/* ========== Risk Level Cards ========== */
.risk-high { background-color: #fee2e2; border-color: #ef4444; }
.risk-medium { background-color: #fef9c3; border-color: #eab308; }
.risk-low { background-color: #dcfce7; border-color: #22c55e; }
.dark .risk-high { background-color: #450a0a; border-color: #dc2626; }
.dark .risk-medium { background-color: #422006; border-color: #ca8a04; }
.dark .risk-low { background-color: #052e16; border-color: #16a34a; }

/* ========== Traffic Light ========== */
.traffic-light { width: 24px; height: 24px; border-radius: 50%; display: inline-block; }
.light-red { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.light-yellow { background: #eab308; box-shadow: 0 0 8px #eab308; }
.light-green { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.light-off { background: #d1d5db; }
.dark .light-off { background: #4b5563; }

/* ========== Animations ========== */
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-pulse-slow { animation: pulse 2s ease-in-out infinite; }

/* ========== Tab Active ========== */
.tab-active { border-bottom: 2px solid #3b82f6; color: #3b82f6; font-weight: 600; }
.dark .tab-active { color: #60a5fa; border-color: #60a5fa; }

/* ========== WebSocket Indicator ========== */
.ws-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ws-connected { background: #22c55e; box-shadow: 0 0 4px #22c55e; }
.ws-disconnected { background: #ef4444; }

/* ========== Skeleton Loading ========== */
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ========== Toast Notifications ========== */
#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 360px;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ========== Mobile Card Layout ========== */
@media (max-width: 640px) {
  #resultsBody tr { display: flex; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
  .dark #resultsBody tr { border-color: #374151; }
  #resultsBody td { border: none; padding: 2px 8px; }
  #resultsBody td:first-child { width: 100%; font-size: 15px; padding-bottom: 4px; }
  #resultsBody td:not(:first-child) { font-size: 12px; }
  table thead { display: none; }
}

/* ========== Nice Class Selector ========== */
.nice-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}
.nice-class-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
  text-align: center;
}
.nice-class-card:hover {
  border-color: #3b82f6;
  background-color: #eff6ff;
}
.nice-class-card.selected {
  border-color: #3b82f6;
  background-color: #dbeafe;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}
.dark .nice-class-card {
  border-color: #4b5563;
  color: #d1d5db;
}
.dark .nice-class-card:hover {
  border-color: #60a5fa;
  background-color: #1e3a5f;
}
.dark .nice-class-card.selected {
  border-color: #60a5fa;
  background-color: #1e3a5f;
  color: #93c5fd;
}
.nice-preset-btn {
  padding: 4px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.nice-preset-btn:hover {
  background-color: #eff6ff;
  border-color: #3b82f6;
}
.dark .nice-preset-btn {
  border-color: #4b5563;
  color: #d1d5db;
}
.dark .nice-preset-btn:hover {
  background-color: #1e3a5f;
  border-color: #60a5fa;
}

/* ========== Country Selector ========== */
.country-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  user-select: none;
}
.country-card:hover {
  border-color: #3b82f6;
  background-color: #eff6ff;
}
.country-card.selected {
  border-color: #3b82f6;
  background-color: #dbeafe;
  color: #1d4ed8;
}
.dark .country-card {
  border-color: #4b5563;
  color: #d1d5db;
}
.dark .country-card:hover {
  border-color: #60a5fa;
  background-color: #1e3a5f;
}
.dark .country-card.selected {
  border-color: #60a5fa;
  background-color: #1e3a5f;
  color: #93c5fd;
}
.country-select-all-btn {
  padding: 4px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.country-select-all-btn:hover {
  background-color: #eff6ff;
  border-color: #3b82f6;
}
.dark .country-select-all-btn {
  border-color: #4b5563;
  color: #d1d5db;
}
.dark .country-select-all-btn:hover {
  background-color: #1e3a5f;
  border-color: #60a5fa;
}

/* ========== Template Selector ========== */
.template-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  min-width: 160px;
  transition: all 0.15s;
}
.template-card:hover {
  border-color: #3b82f6;
  background-color: #eff6ff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.dark .template-card {
  border-color: #4b5563;
  color: #d1d5db;
}
.dark .template-card:hover {
  border-color: #60a5fa;
  background-color: #1e3a5f;
}
.template-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

/* ========== Action Guide Cards ========== */
.action-guide-card {
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  margin-bottom: 12px;
}
.action-guide-card.action-proceed {
  border-left: 4px solid #22c55e;
  background-color: #f0fdf4;
}
.action-guide-card.action-modify {
  border-left: 4px solid #eab308;
  background-color: #fefce8;
}
.action-guide-card.action-abandon {
  border-left: 4px solid #ef4444;
  background-color: #fef2f2;
}
.dark .action-guide-card {
  border-color: #374151;
}
.dark .action-guide-card.action-proceed {
  border-left-color: #16a34a;
  background-color: #052e16;
}
.dark .action-guide-card.action-modify {
  border-left-color: #ca8a04;
  background-color: #422006;
}
.dark .action-guide-card.action-abandon {
  border-left-color: #dc2626;
  background-color: #450a0a;
}
.action-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.action-tag-proceed { background-color: #dcfce7; color: #166534; }
.action-tag-modify { background-color: #fef9c3; color: #854d0e; }
.action-tag-abandon { background-color: #fee2e2; color: #991b1b; }
.dark .action-tag-proceed { background-color: #052e16; color: #4ade80; }
.dark .action-tag-modify { background-color: #422006; color: #facc15; }
.dark .action-tag-abandon { background-color: #450a0a; color: #f87171; }
.action-steps {
  list-style: decimal;
  padding-left: 20px;
  margin-top: 8px;
  font-size: 14px;
  color: #4b5563;
}
.dark .action-steps { color: #9ca3af; }
.action-steps li { margin-bottom: 4px; }

/* ========== Notes Component ========== */
.note-item {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  position: relative;
}
.dark .note-item {
  border-color: #374151;
}
.note-item .note-time {
  font-size: 11px;
  color: #9ca3af;
}
.note-item .note-delete {
  position: absolute;
  top: 6px;
  right: 8px;
  cursor: pointer;
  color: #9ca3af;
  font-size: 14px;
  transition: color 0.15s;
}
.note-item .note-delete:hover {
  color: #ef4444;
}
.note-input-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.note-input-group input {
  flex: 1;
}

/* ========== Client Management Tab ========== */
.client-card {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: box-shadow 0.15s;
}
.client-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.dark .client-card {
  border-color: #374151;
}
.dark .client-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.client-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 640px) {
  .client-form-grid {
    grid-template-columns: 1fr;
  }
}
.client-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.client-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.client-search-bar input {
  flex: 1;
}
