/* ============================================================
   app.css — Área de miembros
   ============================================================ */

:root {
  --cp:   #27AE60;   /* color primario   */
  --cs:   #F39C12;   /* color secundario */
  --cpd:  #1e8449;   /* primario oscuro  */
  --cpl:  #d5f5e3;   /* primario claro   */
  --csl:  #fef9e7;   /* secundario claro */
  --bg:   #f2faf6;
  --text: #2c3e50;
  --mute: #7f8c8d;
  --rad:  16px;
  --rads: 10px;
  --shad: 0 4px 22px rgba(0,0,0,.08);
  --shh:  0 8px 32px rgba(0,0,0,.14);
  --tr:   all .2s ease;
}

/* ─── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.app-body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

/* ─── Hero ──────────────────────────────────────────────────── */
.hero-header {
  background: linear-gradient(140deg, var(--cp) 0%, var(--cpd) 100%);
  color: #fff;
  text-align: center;
  padding: 2.8rem 1.5rem 4.5rem;
  position: relative;
  overflow: hidden;
}
.hero-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.hero-header::after {
  content: '';
  position: absolute;
  bottom: -32px; left: 0; right: 0;
  height: 64px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 64px 64px 0 0;
}

.app-logo {
  width: 80px; height: 80px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  position: relative; z-index: 1;
}
.app-logo-placeholder {
  font-size: 4.2rem;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.2));
  position: relative; z-index: 1;
}
.app-title {
  font-size: 1.9rem; font-weight: 800;
  margin: .6rem 0 0;
  position: relative; z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.app-subtitle {
  font-size: .95rem; opacity: .9;
  margin: .4rem 0 0;
  position: relative; z-index: 1;
}

/* ─── Container ─────────────────────────────────────────────── */
.wrap { max-width: 480px; margin: 0 auto; padding: 0 1rem; }

/* ─── Navbar ────────────────────────────────────────────────── */
.app-bar {
  background: #fff;
  box-shadow: 0 1px 12px rgba(0,0,0,.07);
  padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 200;
}
.app-bar-brand {
  font-weight: 800; font-size: 1.05rem;
  color: var(--cp); text-decoration: none;
  display: flex; align-items: center; gap: .5rem;
}
.app-bar-brand img { width:30px;height:30px;border-radius:8px;object-fit:cover; }

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: var(--rad);
  background: #fff;
  box-shadow: var(--shad);
}
.card-body { padding: 1.5rem; }

/* ─── Coop badge ─────────────────────────────────────────────── */
.coop-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #fff;
  color: var(--cp);
  font-weight: 700; font-size: .9rem;
  padding: .45rem 1.1rem;
  border-radius: 50px;
  box-shadow: var(--shad);
  border: 2px solid var(--cpl);
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border-radius: 50px;
  padding: .65rem 1.6rem;
  transition: var(--tr);
  letter-spacing: .02em;
}
.btn-primary {
  background: var(--cp); border-color: var(--cp); color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--cpd); border-color: var(--cpd);
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(39,174,96,.4);
  color: #fff;
}
.btn-secondary {
  background: var(--cs); border-color: var(--cs); color: #fff;
}
.btn-secondary:hover {
  background: #d68910; border-color: #d68910;
  transform: translateY(-2px); color: #fff;
}
.btn-outline-primary { color: var(--cp); border-color: var(--cp); border-width: 2px; }
.btn-outline-primary:hover { background: var(--cp); border-color: var(--cp); color: #fff; transform: translateY(-2px); }
.btn-outline-secondary { color: var(--mute); border-color: #dee2e6; border-width: 2px; }
.btn-outline-secondary:hover { background: #f8f9fa; color: var(--text); border-color: #dee2e6; }

.btn:disabled { opacity: .6; transform: none !important; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-control, .form-select {
  font-family: 'Nunito', sans-serif;
  border: 2px solid #e9ecef; border-radius: var(--rads);
  padding: .65rem 1rem; font-size: 1rem;
  transition: var(--tr);
}
.form-control:focus, .form-select:focus {
  border-color: var(--cp);
  box-shadow: 0 0 0 3px rgba(39,174,96,.15);
  outline: none;
}
.form-label { font-weight: 700; font-size: .9rem; margin-bottom: .35rem; color: var(--text); }
.input-group-text {
  background: #f8f9fa; border: 2px solid #e9ecef; border-right: none;
  border-radius: var(--rads) 0 0 var(--rads); color: var(--mute);
}
.input-group .form-control { border-left: none; border-radius: 0 var(--rads) var(--rads) 0; }
.input-group .form-control:focus { border-left: none; }

/* ─── PIN Input ──────────────────────────────────────────────── */
.pin-group {
  display: flex; gap: .7rem; justify-content: center; padding: .3rem 0;
}
.pin-box {
  width: 58px; height: 64px;
  text-align: center; font-size: 1.8rem; font-weight: 800;
  border: 3px solid #e9ecef; border-radius: 12px;
  background: #fff; color: var(--text);
  transition: var(--tr); cursor: pointer; outline: none;
  font-family: 'Nunito', sans-serif;
  -webkit-text-security: disc;
  caret-color: var(--cp);
}
.pin-box:focus {
  border-color: var(--cp);
  box-shadow: 0 0 0 3px rgba(39,174,96,.18);
  transform: scale(1.06);
}
.pin-box.has-value { border-color: var(--cp); background: var(--cpl); color: var(--cp); }

/* ─── Product Cards ──────────────────────────────────────────── */
.products-grid { display: flex; flex-direction: column; gap: 1rem; }

.product-card {
  background: #fff; border-radius: var(--rad);
  box-shadow: var(--shad); overflow: hidden;
  display: flex; flex-direction: row;
  transition: var(--tr);
  animation: fadeUp .4s ease both;
}
.product-card:hover { box-shadow: var(--shh); transform: translateY(-2px); }

.product-img {
  width: 110px; min-width: 110px; height: 110px;
  background: linear-gradient(135deg, var(--cpl), var(--csl));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; overflow: hidden; flex-shrink: 0;
}
.product-img img { width:100%; height:100%; object-fit:cover; }

.product-body {
  flex: 1; padding: 1rem;
  display: flex; flex-direction: column; justify-content: space-between;
}
.product-name { font-weight: 800; font-size: 1rem; margin: 0 0 .2rem; }
.product-desc { font-size: .78rem; color: var(--mute); margin: 0 0 .6rem; flex: 1; }
.product-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.product-price { font-size: 1.15rem; font-weight: 800; color: var(--cp); white-space: nowrap; }
.product-unit  { font-size: .7rem; color: var(--mute); font-weight: 600; margin-top: .1rem; }

/* ─── Qty control ────────────────────────────────────────────── */
.qty { display: flex; align-items: center; border: 2px solid #e9ecef; border-radius: 50px; overflow: hidden; }
.qty-btn {
  background: none; border: none; width: 36px; height: 36px;
  font-size: 1.15rem; font-weight: 800; cursor: pointer;
  color: var(--cp); transition: var(--tr);
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: var(--cpl); }
.qty-val { min-width: 32px; text-align: center; font-weight: 800; font-size: .95rem; }

/* ─── Day selector ───────────────────────────────────────────── */
.days-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: .5rem; }
.day-radio { display: none; }
.day-label {
  display: flex; flex-direction: column; align-items: center;
  padding: .7rem .4rem; border: 2px solid #e9ecef; border-radius: 12px;
  cursor: pointer; transition: var(--tr); font-weight: 700; font-size: .82rem;
  color: var(--mute); text-align: center; line-height: 1.3;
}
.day-label .di { font-size: 1.4rem; margin-bottom: .25rem; }
.day-radio:checked + .day-label {
  border-color: var(--cp); background: var(--cpl); color: var(--cp);
}
.day-label:hover { border-color: #b2dfdb; }

/* ─── Cart bar ───────────────────────────────────────────────── */
.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--cp); color: #fff;
  padding: .9rem 1.2rem; display: none;
  align-items: center; justify-content: space-between;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15); z-index: 900;
  transition: var(--tr);
}
.cart-bar.show { display: flex; }
.cart-count { background: var(--cs); color: #fff; width:22px;height:22px;border-radius:50%; display:inline-flex;align-items:center;justify-content:center;font-size:.75rem;font-weight:800; }
.cart-bar-total { font-size: 1.2rem; font-weight: 800; }
.cart-bar-label { font-size: .8rem; opacity: .85; }

/* ─── Status badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .85rem; border-radius: 50px;
  font-size: .78rem; font-weight: 700;
}
.badge-pendiente  { background: #FEF9E7; color: #b7770d; }
.badge-confirmado { background: #EAF4FB; color: #1f618d; }
.badge-en_camino  { background: #FDF2E9; color: #a04000; }
.badge-entregado  { background: #EAFAF1; color: #1d6a39; }
.badge-cancelado  { background: #FDEDEC; color: #922b21; }

/* ─── Order cards ────────────────────────────────────────────── */
.order-card { background:#fff; border-radius:var(--rad); box-shadow:var(--shad); overflow:hidden; margin-bottom:1rem; }
.order-head { padding:1rem; border-bottom:1px solid #f3f3f3; display:flex;justify-content:space-between;align-items:center; }
.order-body { padding:1rem; }
.order-foot { padding:.7rem 1rem; background:#fafafa; border-top:1px solid #f3f3f3; display:flex;justify-content:space-between;align-items:center; }
.order-items { list-style:none; padding:0; margin:0; }
.order-items li { display:flex; justify-content:space-between; font-size:.88rem; padding:.2rem 0; }

/* ─── Alerts ─────────────────────────────────────────────────── */
.alert { border:none; border-radius:var(--rads); font-weight:600; }
.alert-success { background:#d5f5e3; color:#1d6a39; }
.alert-danger   { background:#fdedec; color:#922b21; }
.alert-warning  { background:#fef9e7; color:#b7770d; }
.alert-info     { background:#eaf4fb; color:#1f618d; }

/* ─── Success screen ─────────────────────────────────────────── */
.success-screen { text-align:center; padding:2.5rem 1.5rem; }
.success-icon { font-size:5rem; animation:popIn .5s cubic-bezier(.175,.885,.32,1.275) both; }
.success-title { font-size:1.5rem; font-weight:800; margin:.8rem 0 .4rem; color:var(--cp); }
.success-sub { color:var(--mute); font-size:.95rem; }

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state { text-align:center; padding:3rem 1.5rem; }
.empty-icon  { font-size:4rem; opacity:.4; }

/* ─── Spinner ────────────────────────────────────────────────── */
.spinner { display:inline-block;width:20px;height:20px;border:3px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp  { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:none} }
@keyframes popIn   { from{opacity:0;transform:scale(.7)}        to{opacity:1;transform:scale(1)} }
@keyframes spin    { to{transform:rotate(360deg)} }
@keyframes pulse   { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }

.product-card:nth-child(1){animation-delay:.05s}
.product-card:nth-child(2){animation-delay:.12s}
.product-card:nth-child(3){animation-delay:.19s}
.product-card:nth-child(4){animation-delay:.26s}
.product-card:nth-child(5){animation-delay:.33s}
.product-card:nth-child(6){animation-delay:.4s}

/* ─── Misc ───────────────────────────────────────────────────── */
hr { border-color: #f0f0f0; }
.text-primary-app { color: var(--cp) !important; }
.text-secondary-app { color: var(--cs) !important; }
.fw-800 { font-weight: 800; }
.rounded-pill-custom { border-radius: 50px; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 400px) {
  .pin-box { width:52px;height:58px;font-size:1.5rem; }
  .pin-group { gap:.5rem; }
  .days-grid { grid-template-columns:repeat(2,1fr); }
}
