/* =============================================================
   Doodad Dude POS — phone-damage-widget.css
   Phone Damage Logger & Inspection Tool
   ============================================================= */

:root {
  --pdw-minor: #ffbe2e;
  --pdw-severe: #ff4d4d;
  --pdw-pass: #5be3a0;
  --pdw-fail: #ff6b63;
  --pdw-na: #aebbd0;
  --pdw-ph-btn: #5b708f;
  --pdw-ph-frame: #3a4a63;
  --pdw-ph-frame-edge: #9db4d6;
  --pdw-ph-bezel: #04070f;
  --pdw-ph-screen: #0c1a33;
  --pdw-ph-screen-edge: #2c4368;
  --pdw-ph-glass: #1a2b4a;
  --pdw-ph-bump: #2a3c5c;
  --pdw-ph-lens: #03050b;
  --pdw-ph-lens-ring: #6f89b3;
  --pdw-ph-detail: #9db4d6;
  --pdw-ph-port: #070c18;
  --pdw-ph-text: #b6c6e6;
  --pdw-ph-housing: #0a1222;
}

.pdw-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.pdw-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pdw-card-head h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim, #aab8d6);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pdw-hint {
  font-size: 0.76rem;
  color: var(--text-muted, #7d8db0);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

/* Mat background */
.pdw-mat {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm, 12px);
  padding: 12px 8px;
  background-color: rgba(3, 7, 18, 0.7);
  background-image:
    linear-gradient(rgba(150, 180, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 180, 255, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(0, 122, 255, 0.06);
}

.pdw-phones-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .pdw-phones-grid {
    grid-template-columns: 1fr;
  }
}

.pdw-phone-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pdw-side-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.pdw-side-title {
  font-family: var(--font-display, inherit);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text, #f4f7ff);
}

.pdw-count-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted, #aab8d6);
}

.pdw-count-badge.has {
  background: var(--pdw-minor);
  border-color: var(--pdw-minor);
  color: #241100;
}

.pdw-select {
  width: 100%;
  max-width: 160px;
  margin-bottom: 8px;
  font-size: 0.75rem;
  height: 32px;
  padding: 0 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
}
.pdw-select option {
  background: #0d1530;
  color: #fff;
}

.pdw-phone-svg {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
  overflow: visible;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.pdw-phone-svg [data-zone] {
  cursor: crosshair;
}

.pdw-zone-hi {
  stroke: #fff !important;
  stroke-width: 2.2 !important;
}

.pdw-zone-cap {
  margin-top: 5px;
  min-height: 18px;
  font-size: 0.72rem;
  color: var(--text-muted, #aab8d6);
  text-align: center;
}
.pdw-zone-cap.on {
  color: #fff;
  font-weight: 600;
}

/* SVG Phone elements */
.ph-btn { fill: var(--pdw-ph-btn); }
.ph-frame { fill: var(--pdw-ph-frame); stroke: var(--pdw-ph-frame-edge); stroke-width: 1.5; }
.ph-bezel { fill: var(--pdw-ph-bezel); }
.ph-screen { fill: var(--pdw-ph-screen); stroke: var(--pdw-ph-screen-edge); stroke-width: 0.8; }
.ph-glass { fill: var(--pdw-ph-glass); }
.ph-glare { fill: rgba(255, 255, 255, 0.06); pointer-events: none; }
.ph-detail { fill: var(--pdw-ph-detail); }
.ph-lens { fill: var(--pdw-ph-lens); stroke: var(--pdw-ph-lens-ring); stroke-width: 1.2; }
.ph-lensring { fill: var(--pdw-ph-lens-ring); }
.ph-glint { fill: rgba(255, 255, 255, 0.7); pointer-events: none; }
.ph-homebtn { fill: #050a14; stroke: var(--pdw-ph-detail); stroke-width: 1.5; }
.ph-homeicon { fill: none; stroke: var(--pdw-ph-detail); stroke-width: 1; pointer-events: none; }
.ph-port { fill: var(--pdw-ph-port); stroke: #ff8a2b; stroke-width: 1.3; }
.ph-bump { fill: var(--pdw-ph-bump); stroke: var(--pdw-ph-frame-edge); stroke-width: 1; }
.ph-housing { fill: var(--pdw-ph-housing); }
.ph-flash { fill: #f5e6a8; }
.ph-logo { fill: none; stroke: var(--pdw-ph-detail); stroke-width: 1.2; opacity: 0.5; pointer-events: none; }
.ph-indicator { fill: rgba(255, 255, 255, 0.35); pointer-events: none; }
.ph-text { font: 600 9px var(--font-display, sans-serif); fill: var(--pdw-ph-text); opacity: 0.65; letter-spacing: 0.16em; pointer-events: none; text-anchor: middle; }
.port-label { fill: #ff8a2b; opacity: 0.95; font-size: 8px; }

/* SVG Pins */
.pdw-pin { cursor: pointer; }
.pdw-pin circle { stroke: #fff; stroke-width: 2; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.7)); }
.pdw-pin.minor circle { fill: var(--pdw-minor); }
.pdw-pin.severe circle { fill: var(--pdw-severe); }
.pdw-pin text { font: 700 11px var(--font-display, sans-serif); fill: #fff; pointer-events: none; }
.pdw-pin.minor text { fill: #241100; }
.pdw-pin-in { transform-box: fill-box; transform-origin: center; transition: transform 0.12s; }
.pdw-pin:hover .pdw-pin-in, .pdw-pin.hl .pdw-pin-in { transform: scale(1.28); }
.pdw-pin.new .pdw-pin-in { animation: pdwPop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
.pdw-pin.ghost { pointer-events: none; }
.pdw-pin.ghost circle { fill: rgba(255, 255, 255, 0.18); stroke: #fff; stroke-dasharray: 3 2; filter: none; animation: pdwPulse 1.1s ease-in-out infinite; }
@keyframes pdwPop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes pdwPulse { 50% { opacity: 0.45; } }

/* Legend */
.pdw-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted, #aab8d6);
}
.pdw-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pdw-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; }

/* Damage Log */
.pdw-log-section {
  margin-top: 0.5rem;
}
.pdw-log-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim, #aab8d6);
  margin-bottom: 0.4rem;
}
.pdw-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.pdw-log-empty {
  padding: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xs, 8px);
  color: var(--text-muted, #7d8db0);
  font-size: 0.74rem;
  text-align: center;
}
.pdw-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs, 8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.12s, background 0.12s;
}
.pdw-log-item:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}
.pdw-log-num {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.68rem;
  border: 1.5px solid #fff;
}
.pdw-log-num.minor { background: var(--pdw-minor); color: #241100; }
.pdw-log-num.severe { background: var(--pdw-severe); color: #fff; }
.pdw-log-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
}
.pdw-side-chip {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-right: 4px;
}
.pdw-log-note {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text, #fff);
}
.pdw-log-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted, #aab8d6);
}
.pdw-del-btn {
  flex: none;
  background: transparent;
  border: none;
  color: var(--text-muted, #aab8d6);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: all 0.12s;
}
.pdw-del-btn:hover {
  color: #fff;
  background: var(--pdw-fail);
}

/* Modal inside POS */
.pdw-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 5, 14, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: pdwFade 0.15s;
}
.pdw-modal {
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: var(--radius, 16px);
  padding: 1.25rem;
  background: rgba(14, 22, 48, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: pdwRise 0.18s ease-out;
  color: var(--text, #fff);
}
.pdw-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.75rem;
}
.pdw-modal-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}
.pdw-modal-sub {
  font-size: 0.75rem;
  color: var(--text-muted, #aab8d6);
  margin-top: 2px;
}
.pdw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.pdw-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.pdw-chip:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
}
.pdw-sev-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.pdw-sev-btn {
  height: 38px;
  border-radius: var(--radius-xs, 8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.pdw-sev-btn .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #fff;
}
.pdw-sev-btn[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(61, 134, 255, 0.4);
}
.pdw-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 1.25rem;
}
.pdw-modal-actions .spacer { flex: 1; }

@keyframes pdwFade { from { opacity: 0; } }
@keyframes pdwRise { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
