@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --brand: #ff0474;
  --brand-soft: #c9567d;
  --brand-light: #ff4d9a;
  --dark: #1e293b;
  --gray: #64748b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --header-h: 64px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --fyop-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='110' viewBox='0 0 200 110'%3E%3Cg fill='%23ffffff' fill-opacity='0.55' font-family='Arial,sans-serif' font-size='12' font-weight='700' transform='rotate(-32 100 55)'%3E%3Ctext x='-30' y='30'%3EFYOP - Imagen de muestra%3C/text%3E%3Ctext x='-30' y='58'%3EFYOP - Imagen de muestra%3C/text%3E%3Ctext x='-30' y='86'%3EFYOP - Imagen de muestra%3C/text%3E%3C/g%3E%3C/svg%3E");
  --fyop-watermark-alt: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='110' viewBox='0 0 200 110'%3E%3Cg fill='%23ffffff' fill-opacity='0.28' font-family='Arial,sans-serif' font-size='11' font-weight='700' transform='rotate(28 100 55)'%3E%3Ctext x='-20' y='40'%3EFYOP%3C/text%3E%3Ctext x='-20' y='72'%3EFYOP%3C/text%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--dark);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

body.app-authenticated {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

a { color: var(--brand-soft); }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--header-h);
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-logo { height: 36px; width: auto; }

.header-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  margin: 0;
  font-size: 0.72rem;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:active { background: var(--bg); }

.app-main {
  flex: 1;
  padding: 16px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.view[hidden] { display: none !important; }

.section-head { margin-bottom: 16px; }
.section-head h2 { margin: 0 0 4px; font-size: 1.35rem; }
.muted { color: var(--gray); font-size: 0.9rem; margin: 0; }

.login-card {
  margin-top: 24px;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--bg);
  border-radius: 12px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--gray);
  cursor: pointer;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--brand-soft);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 420px) {
  .field-row { grid-template-columns: 1fr; }
}

.role-field {
  margin: 0 0 14px;
}

.role-field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.role-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 0.9rem;
  cursor: pointer;
}

.role-option input[type="radio"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand-soft);
}

.role-option span {
  line-height: 1.2;
}

.protected-photo {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}

.field input:focus {
  outline: none;
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(255, 4, 116, 0.12);
}

.btn-secondary[hidden],
.btn-text[hidden],
.btn-primary[hidden],
.load-hint[hidden],
.load-status[hidden] {
  display: none !important;
}

.btn-primary,
.btn-secondary,
.btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
}

.btn-primary {
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-soft), var(--brand-light));
  box-shadow: 0 6px 18px rgba(201, 86, 125, 0.28);
}

.btn-secondary {
  padding: 12px 16px;
  margin-top: 12px;
  color: var(--dark);
  background: var(--surface);
  border: 1px solid var(--border);
}

.btn-text {
  width: auto;
  padding: 8px 4px;
  background: none;
  color: var(--brand-soft);
}

.btn-sm { width: auto; padding: 10px 16px; font-size: 0.85rem; }

.btn-primary:active,
.btn-secondary:active { transform: scale(0.98); }

.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.form-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin: 0 0 12px;
}

.login-foot { margin-top: 18px; text-align: center; font-size: 0.85rem; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 540px) {
  .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.album-card {
  border: none;
  padding: 0;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  position: relative;
}

.album-card--upcoming {
  cursor: not-allowed;
  opacity: 0.88;
}

.album-card--upcoming:active {
  transform: none;
}

.album-cover {
  aspect-ratio: 4 / 5;
  background-color: #f1f5f9;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  position: relative;
}

.album-card--upcoming .album-cover {
  filter: grayscale(0.4) brightness(0.72);
}

.album-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.load-more-zone {
  padding: 12px 0 28px;
  text-align: center;
}

.load-hint {
  margin: 0 0 10px;
  font-size: 0.82rem;
}

.scroll-sentinel {
  width: 100%;
  height: 2px;
  pointer-events: none;
}

.load-status {
  margin: 8px 0;
  padding: 12px;
}

.album-card:not(.album-card--upcoming):active { transform: scale(0.98); }

.album-body { padding: 10px 12px 12px; }

.album-body h3 {
  margin: 0 0 4px;
  font-size: 0.88rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.album-body p { margin: 0; font-size: 0.75rem; color: var(--gray); }

.folder-list { display: flex; flex-direction: column; gap: 10px; }

.folder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.folder-item:active { background: var(--bg); }

.folder-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 4, 116, 0.1);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-item h3 {
  margin: 0 0 2px;
  font-size: 0.95rem;
}

.folder-item p { margin: 0; font-size: 0.78rem; color: var(--gray); }

.photos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 540px) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}

.photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #cbd5e1;
  cursor: pointer;
}

.photo-cell.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(255, 4, 116, 0.25);
}

.photo-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0f172a;
  overflow: hidden;
}

.photo-bg {
  position: absolute;
  inset: 0;
  background: center/cover no-repeat #cbd5e1;
  pointer-events: none;
}

.watermark-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
}

.watermark-layer-a {
  background-image: var(--fyop-watermark);
  background-size: 180px 100px;
  opacity: 1;
}

.watermark-layer-b {
  background-image: var(--fyop-watermark-alt);
  background-size: 160px 90px;
  opacity: 1;
}

.watermark-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 35%, rgba(15, 23, 42, 0.18) 100%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.12));
}

.watermark-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  padding: 6px 14px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.photo-shield {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  -webkit-touch-callout: none;
}

.photo-check {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  padding: 0;
}

.photo-cell.selected .photo-check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

body.lightbox-open {
  overflow: hidden;
}

body.lightbox-open .bottom-nav,
body.lightbox-open .app-header,
body.lightbox-open .whatsapp-fab {
  display: none;
}

.cart-list { display: flex; flex-direction: column; gap: 10px; }

.cart-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.cart-thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #cbd5e1;
}

.cart-thumb-wrap .photo-frame {
  width: 100%;
  height: 100%;
}

.cart-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-thumb-wrap .watermark-layer-a {
  background-size: 70px 40px;
}

.cart-thumb-wrap .watermark-badge {
  font-size: 0.45rem;
  padding: 3px 6px;
  transform: translate(-50%, -50%) rotate(-14deg);
}

.cart-item-body { flex: 1; min-width: 0; }

.cart-item-body h4 {
  margin: 0 0 4px;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-body p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--gray);
}

.cart-item-remove {
  border: none;
  background: none;
  color: var(--gray);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.cart-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--gray);
}

.cart-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }

.checkout-summary {
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.checkout-summary p { margin: 0 0 6px; }
.checkout-summary .total {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand-soft);
}

.bottom-nav[hidden] {
  display: none !important;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.bottom-nav-item {
  flex: 1;
  position: relative;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--gray);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.bottom-nav-item.active { color: var(--brand-soft); }

.nav-badge {
  position: absolute;
  top: 8px;
  left: calc(50% + 8px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  line-height: 18px;
  text-align: center;
}

.modal[hidden], .lightbox[hidden], .toast[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px calc(20px + var(--safe-bottom));
  background: var(--surface);
  border-radius: 20px 20px 0 0;
}

.modal-sheet h3 { margin: 0 0 8px; }
.modal-cancel { margin-top: 10px; width: 100%; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  display: flex;
  flex-direction: column;
}

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 56px 8px 8px;
  position: relative;
}

.lightbox-canvas {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  display: block;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  -webkit-touch-callout: none;
  user-select: none;
}

.photo-loader {
  position: absolute;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
}

.lightbox-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-bar {
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.lightbox-bar p {
  margin: 0 0 10px;
  font-size: 0.85rem;
  opacity: 0.9;
}

.lightbox-bar .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 180px;
  transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
}

.lightbox-bar .btn-primary.lightbox-toggle--selected {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.4);
}

.lightbox-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.85rem;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 400;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--dark);
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

body.app-authenticated .toast {
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

.whatsapp-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 85;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #25d366;
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.app-authenticated .whatsapp-fab {
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
}

.whatsapp-fab:active {
  transform: scale(0.96);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
}

.whatsapp-fab[hidden] {
  display: none !important;
}

.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-inline {
  text-align: center;
  padding: 24px;
  color: var(--gray);
}

.payment-result-card {
  margin-top: 24px;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  text-align: center;
}

.payment-result-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.payment-result-card--pending .payment-result-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.payment-result-card--error .payment-result-icon {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.payment-result-card h2 {
  margin: 0 0 10px;
  font-size: 1.45rem;
}

.payment-result-card p {
  margin: 0 0 12px;
  line-height: 1.5;
}

.payment-pedido {
  font-size: 0.9rem;
  font-weight: 600;
}

.payment-result-card .btn-primary {
  margin-top: 8px;
}

.payment-foot {
  margin-top: 16px !important;
  font-size: 0.82rem;
}
