/* Donde Hay Figus - Estilos Completos */
:root {
  --bg-primary: #e8f4f8;
  --bg-card: #ffffff;
  --bg-hover: #d9eef5;
  --border: #b3d9e8;
  --text-primary: #003366;
  --text-secondary: #666666;
  --text-muted: #999999;
  --oro: #f5c842;
  --celeste: #0066cc;
  --verde: #10b981;
  --rojo: #ef4444;
  --radius: 12px;
  --safe-bottom: max(0px, env(safe-area-inset-bottom));
  --safe-top: max(0px, env(safe-area-inset-top));
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: 'Outfit', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
}

body {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

/* SCREEN BASE */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 100;
}

/* SPLASH */
#splash {
  justify-content: center;
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, #0066cc, #e8f4f8);
  z-index: 1000;
}

.splash-stars {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

.splash-ball {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  animation: rotate 3s linear infinite;
}

.splash-logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--oro), var(--celeste));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.splash-year {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}

.splash-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.splash-btns {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  padding: 0 1.5rem;
  max-width: 300px;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes bounceMarker {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-15px) scale(1.1); }
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.vendor-marker {
  animation: bounceMarker 2s infinite;
}

/* FORMS */
.auth-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 1.2rem;
  gap: 0.8rem;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.reg-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 0.2rem;
}

.reg-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  padding: 0.4rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--celeste);
  background: var(--bg-hover);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* BOTONES */
.btn-vender {
  padding: 0.35rem 0.7rem;
  background: linear-gradient(135deg, var(--oro), #e5b936);
  border: none;
  border-radius: var(--radius);
  color: #000;
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 0.3rem;
}

.btn-vender:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(245, 200, 66, 0.3);
}

.btn-vender:active {
  transform: translateY(0);
}

.btn-vender:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.back-btn {
  padding: 0.5rem;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}

.back-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-whatsapp {
  padding: 0.8rem 1.2rem;
  background: #25d366;
  border: none;
  border-radius: var(--radius);
  color: white;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all 0.2s;
}

.btn-whatsapp:hover {
  background: #20ba5a;
}

/* APP MAIN */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
  z-index: 1;
  padding-bottom: calc(70px + var(--safe-bottom));
}

.app-header {
  flex-shrink: 0;
  padding: 1rem;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.app-logo span:first-child {
  font-size: 2rem;
}

/* TABS */
.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.tab-content.active-tab {
  display: flex;
}

#tabMap {
  padding: 0;
  flex-direction: column;
}

#tabProfile {
  padding: 1.5rem;
  overflow-y: auto;
  padding-bottom: 5rem;
}

#tabSearch {
  padding: 0;
  flex-direction: column;
  gap: 0;
}

/* ROLE CARDS */
.stock-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.stock-card:active {
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
  border-color: var(--celeste);
}

.stock-card.role-active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  border-color: var(--verde);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.sc-icon {
  font-size: 2rem;
}

.sc-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sc-status {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

/* MAP */
#leafletMap {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
}

/* LISTA VENDEDORES */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.section-count {
  background: linear-gradient(135deg, var(--oro), #e5b936);
  color: #000;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.vendor-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.vendor-card:hover {
  border-color: var(--celeste);
  background: var(--bg-hover);
}

.vendor-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.vendor-avatar {
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--oro), #e5b936);
  border-radius: 8px;
  flex-shrink: 0;
}

.vendor-info {
  flex: 1;
}

.vendor-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.vendor-dir {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.vendor-actions {
  display: flex;
  gap: 0.5rem;
}

/* EMPTY STATE */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* SEARCH */
.search-bar {
  flex-shrink: 0;
  padding: 1rem;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  border-bottom: 2px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.search-bar input {
  flex: 1;
  padding: 0.8rem 1rem;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--celeste);
}

.figurita-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.figurita-card:hover {
  border-color: var(--celeste);
  box-shadow: 0 4px 12px rgba(0, 153, 255, 0.1);
}

.fig-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.fig-number {
  font-weight: 700;
  color: var(--oro);
  font-size: 1.1rem;
}

.fig-rarity {
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.2);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  color: var(--verde);
}

.fig-player {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.fig-info {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* PROFILE */
.profile-header {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.profile-avatar {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.profile-name {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.profile-role {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

#profName {
  font-weight: 700;
  font-size: 1.2rem;
}

#profRole {
  font-size: 0.9rem;
  color: var(--oro);
  font-weight: 600;
}

/* MODALS */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.3s;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
  position: relative;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.3s;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-sheet {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-height: 80%;
  overflow-y: auto;
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-header {
  margin-bottom: 1.5rem;
}

.seller-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.seller-location {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.modal-actions button {
  flex: 1;
}

.modal-close-btn {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  font-family: 'Outfit', sans-serif;
  transition: all 0.2s;
  margin-top: 0.6rem;
}

.modal-close-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* VENDOR SETUP MODAL */
#vendorSetupModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: flex-end;
  z-index: 600;
  opacity: 0;
  transition: opacity 0.3s;
}

#vendorSetupModal.active {
  display: flex;
  opacity: 1;
}

#vendorSetupModal .modal-sheet {
  animation: slideUp 0.3s;
}

/* BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: linear-gradient(180deg, rgba(0, 102, 204, 0.05), rgba(0, 102, 204, 0.15));
  backdrop-filter: blur(20px);
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.6rem 0 calc(0.6rem + var(--safe-bottom));
  z-index: 200;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  transition: color 0.2s;
  background: none;
  border: none;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav-item:hover,
.nav-item.active {
  color: var(--celeste);
}

.nav-item span {
  font-size: 1.2rem;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-weight: 600;
  text-align: center;
  animation: slideUp 0.3s;
  z-index: 1000;
}

.toast.toast-exit {
  animation: slideDown 0.3s forwards;
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* LEAFLET OVERRIDES */
.leaflet-container {
  background: var(--bg-primary);
}

.leaflet-control-zoom {
  border: 2px solid var(--border) !important;
  border-radius: var(--radius) !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: none !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: var(--bg-hover) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  border: 2px solid var(--border) !important;
  border-radius: var(--radius) !important;
}

.leaflet-popup-content {
  color: var(--text-primary) !important;
}

/* VENDOR MARKER ANIMATION */
.vendor-marker-icon {
  animation: jumpingMarker 1.2s ease-in-out infinite !important;
}

@keyframes jumpingMarker {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
