/**
 * CNC Forge — Order Modal + Gallery Styles
 * PRD: docs/PRD/PRD-CNC-FORGE.md
 */

/* ═══════════════════════════════════════════════════════════════════════════
   ORDER MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.cnc-forge-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cnc-forge-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.cnc-forge-modal__content {
  position: relative;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  max-height: calc(100vh - 48px - var(--safe-top, 0px) - var(--safe-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cnc-forge-modal__content h2 {
  margin: 0 0 16px 0;
  font-size: 1.4rem;
  color: #fff;
  text-align: center;
}

.cnc-forge-modal__preview {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.cnc-forge-modal__preview img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid #333;
  object-fit: cover;
  background: #0d0d0d;
}

.cnc-forge-modal__no-preview {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px dashed #444;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 0.9rem;
}

.cnc-forge-modal__details {
  text-align: center;
  margin-bottom: 16px;
}

.cnc-forge-modal__details p {
  margin: 4px 0;
  color: #ccc;
}

.cnc-forge-modal__details strong {
  color: #fff;
  font-size: 1.1rem;
}

.cnc-forge-modal__hash {
  font-size: 0.75rem;
  color: #888;
}

.cnc-forge-modal__hash code {
  font-family: 'JetBrains Mono', monospace;
  background: #222;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Calibration stage badges */
.cnc-forge-stage {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.cnc-forge-stage--raw {
  background: #333;
  color: #999;
}

.cnc-forge-stage--zeroed {
  background: #2d3a2d;
  color: #6a9;
}

.cnc-forge-stage--field_verified {
  background: #3a3a2d;
  color: #a96;
}

.cnc-forge-stage--trued {
  background: #2d3a3a;
  color: #6aa;
}

.cnc-forge-modal__options {
  margin-bottom: 16px;
  padding: 12px;
  background: #222;
  border-radius: 8px;
}

.cnc-forge-modal__options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
  cursor: pointer;
}

.cnc-forge-modal__options input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4ecdc4;
}

.cnc-forge-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.cnc-forge-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cnc-forge-btn--cancel {
  background: #333;
  color: #ccc;
}

.cnc-forge-btn--cancel:hover {
  background: #444;
}

.cnc-forge-btn--submit {
  background: linear-gradient(135deg, #4ecdc4, #3db8b0);
  color: #000;
}

.cnc-forge-btn--submit:hover {
  background: linear-gradient(135deg, #5dd9d0, #4ecdc4);
  transform: translateY(-1px);
}

.cnc-forge-btn--submit:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
  transform: none;
}

.cnc-forge-modal__note {
  margin-top: 16px;
  font-size: 0.75rem;
  color: #666;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CNC ORDER BUTTON (Desktop)
   ═══════════════════════════════════════════════════════════════════════════ */

.cnc-order-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #4ecdc4, #3db8b0);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cnc-order-btn:hover {
  background: linear-gradient(135deg, #5dd9d0, #4ecdc4);
  transform: translateY(-1px);
}

.cnc-order-btn:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GALLERY CARD (for future gallery view)
   ═══════════════════════════════════════════════════════════════════════════ */

.gallery-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s ease;
}

.gallery-card:hover {
  border-color: #4ecdc4;
}

.gallery-card__thumb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: #0d0d0d;
}

.gallery-card__name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.gallery-card__platform {
  font-size: 0.85rem;
  color: #999;
  margin: 0;
}

.gallery-card__creator {
  font-size: 0.75rem;
  color: #666;
}

.gallery-card__actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.gallery-card__btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.gallery-card__btn--clone {
  background: #4ecdc4;
  color: #000;
}

.gallery-card__btn--view {
  background: #333;
  color: #ccc;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GALLERY BROWSER (Mobile)
   ═══════════════════════════════════════════════════════════════════════════ */

.gallery-browser {
  padding: 16px;
  background: #0d0d0d;
  min-height: 100%;
}

.gallery-browser__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.gallery-browser__title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.gallery-browser__refresh {
  background: transparent;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 8px;
  color: #999;
  cursor: pointer;
}

.gallery-browser__refresh:active {
  background: #222;
}

.gallery-browser__filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gallery-filter {
  flex-shrink: 0;
  padding: 8px 14px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 20px;
  color: #999;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-filter.active {
  background: #4ecdc4;
  border-color: #4ecdc4;
  color: #000;
}

.gallery-browser__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.gallery-browser__loading,
.gallery-browser__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.gallery-browser__empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.gallery-browser__empty-text {
  font-size: 0.9rem;
}

/* Gallery Card (compact mobile version) */
.gallery-browser .gallery-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-card__thumb-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

.gallery-browser .gallery-card__thumb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: #0d0d0d;
}

.gallery-card__thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2px dashed #333;
}

.gallery-card__category {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 1rem;
}

.gallery-card__info {
  text-align: center;
}

.gallery-browser .gallery-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-browser .gallery-card__platform {
  font-size: 0.75rem;
  color: #999;
  margin: 0 0 4px 0;
}

.gallery-browser .gallery-card__creator {
  font-size: 0.7rem;
  color: #666;
  margin: 0 0 8px 0;
}

.gallery-card__stage {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

.gallery-browser .gallery-card__actions {
  margin-top: auto;
}

.gallery-browser .gallery-card__btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.gallery-browser .gallery-card__btn--clone {
  background: #4ecdc4;
  color: #000;
}

.gallery-browser .gallery-card__btn--view {
  background: #333;
  color: #ccc;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENHANCED ORDER MODAL ELEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

.cnc-forge-modal__intro {
  font-size: 0.9rem;
  color: #999;
  margin: 0 0 16px 0;
  text-align: center;
}

.cnc-forge-modal__stage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 8px 0;
}

.cnc-forge-modal__hint {
  font-size: 0.8rem;
  color: #4ecdc4;
  margin: 8px 0 0 0;
  padding: 8px 12px;
  background: rgba(78, 205, 196, 0.1);
  border-radius: 6px;
  text-align: center;
}

.cnc-forge-modal__hint--warn {
  color: #f0ad4e;
  background: rgba(240, 173, 78, 0.1);
}

.cnc-forge-modal__hash-section {
  margin: 16px 0;
  padding: 12px;
  background: #111;
  border-radius: 8px;
  text-align: center;
}

.cnc-forge-modal__hash-label {
  font-size: 0.85rem;
  color: #999;
  margin: 0 0 8px 0;
}

.cnc-forge-modal__hash {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: #4ecdc4;
  background: #000;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px auto;
}

.cnc-forge-modal__hash-hint {
  font-size: 0.75rem;
  color: #666;
  margin: 8px 0 0 0;
}

.cnc-forge-modal__checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
}

.cnc-forge-modal__checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4ecdc4;
}

.cnc-forge-modal__checkbox span {
  font-size: 0.9rem;
  color: #ccc;
}

.cnc-forge-modal__footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #333;
}

.cnc-forge-modal__footer p {
  font-size: 0.8rem;
  color: #666;
  margin: 4px 0;
  text-align: center;
}
