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

/* ─────────────────────────────────────────────
   Design tokens (Replicados de Figma)
───────────────────────────────────────────── */
:root {
  /* Fonts */
  --font-family: 'Inter', sans-serif;
  
  /* Backgrounds */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-camera-viewfinder: #0f172b;
  --bg-camera-overlay: rgba(15, 23, 43, 0.8);
  --bg-review-card: #eff6ff;
  --bg-disabled: #e2e8f0;

  /* Text & Strokes */
  --text-primary: #0f172b;
  --text-secondary: #45556c;
  --text-tertiary: #314158;
  --text-white: #ffffff;
  --text-placeholder: rgba(255, 255, 255, 0.6);

  /* Accents & Status */
  --color-primary: #155dfc; /* Main interaction */
  --color-primary-dark: #1c398e;
  --color-success: #00a63e; /* Sincronizado, Guardar, Success */
  --color-warning: #f0b100; /* Offline/Pendiente */
  --color-danger: #ef4444; 

  /* Borders */
  --border-light: #e2e8f0;
  --border-medium: #cad5e2;
  --border-review: #bedbff;
  --border-scanner-corners: #2b7fff;

  /* Formas y Gaps */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0px 4px 6px 0px rgba(0,0,0,0.1), 0px 2px 4px 0px rgba(0,0,0,0.1);
  --shadow-md: 0px 10px 15px 0px rgba(0,0,0,0.1), 0px 4px 6px 0px rgba(0,0,0,0.1);
}

/* ─────────────────────────────────────────────
   Reset & base
───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────
   Typography Classes
───────────────────────────────────────────── */
.text-h1 {
  font-size: 48px;
  line-height: 48px;
  font-weight: 700;
  letter-spacing: 0.3516px;
  color: var(--text-primary);
}
.text-title {
  font-size: 36px;
  line-height: 40px;
  font-weight: 700;
  letter-spacing: 0.3691px;
  color: var(--text-primary);
}
.text-subtitle {
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: 0.3955px;
  color: var(--text-primary);
}
.text-body-large {
  font-size: 24px;
  line-height: 32px;
  font-weight: 400;
  letter-spacing: 0.0703px;
  color: var(--text-secondary);
}
.text-body {
  font-size: 20px;
  line-height: 28px;
  font-weight: 400;
  letter-spacing: -0.4492px;
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────
   Layout Wrappers
───────────────────────────────────────────── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0 auto;
  align-items: center; /* Centrar vistas por defecto */
}

/* Las pantallas ocupan todo el ancho y alto disponible debajo de la barra sync */
.screen {
  flex: 1;
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 672px; /* Ancho referencial de Figma = 672px */
  margin-top: 60px; /* Espacio para barra superior */
  animation: fadeIn 0.2s ease;
  padding: 24px 24px 40px 24px;
  gap: 20px;
  position: relative;
}
.screen.active {
  display: flex;
}
/* Algunas vistas (como el scanner) fuerzan Full Width/Background oscuro */
.screen.dark-view {
  max-width: 100%;
  background-color: var(--bg-camera-viewfinder);
  align-items: center;
  margin-top: 0;
  padding-top: 60px; /* La barra queda flotando, empujamos contenido en oscuro */
}

/* ─────────────────────────────────────────────
   Sync Status Bar
───────────────────────────────────────────── */
.sync-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  z-index: 100;
  color: var(--text-white);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.0105px;
}
.sync-bar.online { background-color: var(--color-success); }
.sync-bar.offline { background-color: var(--color-warning); }
.sync-bar.syncing { background-color: var(--color-primary); }
.sync-bar.error { background-color: var(--color-danger); cursor: pointer; }

.sync-bar .sync-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.sync-bar.syncing .sync-icon {
  animation: pulseRotate 1s infinite linear;
}

/* ─────────────────────────────────────────────
   Cards & UI Containers
───────────────────────────────────────────── */
.card-main {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 48px;
}

.review-card {
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}
.review-card-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.review-card-action {
  background: var(--bg-disabled);
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  height: 60px;
}

.review-info-banner {
  background: var(--bg-review-card);
  border: 4px solid var(--border-review);
  border-radius: var(--radius-md);
  padding: 28px 36px;
  font-size: 24px;
  color: var(--text-tertiary);
  width: 100%;
}

/* ─────────────────────────────────────────────
   Forms & Inputs
───────────────────────────────────────────── */
.field-input, select, .dropdown-simulated {
  background: var(--bg-card);
  border: 4px solid var(--border-medium);
  border-radius: var(--radius-md);
  width: 100%;
  height: 88px; /* High touch target proveniente de Figma */
  padding: 0 24px;
  font-size: 24px;
  color: var(--text-primary);
  font-family: var(--font-family);
  appearance: none;
  font-weight: 500;
}
.field-input:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ─────────────────────────────────────────────
   Buttons
───────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, filter 0.2s;
  width: 100%;
  gap: 12px;
}
.btn:active { transform: scale(0.98); }
.btn:hover { filter: brightness(0.95); }

.btn-primary {
  background: var(--color-primary);
  color: var(--text-white);
  border-radius: var(--radius-pill);
  height: 160px; /* Tamaño masivo para Scaner segun Figma. Si se usa en forms, se sobreescribe */
  font-size: 30px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}
.btn-primary.btn-standard {
  height: 72px; /* Standard rect-pill */
  border-radius: var(--radius-md);
  font-size: 24px;
}

.btn-secondary {
  background: var(--text-tertiary);
  color: var(--text-white);
  border-radius: var(--radius-md);
  height: 72px;
  font-size: 20px;
  font-weight: 600;
}

.btn-success {
  background: var(--color-success);
  color: var(--text-white);
  border-radius: var(--radius-md);
  height: 104px;
  font-size: 30px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.btn-disabled {
  background: var(--bg-disabled);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  height: 96px;
  font-size: 24px;
  font-weight: 600;
  pointer-events: none;
}
.btn-disabled-cancel { /* Boton cancelar y volver al inicio */
  background: var(--border-medium);
  color: var(--text-tertiary);
  height: 68px;
  font-size: 20px;
  border-radius: var(--radius-md);
  pointer-events: auto; /* sí sirve */
}

/* ─────────────────────────────────────────────
   Camera & Scanner Specifics
───────────────────────────────────────────── */
.camera-viewfinder-frame {
  position: relative;
  width: 512px;
  height: 682px;
  border: 4px solid var(--text-placeholder);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.camera-viewfinder-frame::before {
  content: "";
  position: absolute; top: -8px; left: -8px; width: 56px; height: 56px;
  border-top: 8px solid var(--border-scanner-corners); border-left: 8px solid var(--border-scanner-corners);
  border-radius: 20px 0 0 0;
}
.camera-viewfinder-frame::after {
  content: "";
  position: absolute; top: -8px; right: -8px; width: 56px; height: 56px;
  border-top: 8px solid var(--border-scanner-corners); border-right: 8px solid var(--border-scanner-corners);
  border-radius: 0 20px 0 0;
}
.camera-corner-bottom-left {
  position: absolute; bottom: -8px; left: -8px; width: 56px; height: 56px;
  border-bottom: 8px solid var(--border-scanner-corners); border-left: 8px solid var(--border-scanner-corners);
  border-radius: 0 0 0 20px;
}
.camera-corner-bottom-right {
  position: absolute; bottom: -8px; right: -8px; width: 56px; height: 56px;
  border-bottom: 8px solid var(--border-scanner-corners); border-right: 8px solid var(--border-scanner-corners);
  border-radius: 0 0 20px 0;
}

.camera-toast {
  background: var(--bg-camera-overlay);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  color: var(--text-white);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

/* ─────────────────────────────────────────────
   Utilities & Common
───────────────────────────────────────────── */
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-center { text-align: center; }
.w-full { width: 100%; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseRotate {
  0% { transform: rotate(0deg); opacity: 1; }
  50% { opacity: 0.6; }
  100% { transform: rotate(360deg); opacity: 1; }
}

/* Success icon large */
.success-icon-large {
  width: 154px;
  height: 154px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────
   Update Toast
───────────────────────────────────────────── */
.update-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-camera-viewfinder);
  color: white;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1000;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
}
.update-toast button {
  background: var(--color-primary);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
