sebastrh commited on
Commit
8e44f4a
·
verified ·
1 Parent(s): 77eebc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +106 -140
app.py CHANGED
@@ -4,27 +4,38 @@ from google.oauth2.service_account import Credentials
4
  import gspread
5
  import time
6
 
7
- # --- 1. CONFIGURACIÓN DE PÁGINA ---
8
  st.set_page_config(page_title="ARZON STUDIOS", layout="wide", initial_sidebar_state="collapsed")
9
 
10
- # --- 2. CSS DE LUJO (REPLICA AMIRI) ---
11
  st.markdown("""
12
  <style>
13
- /* FUENTES: Playfair (Logo) e Inter (UI) */
14
- @import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=Inter:wght@300;400;500;600&display=swap');
15
 
16
- /* GENERAL */
17
  #MainMenu, footer, header, .stDeployButton {display: none;}
18
  .stApp { background-color: #ffffff; color: #000000; font-family: 'Inter', sans-serif; }
19
-
20
- /* ANIMACIÓN DE ENTRADA SUAVE */
21
- .block-container { animation: fadeIn 0.5s ease-in-out; }
22
- @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
 
 
 
23
 
24
  /* =========================================
25
- HEADER & NAVEGACIÓN
26
  ========================================= */
27
- /* Botones de texto limpio (MENU, BUSCAR, ETC) */
 
 
 
 
 
 
 
 
28
  div[data-testid="stHorizontalBlock"] .stButton button {
29
  background: transparent !important;
30
  border: none !important;
@@ -33,26 +44,47 @@ st.markdown("""
33
  font-family: 'Inter', sans-serif !important;
34
  font-size: 11px !important;
35
  font-weight: 500 !important;
36
- letter-spacing: 2px !important;
37
  text-transform: uppercase !important;
38
  padding: 0px !important;
39
- transition: color 0.3s ease;
40
- }
41
- div[data-testid="stHorizontalBlock"] .stButton button:hover {
42
- color: #666666 !important;
43
  }
44
 
45
- /* LOGO CENTRAL (Grande y Serif) */
46
  div[data-testid="column"]:nth-of-type(3) .stButton button {
47
  font-family: 'Playfair Display', serif !important;
48
- font-size: 34px !important;
49
- letter-spacing: 5px !important;
50
  width: 100% !important;
51
- margin-top: -12px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
  /* =========================================
55
- BOTONES DE ACCIÓN (NEGROS SÓLIDOS)
56
  ========================================= */
57
  .stButton button[kind="primary"] {
58
  background-color: #000000 !important;
@@ -62,65 +94,35 @@ st.markdown("""
62
  text-transform: uppercase !important;
63
  font-size: 11px !important;
64
  letter-spacing: 2px !important;
65
- padding: 16px 20px !important;
66
- font-weight: 600 !important;
67
  width: 100% !important;
68
- transition: all 0.3s ease !important;
69
  }
70
- /* Animación de inversión (Blanco con borde negro) */
71
  .stButton button[kind="primary"]:hover {
72
  background-color: #ffffff !important;
73
  color: #000000 !important;
74
  }
75
 
76
  /* =========================================
77
- SIDEBAR (CAJONES)
78
  ========================================= */
79
  section[data-testid="stSidebar"] {
80
  background-color: #ffffff !important;
81
  border-right: 1px solid #f0f0f0;
82
- width: 400px !important;
83
- padding-top: 20px !important;
84
  }
85
 
86
- /* Botones del Sidebar (Estilo Lista Vertical) */
87
- section[data-testid="stSidebar"] .stButton button {
88
- text-align: left !important;
89
- justify-content: flex-start !important;
90
- padding-left: 0px !important;
91
- font-size: 13px !important;
92
- font-weight: 500 !important;
93
- border: none !important;
94
- background: transparent !important;
95
- margin-bottom: 5px !important;
96
- }
97
- section[data-testid="stSidebar"] .stButton button:hover {
98
- color: #666 !important;
99
- padding-left: 10px !important; /* Desplazamiento sutil */
100
- transition: all 0.2s ease;
101
- }
102
-
103
- /* =========================================
104
- INPUTS (BUSCADOR)
105
- ========================================= */
106
  div[data-testid="stTextInput"] input {
107
  border: none !important;
108
- border-bottom: 1px solid #e0e0e0 !important;
109
  border-radius: 0px !important;
110
- padding: 10px 0px !important;
111
  background: transparent !important;
112
- font-family: 'Inter', sans-serif !important;
113
- font-size: 14px !important;
114
  color: black !important;
115
  }
116
- div[data-testid="stTextInput"] input:focus {
117
- border-bottom: 1px solid #000000 !important;
118
- box-shadow: none !important;
119
- }
120
  </style>
121
  """, unsafe_allow_html=True)
122
 
123
- # --- 3. CONEXIÓN DATOS (COMPLETA PARA EVITAR ERRORES) ---
124
  secret_dict = {
125
  "type": "service_account",
126
  "project_id": "trhhats",
@@ -141,8 +143,6 @@ def cargar_datos():
141
  try:
142
  creds = Credentials.from_service_account_info(secret_dict, scopes=["https://www.googleapis.com/auth/spreadsheets"])
143
  client = gspread.authorize(creds)
144
-
145
- # Intentamos abrir la hoja ESPECÍFICA "Catalogo". Si falla, probamos la primera.
146
  try:
147
  sheet = client.open_by_url(SHEET_URL).worksheet("Catalogo")
148
  except:
@@ -152,7 +152,7 @@ def cargar_datos():
152
  if not data: return pd.DataFrame()
153
  df = pd.DataFrame(data)
154
 
155
- # Normalizamos nombres de columnas para evitar errores de mayúsculas/espacios
156
  cols_map = {}
157
  for col in df.columns:
158
  c = col.lower().strip()
@@ -164,7 +164,6 @@ def cargar_datos():
164
  elif 'desc' in c: cols_map[col] = 'Descripcion'
165
  elif 'id' in c: cols_map[col] = 'ID'
166
  elif 'stock' in c: cols_map[col] = 'Stock'
167
-
168
  df.rename(columns=cols_map, inplace=True)
169
 
170
  if 'Producto' not in df.columns: return pd.DataFrame()
@@ -179,7 +178,7 @@ def cargar_datos():
179
  return pd.DataFrame()
180
 
181
  # --- 4. GESTIÓN DE ESTADO ---
182
- if 'active_drawer' not in st.session_state: st.session_state.active_drawer = None # 'menu', 'cart', None
183
  if 'search_open' not in st.session_state: st.session_state.search_open = False
184
  if 'cart' not in st.session_state: st.session_state.cart = []
185
  if 'wishlist' not in st.session_state: st.session_state.wishlist = []
@@ -190,24 +189,25 @@ if 'search_query' not in st.session_state: st.session_state.search_query = ""
190
 
191
  df = cargar_datos()
192
 
193
- # --- 5. HEADER (REPLICA EXACTA) ---
194
- # [ MENÚ ] [ BUSCAR ] [ ARZON STUDIOS ] [ FAVORITOS ] [ BOLSA ]
 
195
  c1, c2, c3, c4, c5 = st.columns([1, 1, 3, 1, 1])
196
 
197
  with c1:
198
- if st.button("☰ MENÚ", key="nav_menu", use_container_width=True):
 
199
  st.session_state.active_drawer = 'menu' if st.session_state.active_drawer != 'menu' else None
200
  st.session_state.search_open = False
201
  st.rerun()
202
 
203
  with c2:
204
- if st.button("🔍 BUSCAR", key="nav_search", use_container_width=True):
205
  st.session_state.search_open = not st.session_state.search_open
206
  st.session_state.active_drawer = None
207
  st.rerun()
208
 
209
  with c3:
210
- # Logo Central que lleva a home
211
  if st.button("ARZON STUDIOS", key="nav_logo", use_container_width=True):
212
  st.session_state.page = 'home'
213
  st.session_state.active_drawer = None
@@ -215,41 +215,36 @@ with c3:
215
  st.rerun()
216
 
217
  with c4:
218
- if st.button("♡ FAVORITOS", key="nav_wish", use_container_width=True):
219
  st.session_state.page = 'wishlist'
220
  st.session_state.active_drawer = None
221
  st.session_state.search_open = False
222
  st.rerun()
223
 
224
  with c5:
225
- bag_label = "BOLSA" if len(st.session_state.cart) == 0 else f"BOLSA ({len(st.session_state.cart)})"
226
- if st.button(bag_label, key="nav_bag", use_container_width=True):
227
  st.session_state.active_drawer = 'cart' if st.session_state.active_drawer != 'cart' else None
228
  st.session_state.search_open = False
229
  st.rerun()
230
 
231
- # --- 6. PANEL DE BÚSQUEDA (IMAGEN 2) ---
232
- # Se abre debajo del header
233
  if st.session_state.search_open:
234
  st.markdown("<br>", unsafe_allow_html=True)
235
- c_s1, c_s2 = st.columns([10, 1])
236
  with c_s1:
237
- query = st.text_input("BUSCAR", placeholder="TYPE TO SEARCH...", value=st.session_state.search_query, label_visibility="collapsed")
238
  with c_s2:
239
- if st.button("✕", key="close_search"):
240
  st.session_state.search_open = False
241
  st.rerun()
242
 
243
- # "POPULAR SEARCHES" como en la imagen 2
244
- st.caption("POPULAR SEARCHES")
245
- col_tags = st.columns(4)
246
- tags = ["MEN'S DENIM", "NEW ARRIVALS", "ACCESSORIES", "SALE"]
247
- for i, tag in enumerate(tags):
248
- with col_tags[i]:
249
- if st.button(tag, key=f"tag_{i}"):
250
- st.session_state.search_query = tag
251
- st.session_state.page = 'home'
252
- st.rerun()
253
 
254
  if query != st.session_state.search_query:
255
  st.session_state.search_query = query
@@ -257,67 +252,51 @@ if st.session_state.search_open:
257
  st.rerun()
258
  st.markdown("---")
259
 
260
- # --- 7. DRAWERS LATERALES (USANDO SIDEBAR) ---
261
  if st.session_state.active_drawer:
262
  with st.sidebar:
263
 
264
- # === CAJÓN: MENÚ (IMAGEN 1) ===
265
  if st.session_state.active_drawer == 'menu':
266
- if st.button("✕ CLOSE", key="close_menu"):
267
  st.session_state.active_drawer = None
268
  st.rerun()
269
-
270
  st.markdown("<br>", unsafe_allow_html=True)
271
 
272
- # Lista vertical limpia
273
  cats = ["VIEW ALL"]
274
  if not df.empty and 'Categoria' in df.columns:
275
  cats += sorted(df['Categoria'].dropna().unique().tolist())
276
 
277
- # Categorías demo si está vacío
278
- if df.empty: cats = ["MEN", "WOMEN", "KIDS", "FOOTWEAR", "ACCESSORIES"]
279
-
280
  for cat in cats:
281
- if st.button(cat.upper(), key=f"cat_{cat}", use_container_width=True):
282
  st.session_state.filter_cat = cat
283
  st.session_state.page = 'home'
284
  st.session_state.active_drawer = None
285
  st.rerun()
286
 
287
- # === CAJÓN: BOLSA (IMAGEN 3) ===
288
  elif st.session_state.active_drawer == 'cart':
289
- c_h1, c_h2 = st.columns([4, 1])
290
- with c_h1: st.write("SHOPPING BAG")
291
- with c_h2:
292
- if st.button("✕"):
293
- st.session_state.active_drawer = None
294
- st.rerun()
295
-
296
  st.markdown("---")
297
 
298
- # ESTADO VACÍO (Replica exacta Imagen 3)
299
  if not st.session_state.cart:
300
- st.markdown("<br><br>", unsafe_allow_html=True)
301
- st.markdown("<div style='text-align:center; font-size:14px;'>Your bag is empty</div>", unsafe_allow_html=True)
302
- st.markdown("<br>", unsafe_allow_html=True)
303
  if st.button("CONTINUE SHOPPING", type="primary", use_container_width=True):
304
  st.session_state.active_drawer = None
305
  st.session_state.page = 'home'
306
  st.rerun()
307
-
308
- # ESTADO CON PRODUCTOS
309
  else:
310
  total = 0
311
  for i, item in enumerate(st.session_state.cart):
312
- c1, c2 = st.columns([1, 2])
313
- with c1:
314
- img = item.get('img', '')
315
- if not str(img).startswith('http'): img = "https://via.placeholder.com/100"
316
- st.image(img, use_container_width=True)
317
- with c2:
318
  st.write(f"**{item['name']}**")
319
- st.caption(f"{item['size']} | ${item['price']}")
320
- if st.button("REMOVE", key=f"rm_{i}"):
321
  st.session_state.cart.pop(i)
322
  st.rerun()
323
  try: total += float(str(item['price']).replace(",",""))
@@ -326,18 +305,16 @@ if st.session_state.active_drawer:
326
 
327
  st.markdown(f"**TOTAL: ${total:,.2f}**")
328
  msg = f"PEDIDO ARZON: ${total}"
329
- st.link_button("CHECKOUT (WHATSAPP)", f"https://wa.me/{WHATSAPP}?text={msg}", type="primary", use_container_width=True)
330
-
331
 
332
- # --- 8. CONTENIDO PRINCIPAL ---
333
 
334
- # === HOME ===
335
  if st.session_state.page == 'home':
336
  st.markdown("<br>", unsafe_allow_html=True)
337
  if df.empty:
338
  st.info("Cargando catálogo...")
339
  else:
340
- # Filtrado
341
  d_show = df.copy()
342
  if st.session_state.filter_cat != "VIEW ALL" and 'Categoria' in d_show.columns:
343
  d_show = d_show[d_show['Categoria'] == st.session_state.filter_cat]
@@ -350,27 +327,21 @@ if st.session_state.page == 'home':
350
  cols = st.columns(3, gap="large")
351
  for idx, row in d_show.iterrows():
352
  with cols[idx % 3]:
353
- # Imagen
354
  img = row.get('Imagen', '')
355
- if not str(img).startswith('http'): img = "https://via.placeholder.com/600x800?text=No+Img"
356
  st.image(img, use_container_width=True)
357
-
358
- # Info Minimalista
359
- st.markdown(f"<div style='text-align:center; font-weight:600; font-size:12px; margin-top:8px;'>{row.get('Producto', '').upper()}</div>", unsafe_allow_html=True)
360
  st.markdown(f"<div style='text-align:center; font-size:12px; color:#555;'>${row.get('Precio', 0):,.2f}</div>", unsafe_allow_html=True)
361
-
362
- # Botón Quick Shop
363
  if st.button("SHOP NOW", key=f"s_{idx}", type="primary", use_container_width=True):
364
  st.session_state.selected_product = row.to_dict()
365
  st.session_state.page = 'product'
366
  st.rerun()
367
  st.markdown("<br>", unsafe_allow_html=True)
368
 
369
- # === PRODUCTO ===
370
  elif st.session_state.page == 'product' and st.session_state.selected_product:
371
  p = st.session_state.selected_product
372
-
373
- if st.button("← BACK", key="bk"):
374
  st.session_state.page = 'home'
375
  st.rerun()
376
  st.write("")
@@ -381,16 +352,12 @@ elif st.session_state.page == 'product' and st.session_state.selected_product:
381
  if not str(img).startswith('http'): img = "https://via.placeholder.com/600x800"
382
  st.image(img, use_container_width=True)
383
  with c2:
384
- st.markdown(f"### {p.get('Producto', '').upper()}")
385
  st.markdown(f"#### ${p.get('Precio', 0):,.2f}")
386
  st.write("")
387
-
388
- # Tallas
389
  tallas = str(p.get('Tallas', 'ONE SIZE')).split(',')
390
  size = st.selectbox("SIZE", [t.strip() for t in tallas])
391
-
392
  st.markdown("<br>", unsafe_allow_html=True)
393
- # BOTÓN AÑADIR (Negro, invierte color)
394
  if st.button("ADD TO BAG", type="primary", use_container_width=True):
395
  st.session_state.cart.append({
396
  "id": p.get('ID'),
@@ -399,13 +366,12 @@ elif st.session_state.page == 'product' and st.session_state.selected_product:
399
  "size": size,
400
  "img": p.get('Imagen')
401
  })
402
- st.session_state.active_drawer = 'cart' # Abre la bolsa automáticamente
403
  st.rerun()
404
-
405
  st.markdown("---")
406
- st.caption(p.get('Descripcion', ''))
407
 
408
- # === WISHLIST ===
409
  elif st.session_state.page == 'wishlist':
410
  st.subheader("WISHLIST")
411
  st.info("Empty.")
 
4
  import gspread
5
  import time
6
 
7
+ # --- 1. CONFIGURACIÓN ---
8
  st.set_page_config(page_title="ARZON STUDIOS", layout="wide", initial_sidebar_state="collapsed")
9
 
10
+ # --- 2. CSS DE LUJO RESPONSIVO (MOBILE FIRST) ---
11
  st.markdown("""
12
  <style>
13
+ /* FUENTES */
14
+ @import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600&family=Inter:wght@300;400;500;600&display=swap');
15
 
16
+ /* LIMPIEZA */
17
  #MainMenu, footer, header, .stDeployButton {display: none;}
18
  .stApp { background-color: #ffffff; color: #000000; font-family: 'Inter', sans-serif; }
19
+
20
+ /* QUITAR MÁRGENES MOLESTOS DE STREAMLIT EN MOVIL */
21
+ .block-container {
22
+ padding-top: 1rem !important;
23
+ padding-left: 1rem !important;
24
+ padding-right: 1rem !important;
25
+ }
26
 
27
  /* =========================================
28
+ HEADER RESPONSIVO (LA MAGIA)
29
  ========================================= */
30
+
31
+ /* Forzar que las columnas del header NO se apilen en movil */
32
+ [data-testid="stHorizontalBlock"] {
33
+ flex-wrap: nowrap !important;
34
+ align-items: center !important;
35
+ gap: 0px !important;
36
+ }
37
+
38
+ /* Estilo Base de Botones Header */
39
  div[data-testid="stHorizontalBlock"] .stButton button {
40
  background: transparent !important;
41
  border: none !important;
 
44
  font-family: 'Inter', sans-serif !important;
45
  font-size: 11px !important;
46
  font-weight: 500 !important;
47
+ letter-spacing: 1px !important;
48
  text-transform: uppercase !important;
49
  padding: 0px !important;
50
+ white-space: nowrap !important;
51
+ min-width: auto !important;
 
 
52
  }
53
 
54
+ /* LOGO CENTRAL (Adaptable) */
55
  div[data-testid="column"]:nth-of-type(3) .stButton button {
56
  font-family: 'Playfair Display', serif !important;
57
+ font-size: 28px !important; /* Tamaño escritorio */
58
+ letter-spacing: 4px !important;
59
  width: 100% !important;
60
+ margin-top: -8px !important;
61
+ }
62
+
63
+ /* --- REGLAS SOLO PARA CELULAR (Pantallas pequeñas) --- */
64
+ @media (max-width: 640px) {
65
+ /* Reducir tamaño de texto en botones laterales */
66
+ div[data-testid="stHorizontalBlock"] .stButton button {
67
+ font-size: 9px !important;
68
+ letter-spacing: 0px !important;
69
+ }
70
+
71
+ /* Reducir Logo en celular para que quepa */
72
+ div[data-testid="column"]:nth-of-type(3) .stButton button {
73
+ font-size: 16px !important;
74
+ letter-spacing: 1px !important;
75
+ margin-top: 0px !important;
76
+ font-weight: 600 !important;
77
+ }
78
+
79
+ /* Ajustar espaciado de columnas en celular */
80
+ [data-testid="column"] {
81
+ padding: 0px !important;
82
+ min-width: auto !important;
83
+ }
84
  }
85
 
86
  /* =========================================
87
+ BOTONES DE ACCIÓN (ESTILO AMIRI)
88
  ========================================= */
89
  .stButton button[kind="primary"] {
90
  background-color: #000000 !important;
 
94
  text-transform: uppercase !important;
95
  font-size: 11px !important;
96
  letter-spacing: 2px !important;
97
+ padding: 15px !important;
 
98
  width: 100% !important;
 
99
  }
 
100
  .stButton button[kind="primary"]:hover {
101
  background-color: #ffffff !important;
102
  color: #000000 !important;
103
  }
104
 
105
  /* =========================================
106
+ SIDEBAR & INPUTS
107
  ========================================= */
108
  section[data-testid="stSidebar"] {
109
  background-color: #ffffff !important;
110
  border-right: 1px solid #f0f0f0;
111
+ width: 100% !important; /* En celular ocupa toda la pantalla */
112
+ max-width: 400px !important;
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  div[data-testid="stTextInput"] input {
116
  border: none !important;
117
+ border-bottom: 1px solid #000 !important;
118
  border-radius: 0px !important;
 
119
  background: transparent !important;
 
 
120
  color: black !important;
121
  }
 
 
 
 
122
  </style>
123
  """, unsafe_allow_html=True)
124
 
125
+ # --- 3. CONEXIÓN DATOS ---
126
  secret_dict = {
127
  "type": "service_account",
128
  "project_id": "trhhats",
 
143
  try:
144
  creds = Credentials.from_service_account_info(secret_dict, scopes=["https://www.googleapis.com/auth/spreadsheets"])
145
  client = gspread.authorize(creds)
 
 
146
  try:
147
  sheet = client.open_by_url(SHEET_URL).worksheet("Catalogo")
148
  except:
 
152
  if not data: return pd.DataFrame()
153
  df = pd.DataFrame(data)
154
 
155
+ # Normalizar
156
  cols_map = {}
157
  for col in df.columns:
158
  c = col.lower().strip()
 
164
  elif 'desc' in c: cols_map[col] = 'Descripcion'
165
  elif 'id' in c: cols_map[col] = 'ID'
166
  elif 'stock' in c: cols_map[col] = 'Stock'
 
167
  df.rename(columns=cols_map, inplace=True)
168
 
169
  if 'Producto' not in df.columns: return pd.DataFrame()
 
178
  return pd.DataFrame()
179
 
180
  # --- 4. GESTIÓN DE ESTADO ---
181
+ if 'active_drawer' not in st.session_state: st.session_state.active_drawer = None
182
  if 'search_open' not in st.session_state: st.session_state.search_open = False
183
  if 'cart' not in st.session_state: st.session_state.cart = []
184
  if 'wishlist' not in st.session_state: st.session_state.wishlist = []
 
189
 
190
  df = cargar_datos()
191
 
192
+ # --- 5. HEADER RESPONSIVO ---
193
+ # Usamos proporciones que funcionan en celular [1,1,3,1,1]
194
+ # En CSS forzamos a que no se apilen.
195
  c1, c2, c3, c4, c5 = st.columns([1, 1, 3, 1, 1])
196
 
197
  with c1:
198
+ # Usamos iconos o texto corto para que quepa en celular
199
+ if st.button("MENÚ", key="nav_menu", use_container_width=True):
200
  st.session_state.active_drawer = 'menu' if st.session_state.active_drawer != 'menu' else None
201
  st.session_state.search_open = False
202
  st.rerun()
203
 
204
  with c2:
205
+ if st.button("BUSCAR", key="nav_search", use_container_width=True):
206
  st.session_state.search_open = not st.session_state.search_open
207
  st.session_state.active_drawer = None
208
  st.rerun()
209
 
210
  with c3:
 
211
  if st.button("ARZON STUDIOS", key="nav_logo", use_container_width=True):
212
  st.session_state.page = 'home'
213
  st.session_state.active_drawer = None
 
215
  st.rerun()
216
 
217
  with c4:
218
+ if st.button("♡", key="nav_wish", use_container_width=True):
219
  st.session_state.page = 'wishlist'
220
  st.session_state.active_drawer = None
221
  st.session_state.search_open = False
222
  st.rerun()
223
 
224
  with c5:
225
+ bag_txt = f"({len(st.session_state.cart)})" if st.session_state.cart else "BOLSA"
226
+ if st.button(bag_txt, key="nav_bag", use_container_width=True):
227
  st.session_state.active_drawer = 'cart' if st.session_state.active_drawer != 'cart' else None
228
  st.session_state.search_open = False
229
  st.rerun()
230
 
231
+ # --- 6. BÚSQUEDA ---
 
232
  if st.session_state.search_open:
233
  st.markdown("<br>", unsafe_allow_html=True)
234
+ c_s1, c_s2 = st.columns([8, 1])
235
  with c_s1:
236
+ query = st.text_input("BÚSQUEDA", placeholder="Buscar...", value=st.session_state.search_query, label_visibility="collapsed")
237
  with c_s2:
238
+ if st.button("✕", key="cl_s"):
239
  st.session_state.search_open = False
240
  st.rerun()
241
 
242
+ st.caption("POPULAR")
243
+ pop_cols = st.columns(3)
244
+ with pop_cols[0]:
245
+ if st.button("NEW ARRIVALS"): pass
246
+ with pop_cols[1]:
247
+ if st.button("DENIM"): pass
 
 
 
 
248
 
249
  if query != st.session_state.search_query:
250
  st.session_state.search_query = query
 
252
  st.rerun()
253
  st.markdown("---")
254
 
255
+ # --- 7. CAJONES (SIDEBAR) ---
256
  if st.session_state.active_drawer:
257
  with st.sidebar:
258
 
259
+ # MENU
260
  if st.session_state.active_drawer == 'menu':
261
+ if st.button("✕ CERRAR", key="cl_m"):
262
  st.session_state.active_drawer = None
263
  st.rerun()
 
264
  st.markdown("<br>", unsafe_allow_html=True)
265
 
 
266
  cats = ["VIEW ALL"]
267
  if not df.empty and 'Categoria' in df.columns:
268
  cats += sorted(df['Categoria'].dropna().unique().tolist())
269
 
 
 
 
270
  for cat in cats:
271
+ if st.button(cat.upper(), key=f"c_{cat}", use_container_width=True):
272
  st.session_state.filter_cat = cat
273
  st.session_state.page = 'home'
274
  st.session_state.active_drawer = None
275
  st.rerun()
276
 
277
+ # BOLSA
278
  elif st.session_state.active_drawer == 'cart':
279
+ st.write("SHOPPING BAG")
280
+ if st.button("✕", key="cl_c"):
281
+ st.session_state.active_drawer = None
282
+ st.rerun()
 
 
 
283
  st.markdown("---")
284
 
 
285
  if not st.session_state.cart:
286
+ st.markdown("<br><div style='text-align:center'>Your bag is empty</div><br>", unsafe_allow_html=True)
 
 
287
  if st.button("CONTINUE SHOPPING", type="primary", use_container_width=True):
288
  st.session_state.active_drawer = None
289
  st.session_state.page = 'home'
290
  st.rerun()
 
 
291
  else:
292
  total = 0
293
  for i, item in enumerate(st.session_state.cart):
294
+ c_img, c_inf = st.columns([1, 2])
295
+ with c_img: st.image(item['img'], use_container_width=True)
296
+ with c_inf:
 
 
 
297
  st.write(f"**{item['name']}**")
298
+ st.caption(f"${item['price']}")
299
+ if st.button("REMOVE", key=f"r_{i}"):
300
  st.session_state.cart.pop(i)
301
  st.rerun()
302
  try: total += float(str(item['price']).replace(",",""))
 
305
 
306
  st.markdown(f"**TOTAL: ${total:,.2f}**")
307
  msg = f"PEDIDO ARZON: ${total}"
308
+ st.link_button("CHECKOUT WHATSAPP", f"https://wa.me/{WHATSAPP}?text={msg}", type="primary", use_container_width=True)
 
309
 
310
+ # --- 8. CONTENIDO ---
311
 
312
+ # HOME (GRID)
313
  if st.session_state.page == 'home':
314
  st.markdown("<br>", unsafe_allow_html=True)
315
  if df.empty:
316
  st.info("Cargando catálogo...")
317
  else:
 
318
  d_show = df.copy()
319
  if st.session_state.filter_cat != "VIEW ALL" and 'Categoria' in d_show.columns:
320
  d_show = d_show[d_show['Categoria'] == st.session_state.filter_cat]
 
327
  cols = st.columns(3, gap="large")
328
  for idx, row in d_show.iterrows():
329
  with cols[idx % 3]:
 
330
  img = row.get('Imagen', '')
331
+ if not str(img).startswith('http'): img = "https://via.placeholder.com/600x800"
332
  st.image(img, use_container_width=True)
333
+ st.markdown(f"<div style='text-align:center; font-weight:600; font-size:12px; margin-top:5px;'>{row.get('Producto','').upper()}</div>", unsafe_allow_html=True)
 
 
334
  st.markdown(f"<div style='text-align:center; font-size:12px; color:#555;'>${row.get('Precio', 0):,.2f}</div>", unsafe_allow_html=True)
 
 
335
  if st.button("SHOP NOW", key=f"s_{idx}", type="primary", use_container_width=True):
336
  st.session_state.selected_product = row.to_dict()
337
  st.session_state.page = 'product'
338
  st.rerun()
339
  st.markdown("<br>", unsafe_allow_html=True)
340
 
341
+ # PRODUCTO
342
  elif st.session_state.page == 'product' and st.session_state.selected_product:
343
  p = st.session_state.selected_product
344
+ if st.button("← BACK"):
 
345
  st.session_state.page = 'home'
346
  st.rerun()
347
  st.write("")
 
352
  if not str(img).startswith('http'): img = "https://via.placeholder.com/600x800"
353
  st.image(img, use_container_width=True)
354
  with c2:
355
+ st.markdown(f"### {p.get('Producto').upper()}")
356
  st.markdown(f"#### ${p.get('Precio', 0):,.2f}")
357
  st.write("")
 
 
358
  tallas = str(p.get('Tallas', 'ONE SIZE')).split(',')
359
  size = st.selectbox("SIZE", [t.strip() for t in tallas])
 
360
  st.markdown("<br>", unsafe_allow_html=True)
 
361
  if st.button("ADD TO BAG", type="primary", use_container_width=True):
362
  st.session_state.cart.append({
363
  "id": p.get('ID'),
 
366
  "size": size,
367
  "img": p.get('Imagen')
368
  })
369
+ st.session_state.active_drawer = 'cart'
370
  st.rerun()
 
371
  st.markdown("---")
372
+ st.write(p.get('Descripcion', ''))
373
 
374
+ # WISHLIST
375
  elif st.session_state.page == 'wishlist':
376
  st.subheader("WISHLIST")
377
  st.info("Empty.")