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

:root {
  --bg:       #F2F2F2;
  --surface:  #FFFFFF;
  --border:   #E0E0E0;
  --text:     #0A0A0A;
  --sub:      #9A9A9A;
  --accent:   #E8251A;
  --input-bg: #FFFFFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg); }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 60px;
  -webkit-font-smoothing: antialiased;
}

/* ── LOADER ── */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#loader h1 {
  font-size: 60px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
}

/* ── HEADER ── */
.header {
  width: 100%;
  padding: 44px 24px 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.header-title {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--sub);
  text-transform: uppercase;
}

.header-brand {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent);
}

/* ── SWITCHES (instalación / IVA) ── */
.switches {
  width: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.switch-row span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sub);
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
}

.switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ── TOGGLE ── */
.option {
  width: calc(100% - 48px);
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  position: relative;
  padding: 4px;
  margin-bottom: 24px;
}

.option .botton {
  position: absolute;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--bg);
  border-radius: 7px;
  border: 1px solid var(--border);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.option p {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--sub);
  z-index: 1;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.option p.active { color: var(--text); }

/* ── FORMS ── */
form {
  width: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.input-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-wrap label {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--sub);
  text-transform: uppercase;
  font-weight: 400;
}

form input {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 300;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.18s;
  -webkit-appearance: none;
}

form input::placeholder {
  color: #C8C8C8;
  font-size: 13px;
  text-transform: none;
}

form input:focus { border-color: #BDBDBD; }

form input[type="number"]::-webkit-inner-spin-button,
form input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

form input.cantidad {
  background: transparent;
  border: none;
  color: var(--sub);
  font-size: 11px;
  padding: 4px 0;
}

/* ── BUTTONS ── */
.btn {
  width: calc(100% - 48px);
  padding: 14px;
  border-radius: 10px;
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.25em;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s, transform 0.12s;
}

.btn:active { transform: scale(0.98); opacity: 0.8; }

.btn-add {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--sub);
  margin-top: 2px;
}

.btn.enviar {
  background: var(--text);
  border: none;
  color: #fff;
  margin-top: 8px;
}

/* ── DIVIDER ── */
.divider {
  width: calc(100% - 48px);
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* ── CART ── */
.cart-label {
  width: calc(100% - 48px);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--sub);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cart {
  width: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.product {
  border-bottom: 1px solid var(--border);
  padding: 13px 0;
  animation: fadeSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.product .flex {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product .flex .descripcion {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
  white-space: normal;
}

.product .flex .medida {
  font-size: 11px;
  color: var(--sub);
  white-space: nowrap;
}

.product .flex .eliminar {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  padding: 4px 0 4px 8px;
}

.empty-cart {
  font-size: 11px;
  color: #C8C8C8;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 20px 0;
}

/* ── CLIENTE (una vez por cotización, fuera de los forms) ── */
.cliente-wrap {
  width: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 18px;
}

.cliente-wrap label {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--sub);
  text-transform: uppercase;
}

.cliente-wrap input,
.product .edit input {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 300;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.18s;
  -webkit-appearance: none;
}

.cliente-wrap input::placeholder,
.product .edit input::placeholder { color: #C8C8C8; text-transform: none; }
.cliente-wrap input:focus,
.product .edit input:focus { border-color: #BDBDBD; }

/* ── EDICIÓN EN LÍNEA DEL CARRITO ── */
.product .flex .editar {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--sub);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  padding: 4px 0 4px 8px;
}

.product .edit {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.product.editing .edit { display: flex; }
.product.editing .flex { display: none; }

.product .edit input { font-size: 13px; padding: 9px 12px; }

.product .edit .row { display: flex; gap: 8px; }

.product .edit .lbl {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--sub);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}

.product .edit .col { flex: 1; }

.product .edit .acciones { display: flex; gap: 8px; margin-top: 2px; }

.product .edit .acciones span {
  flex: 1;
  text-align: center;
  padding: 9px;
  border-radius: 8px;
  font-size: 10px;
  letter-spacing: 0.15em;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s, transform 0.12s;
}

.product .edit .acciones span:active { transform: scale(0.97); opacity: 0.8; }
.product .edit .guardar  { background: var(--text); color: #fff; }
.product .edit .cancelar { background: transparent; border: 1px solid var(--border); color: var(--sub); }
