/* ============================================================
   Servicio Rubí - Portal de Mecánicos CSS
   Optimizado para dispositivos móviles y pantallas táctiles
   ============================================================ */

/* --- Custom Layout Adjustments for Mobile --- */
.mecanico-body {
  padding-bottom: 30px;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.mecanico-header {
  position: sticky;
  top: 0;
  height: 68px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 90;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-title-wrapper {
  display: flex;
  flex-direction: column;
}
.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.header-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Online indicator --- */
.online-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  transition: background-color 0.3s;
}
.online-indicator.offline {
  background-color: var(--text-muted);
  box-shadow: none;
}

/* --- View Structure --- */
.mecanico-main {
  flex: 1;
  padding: 16px;
  position: relative;
}
.mecanico-view {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.mecanico-view.active-view {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- View 1: Login Grid --- */
.view-intro {
  margin-bottom: 24px;
  text-align: center;
}
.view-intro h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.view-intro p {
  color: var(--text-secondary);
  font-size: 13px;
}
.mechanics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 480px) {
  .mechanics-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.mechanic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all var(--transition);
}
.mechanic-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
}
.mech-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ruby), var(--ruby-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--shadow-ruby);
}
.mech-info {
  display: flex;
  flex-direction: column;
}
.mech-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.mech-desig {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- View 2: Dashboard --- */
.dashboard-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.summary-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--ruby-light);
}
.summary-lbl {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.section-title h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- View 3: Order Details --- */
.order-info-card {
  padding: 16px;
  margin-bottom: 16px;
  border-left: 4px solid var(--ruby);
}
.order-info-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.order-code {
  font-size: 16px;
  font-weight: 700;
  color: var(--ruby-light);
}
.order-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}
.order-info-item span:first-child {
  color: var(--text-secondary);
  display: block;
  font-size: 11px;
}
.order-info-item span:last-child {
  font-weight: 600;
}

/* --- Tabs --- */
.mecanico-tabs {
  display: flex;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 0;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}
.tab-btn .material-symbols-rounded {
  font-size: 20px;
}
.tab-btn.active {
  color: var(--ruby-light);
  background: var(--bg-glass-light);
  border-bottom-color: var(--ruby);
}

/* --- Tab Panels --- */
.tab-panel {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  animation: fadeIn 0.2s ease;
}
.tab-panel.active {
  display: block;
}

/* --- Forms & Checklist --- */
.checklist-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 8px;
}
@media (min-width: 400px) {
  .checklist-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  font-size: 13px;
  padding: 6px 0;
}
.checklist-item input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0; width: 0;
}
.checkbox-custom {
  height: 20px;
  width: 20px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}
.checklist-item:hover input ~ .checkbox-custom {
  background-color: var(--bg-card-hover);
}
.checklist-item input:checked ~ .checkbox-custom {
  background-color: var(--ruby-light);
  border-color: var(--ruby-light);
}
.checkbox-custom::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checklist-item input:checked ~ .checkbox-custom::after {
  display: block;
}
.checkbox-label {
  user-select: none;
}

/* --- Photo Upload Grid --- */
.photo-upload-container {
  margin-top: 8px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.photo-thumb-wrapper {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(13, 13, 26, 0.8);
  color: var(--ruby-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border);
}
.photo-delete-btn .material-symbols-rounded {
  font-size: 14px;
}
.photo-upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-size: 12px;
}
.photo-upload-btn:hover {
  border-color: var(--border-active);
  color: var(--ruby-light);
  background: var(--bg-card-hover);
}
.photo-upload-btn .material-symbols-rounded {
  font-size: 28px;
}

/* --- Parts Search & Selection --- */
.parts-search-container {
  position: relative;
}
.parts-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
  box-shadow: var(--shadow-lg);
}
.parts-search-results.open {
  display: block;
}
.part-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.part-result-item:hover {
  background: var(--bg-card-hover);
}
.part-result-meta {
  font-size: 11px;
  color: var(--text-secondary);
}
.requested-parts-list {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.requested-part-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass-light);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.requested-part-name {
  font-weight: 500;
}
.requested-part-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-adjust-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.qty-adjust-btn:hover {
  background: var(--bg-card-hover);
  color: var(--ruby-light);
}
.part-remove-btn {
  color: var(--ruby-light);
  cursor: pointer;
  margin-left: 8px;
  display: flex;
  align-items: center;
}
.part-remove-btn .material-symbols-rounded {
  font-size: 18px;
}

/* --- Range Slider --- */
.range-slider-wrapper {
  margin-top: 10px;
}
.progress-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-input);
  outline: none;
  border: 1px solid var(--border);
}
.progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ruby-light);
  cursor: pointer;
  box-shadow: var(--shadow-ruby);
  transition: transform 0.1s;
}
.progress-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}
.progress-display {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
.progress-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--ruby-light);
  background: var(--ruby-subtle);
  padding: 4px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-active);
}

/* --- Signature Canvas --- */
.signature-container {
  border: 1px solid var(--border);
  background: #000; /* Signature background should be high contrast */
  border-radius: var(--radius-md);
  padding: 4px;
  position: relative;
  overflow: hidden;
  margin-top: 6px;
  touch-action: none; /* Crucial: prevent scrolling when signing */
}
.signature-canvas {
  display: block;
  width: 100%;
  height: 180px;
  background: #000;
  cursor: crosshair;
}
.signature-clear {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(13, 13, 26, 0.85);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
}
.signature-clear:hover {
  color: var(--ruby-light);
  background: var(--ruby-subtle);
}

/* --- Loader Overlay --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 26, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--ruby);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Skeleton Loads --- */
.skeleton-card {
  height: 88px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
@keyframes loading-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Extra Utilities --- */
.mt-3 { margin-top: 12px; }
.mb-4 { margin-bottom: 16px; }
.helper-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.3; }
.btn-block { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; font-weight: 600; }
.hidden { display: none !important; }
.btn-xs { padding: 4px 8px; font-size: 11px; height: auto; display: inline-flex; align-items: center; gap: 4px; }
.btn-xs .material-symbols-rounded { font-size: 14px; }


/* --- Vehicle Diagram --- */
.diagram-section {
  margin-top: 8px;
}
.vehicle-diagram-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  overflow: hidden;
}
.vehicle-diagram {
  width: 100%;
  height: auto;
  display: block;
  max-height: 220px;
}
.diagram-zone {
  fill: transparent;
  cursor: pointer;
  transition: fill 0.15s ease;
}
.diagram-zone:hover {
  fill: rgba(249, 115, 22, 0.12);
}
.diagram-zone-wheel {
  fill: transparent;
}
.zone-label {
  font-size: 7px;
  fill: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  letter-spacing: 0.3px;
  pointer-events: none;
}
/* Markers on SVG */
.diagram-marker-circle {
  fill: var(--ruby-light);
  stroke: var(--bg-card);
  stroke-width: 2;
  cursor: pointer;
  transition: r 0.15s ease;
}
.diagram-marker-circle:hover {
  r: 9;
}
.diagram-marker-num {
  fill: #fff;
  font-size: 8px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
  cursor: pointer;
  pointer-events: none;
}
/* Markers list below diagram */
.diagram-markers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.diagram-marker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-glass-light);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.diagram-marker-item:hover {
  border-color: var(--border-active);
  background: var(--ruby-subtle);
}
.marker-item-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ruby-light);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.marker-item-info {
  flex: 1;
}
.marker-item-zone {
  font-size: 10px;
  color: var(--text-muted);
}

/* --- Diagram Observation Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 26, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  animation: fadeIn 0.15s ease;
  padding: 20px;
}
.diagram-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.diagram-modal-content .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}
.diagram-modal-content .modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}
.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-glass-light);
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
}
.modal-close-btn:hover {
  background: var(--ruby-subtle);
  color: var(--ruby-light);
}
.diagram-modal-content .modal-body {
  padding: 20px;
  overflow-y: auto;
}
.diagram-modal-content .modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.diagram-modal-zone {
  display: inline-block;
  background: var(--ruby-subtle);
  color: var(--ruby-light);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* --- Empty markers state --- */
.diagram-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}
.diagram-empty-state .material-symbols-rounded {
  font-size: 28px;
  opacity: 0.4;
}

/* PIN Pad Styles */
.pin-login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 300px;
  margin: 0 auto;
}
.pin-display input {
  width: 100%;
  text-align: center;
  font-size: 32px;
  letter-spacing: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface-light);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  outline: none;
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}
.pin-btn {
  background: var(--surface-light);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  border-radius: 50%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pin-btn:active {
  background: var(--ruby);
  color: white;
  transform: scale(0.95);
}
.pin-clear { color: var(--danger); font-size: 20px; }
.pin-submit { background: var(--ruby-subtle); color: var(--ruby); }
.pin-submit:active { background: var(--ruby); color: white; }
