/* Breast Wizard Specific Styles */

/* Composition Selector */
.composition-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.composition-option {
  cursor: pointer;
  position: relative;
}

.composition-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.composition-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.08), rgba(15, 23, 42, 0.9));
  transition: all 0.2s ease;
  min-height: 100px;
}

.composition-option:hover .composition-card {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.4);
}

.composition-option input[type="radio"]:checked + .composition-card {
  border-color: rgba(59, 130, 246, 0.8);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.15));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.composition-letter {
  font-size: 2.5rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 8px;
  line-height: 1;
}

.composition-option input[type="radio"]:checked + .composition-card .composition-letter {
  color: #60a5fa;
}

.composition-label {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.85);
  text-align: center;
  line-height: 1.3;
}

.app-workflow {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 0;
}

.app-container {
  position: relative;
  width: min(1500px, 100%);
  max-width: 1500px;
  margin: 0 auto;
}

.app-workflow > .panel {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

@media (max-width: 1200px) {
  .app-workflow {
    grid-template-columns: 1fr;
  }
}

/* Technique Section */
.technique-section {
  margin-top: 20px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.technique-section h3 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: #f8fafc;
}

.technique-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.technique-options select {
  width: 100%;
}

.view-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}

.laterality-options {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Breast Map */
.breast-map-cell {
  grid-area: map;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  position: relative;
  height: 100%;
  min-height: 520px;
}

.breast-map-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  height: 100%;
  padding: 24px 28px 32px;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.75));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
}

.breast-map {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 3;
  max-width: 580px;
  margin-top: 12px;
  user-select: none;
}

.map-location-display {
  width: clamp(260px, 60%, 360px);
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.9);
  font-weight: 600;
  text-align: center;
}

.map-instructions {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.85);
  text-align: center;
  max-width: 600px;
  width: 100%;
}

.map-instructions strong {
  color: #60a5fa;
  font-weight: 600;
}

.breast-clock {
  opacity: 0.45;
  pointer-events: none;
}

.breast-clock-hour {
  stroke: rgba(248, 250, 252, 0.7);
  stroke-width: 1.5;
  stroke-dasharray: 5 6;
}

.breast-clock-number {
  fill: rgba(248, 250, 252, 0.65);
  font-size: 16px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.breast-region {
  cursor: pointer;
  transition: opacity 0.2s ease, filter 0.2s ease;
  opacity: 0.65;
}

.nodule-context-menu {
  position: absolute;
  z-index: 40;
  display: none;
  min-width: 160px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(12px);
  width: max-content;
  max-width: 240px;
}

.nodule-context-menu[aria-hidden="false"] {
  display: block;
}

.nodule-context-menu button {
  width: 100%;
  padding: 10px;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  color: rgba(226, 232, 240, 0.9);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  text-align: left;
}

.nodule-context-menu button + button {
  margin-top: 8px;
}

.nodule-context-menu button:hover {
  background: rgba(148, 163, 184, 0.2);
  transform: translateY(-1px);
}

.nodule-context-menu button.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.nodule-context-menu button.danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

.nodule-context-options {
  display: grid;
  gap: 8px;
}

.admin-panel {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 60;
}

.admin-panel[hidden] {
  display: none;
}

.admin-panel-content {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  width: min(520px, 100%);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.55);
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-panel-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.75);
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.85);
}

.admin-field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
  color: rgba(226, 232, 240, 0.9);
  resize: vertical;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.admin-actions .primary,
.admin-actions .secondary {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  cursor: pointer;
  font-weight: 600;
}

.admin-actions .primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-color-strong));
  color: #f8fafc;
  border-color: transparent;
}

.admin-actions .primary:hover {
  filter: brightness(1.05);
}

.admin-actions .secondary {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(226, 232, 240, 0.9);
}

.admin-actions .secondary:hover {
  background: rgba(148, 163, 184, 0.18);
}

/* Lesion List */
.lesion-list-cell {
  grid-area: list;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lesion-list-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  padding: 18px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.36);
  min-height: 0;
  overflow: hidden;
}

.lesion-list-container h3 {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.lesion-type-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.lesion-tab {
  flex: 1 1 0;
  min-width: 120px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.12), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  color: rgba(226, 232, 240, 0.7);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.lesion-tab:hover {
  color: rgba(226, 232, 240, 0.95);
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.18), rgba(15, 23, 42, 0.85));
  border-color: rgba(148, 163, 184, 0.5);
  transform: translateY(-1px);
}

.lesion-tab.active {
  color: #f8fafc;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-color-strong));
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.lesion-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  margin-bottom: 12px;
}

.lesion-list-empty {
  color: rgba(226, 232, 240, 0.5);
  font-size: 0.85rem;
  text-align: center;
  padding: 20px;
}

.lesion-pill {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.12), rgba(15, 23, 42, 0.8));
  cursor: pointer;
}

.lesion-pill-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lesion-pill:hover {
  border-color: rgba(148, 163, 184, 0.5);
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.18), rgba(15, 23, 42, 0.85));
}

.lesion-pill-delete {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(248, 113, 113, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  font-size: 16px;
  line-height: 1;
}

.lesion-pill-delete-icon {
  pointer-events: none;
}

.lesion-pill-delete:hover {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
}

.lesion-pill.selected[data-lesion-type="mass"] {
  border-color: rgba(239, 68, 68, 0.6) !important;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(185, 28, 28, 0.15)) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

.lesion-pill.selected[data-lesion-type="calcification"] {
  border-color: rgba(234, 179, 8, 0.6) !important;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(161, 98, 7, 0.15)) !important;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2) !important;
}

/* Fallback for selected without type */
.lesion-pill.selected {
  border-color: rgba(148, 163, 184, 0.6);
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.25), rgba(71, 85, 105, 0.15));
}

.lesion-pill-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.lesion-pill-detail {
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.7);
}

/* Lesion Detail */
.lesion-detail-cell {
  grid-area: detail;
  max-width: 180px;
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lesion-detail {
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.4);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lesion-detail[data-has-selection="false"] #lesion-detail-body {
  display: none;
}

.lesion-detail[data-has-selection="false"] #lesion-detail-empty {
  display: block;
}

#lesion-detail-empty {
  display: none;
  color: rgba(226, 232, 240, 0.6);
  font-size: 0.95rem;
  text-align: center;
  padding: 40px 20px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-section label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-section label > span {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.85);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.detail-header h3 {
  margin: 0;
  font-size: 1rem;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: rgba(226, 232, 240, 0.7);
}

.icon-btn:hover {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.5);
  transform: translateY(-1px);
}

.icon-btn.danger {
  color: #f87171;
}

.icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* BI-RADS Selector */
.birads-selector {
  margin-bottom: 24px;
}

.birads-selector h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  color: #f8fafc;
}

.birads-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}

.birads-option {
  cursor: pointer;
  position: relative;
}

.birads-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.birads-option.disabled .birads-card {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.birads-option.hidden {
  display: none;
}

.birads-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.08), rgba(15, 23, 42, 0.9));
  transition: all 0.2s ease;
  min-height: 90px;
}

.birads-option:hover .birads-card {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.4);
}

.birads-option input[type="radio"]:checked + .birads-card {
  border-color: rgba(59, 130, 246, 0.8);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.15));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.birads-number {
  font-size: 2rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 6px;
  line-height: 1;
}

.birads-option input[type="radio"]:checked + .birads-card .birads-number {
  color: #60a5fa;
}

.birads-card[data-birads="0"] .birads-number {
  color: #fbbf24;
}

.birads-card[data-birads="1"] .birads-number,
.birads-card[data-birads="2"] .birads-number {
  color: #4ade80;
}

.birads-card[data-birads="3"] .birads-number {
  color: #facc15;
}

.birads-card[data-birads="4"] .birads-number,
.birads-card[data-birads="5"] .birads-number {
  color: #f97316;
}

.birads-card[data-birads="6"] .birads-number {
  color: #f87171;
}

.birads-label {
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.85);
  text-align: center;
  line-height: 1.3;
}

/* Auto-suggested BI-RADS glow animation */
.birads-option.suggested .birads-card {
  animation: birads-glow 2s ease-in-out infinite;
  border-color: rgba(34, 197, 94, 0.6);
}

@keyframes birads-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.3),
                0 0 10px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
  }
  50% {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4),
                0 0 15px rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.7);
  }
}

.birads-option.suggested .birads-card .birads-number {
  color: #4ade80;
  animation: number-pulse 2s ease-in-out infinite;
}

@keyframes number-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* When selected, override the suggestion animation */
.birads-option.suggested input[type="radio"]:checked + .birads-card {
  animation: none;
  border-color: rgba(59, 130, 246, 0.8);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.15));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.birads-option.suggested input[type="radio"]:checked + .birads-card .birads-number {
  animation: none;
  color: #60a5fa;
}

/* Impression Options */
.impression-options {
  margin-top: 20px;
}

.impression-options h3 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: #f8fafc;
}

.impression-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

/* Breast Grid Layout */
.breast-grid {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr minmax(160px, 180px);
  grid-template-rows: auto;
  grid-template-areas: "list map detail";
  gap: 12px;
  align-items: stretch;
  flex: 1;
  height: 100%;
  min-height: 0;
}

@media (max-width: 1200px) {
  .breast-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "list"
      "detail";
  }

  .composition-selector {
    grid-template-columns: repeat(2, 1fr);
  }

  .birads-options {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .composition-selector {
    grid-template-columns: 1fr;
  }

  .birads-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .view-checkboxes {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Live Transcription Display */
.live-transcription {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
  margin: 8px 16px;
  max-height: 60px;
  overflow: hidden;
}

.transcription-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.transcription-label {
  font-weight: 600;
  color: rgba(96, 165, 250, 0.9);
  flex-shrink: 0;
}

.transcription-text {
  color: rgba(226, 232, 240, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
