/* App de Seguimiento JSL — Estilos Premium (Móvil-First, Glassmorphism) */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #1e1b4b 100%);
  --navy-dark: #0f172a;
  --navy-light: #1e293b;
  --terra: #c7522a;
  --terra-hover: #b0431e;
  --crema: #fdfaf6;
  --gold: #eab308;
  --success: #10b981;
  --error: #ef4444;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-glass: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --bg-glass-active: rgba(30, 41, 59, 0.8);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Contenedor Principal */
.app-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Cabecera */
header {
  text-align: center;
  margin-bottom: 24px;
  padding: 10px 0;
}

header .logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
}

header .logo span {
  color: var(--terra);
}

header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tarjeta Glassmorphism */
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-premium);
  margin-bottom: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-glass:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Formularios */
.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-main);
  font-size: 16px;
  outline: none;
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--terra);
  background: rgba(30, 41, 59, 0.7);
  box-shadow: 0 0 0 3px rgba(199, 82, 42, 0.25);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  background: var(--terra);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 8px;
  text-decoration: none;
}

.btn:hover {
  background: var(--terra-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: var(--success);
}
.btn-success:hover {
  background: #0d9488;
}

.btn-accent {
  background: var(--gold);
  color: #0b0f19;
}
.btn-accent:hover {
  background: #ca8a04;
}

/* Teclado PIN */
.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 20px auto 0;
}

.pin-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pin-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.pin-btn:active {
  background: var(--terra);
  border-color: var(--terra);
  transform: scale(0.92);
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  transition: all 0.15s ease;
}

.pin-dot.active {
  background: var(--terra);
  border-color: var(--terra);
  box-shadow: 0 0 10px var(--terra);
}

/* Vistas de la aplicación */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Temporizador */
.timer-container {
  text-align: center;
  padding: 10px 0;
  margin-bottom: 20px;
}

.timer-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 8px 24px;
  border-radius: 30px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.timer-box.inactive {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-glass);
  box-shadow: none;
}

.timer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.5s infinite;
}

.timer-box.inactive .timer-dot {
  background: var(--text-muted);
  animation: none;
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

/* Autocompletado de Materiales */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-items {
  position: absolute;
  border: 1px solid var(--border-glass);
  border-top: none;
  z-index: 99;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--navy-light);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  max-height: 150px;
  overflow-y: auto;
  box-shadow: var(--shadow-premium);
}

.autocomplete-items div {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.autocomplete-items div:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.material-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.material-tag {
  background: rgba(199, 82, 42, 0.12);
  border: 1px solid rgba(199, 82, 42, 0.3);
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.material-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
}

.material-tag button:hover {
  color: var(--error);
}

/* Carga de Imágenes */
.image-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.image-upload-box {
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-md);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.image-upload-box:hover {
  border-color: var(--terra);
  background: rgba(255, 255, 255, 0.06);
}

.image-upload-box span.icon {
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.image-upload-box span.text {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
}

.image-upload-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.image-upload-box .delete-img {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 2;
}

/* Firma Digital y Canvas */
.canvas-wrapper {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 8px;
  touch-action: none;
}

.signature-canvas {
  width: 100%;
  height: 180px;
  display: block;
  background: transparent;
  cursor: crosshair;
}

.canvas-controls {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.5);
  border-top: 1px solid var(--border-glass);
}

/* Valoración con Estrellas */
.stars-rating {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 20px;
}

.star {
  font-size: 32px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.star:hover, .star.selected {
  color: var(--gold);
  transform: scale(1.15);
}

/* Vista Cliente y Comparador de Fotos */
.gallery-compare {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px 0;
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compare-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.compare-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.8);
  letter-spacing: 0.5px;
  text-align: center;
}

.compare-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

/* Mensajes de feedback / Notificaciones */
.notification {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  display: none;
}

.notification.success {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.notification.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Lista de obras / reporte admin */
.admin-table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

table.admin-table th, table.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
}

table.admin-table th {
  background: rgba(15, 23, 42, 0.8);
  font-weight: 700;
  color: #fff;
}

table.admin-table td {
  background: rgba(15, 23, 42, 0.3);
}

table.admin-table tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-badge.working {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-badge.paused {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
}

.status-badge.off {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

.badge-materials {
  background: rgba(199, 82, 42, 0.12);
  color: #fff;
  border: 1px solid rgba(199, 82, 42, 0.25);
  border-radius: 4px;
  padding: 1px 4px;
  margin-right: 4px;
  font-size: 12px;
}

/* Consentimiento RGPD Checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--terra);
  cursor: pointer;
}

.checkbox-group label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}

.checkbox-group label a {
  color: var(--terra);
  text-decoration: none;
}
.checkbox-group label a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (min-width: 500px) {
  body {
    padding: 20px 0;
  }
}
