File size: 31,834 Bytes
5bb2e31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6460d5f
5bb2e31
 
 
 
 
6460d5f
5bb2e31
6460d5f
 
 
 
 
 
 
5bb2e31
 
b8da5e8
5bb2e31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6460d5f
5bb2e31
6460d5f
 
 
5bb2e31
6460d5f
5bb2e31
 
 
 
 
 
 
 
 
683e84d
5bb2e31
 
 
 
 
683e84d
5bb2e31
683e84d
5bb2e31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fea94ff
5bb2e31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55d7f2a
5bb2e31
 
 
 
 
55d7f2a
 
 
 
 
 
5bb2e31
 
 
 
 
 
 
b8da5e8
 
 
 
 
 
 
 
 
 
 
 
 
55d7f2a
 
 
 
 
 
 
 
 
 
 
 
 
 
e02a00c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55d7f2a
e02a00c
55d7f2a
e02a00c
 
 
 
 
 
 
 
 
5bb2e31
 
6460d5f
55d7f2a
 
 
e02a00c
998adec
 
 
 
 
 
5bb2e31
55d7f2a
998adec
e02a00c
5bb2e31
 
 
 
e02a00c
b8da5e8
55d7f2a
b8da5e8
55d7f2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5bb2e31
b8da5e8
55d7f2a
 
b8da5e8
 
 
55d7f2a
 
 
 
 
b8da5e8
 
 
5bb2e31
b8da5e8
 
5bb2e31
b8da5e8
 
 
 
5bb2e31
 
 
 
55d7f2a
5bb2e31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55d7f2a
5bb2e31
7a3c1c8
5bb2e31
683e84d
5bb2e31
7a3c1c8
 
 
 
 
 
 
 
 
 
 
683e84d
7a3c1c8
 
 
5bb2e31
683e84d
 
5bb2e31
 
683e84d
 
 
 
 
 
 
 
 
7a3c1c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bb91439
7a3c1c8
 
 
bb91439
7a3c1c8
 
 
 
 
 
 
bb91439
5bb2e31
 
 
 
 
 
 
 
 
55d7f2a
5bb2e31
55d7f2a
 
 
 
 
 
 
 
 
 
5bb2e31
 
d2db32f
96a399e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d2db32f
55d7f2a
96a399e
55d7f2a
 
96a399e
 
 
 
55d7f2a
 
 
96a399e
55d7f2a
96a399e
 
7b5ce4b
 
55d7f2a
96a399e
 
 
55d7f2a
96a399e
 
 
 
 
55d7f2a
 
 
96a399e
 
 
 
55d7f2a
 
 
96a399e
55d7f2a
96a399e
 
7b5ce4b
 
55d7f2a
96a399e
 
 
55d7f2a
96a399e
7b5ce4b
 
 
 
55d7f2a
 
d2db32f
55d7f2a
96a399e
d2db32f
55d7f2a
96a399e
55d7f2a
 
96a399e
 
 
55d7f2a
 
 
 
 
5872ab7
55d7f2a
 
96a399e
 
55d7f2a
 
 
 
 
 
 
96a399e
 
 
55d7f2a
 
d67feea
96a399e
 
d67feea
55d7f2a
 
5872ab7
b0cb752
55d7f2a
 
96a399e
 
55d7f2a
5f3ece7
 
 
55d7f2a
5f3ece7
96a399e
 
55d7f2a
 
 
 
 
96a399e
 
55d7f2a
 
96a399e
 
 
 
 
 
 
 
55d7f2a
 
96a399e
 
 
55d7f2a
 
96a399e
 
 
55d7f2a
96a399e
55d7f2a
 
 
96a399e
 
 
 
 
 
 
 
55d7f2a
 
96a399e
 
 
55d7f2a
 
96a399e
 
 
55d7f2a
96a399e
55d7f2a
 
d2db32f
55d7f2a
96a399e
d2db32f
7f2dd53
 
 
d2db32f
 
55d7f2a
d2db32f
5bb2e31
96a399e
 
 
 
 
 
 
d2db32f
5bb2e31
55d7f2a
 
 
5bb2e31
 
d2db32f
96a399e
d2db32f
 
 
5bb2e31
 
d2db32f
 
 
 
 
 
 
5bb2e31
55d7f2a
96a399e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5bb2e31
d2db32f
55d7f2a
d2db32f
 
96a399e
 
 
 
 
 
 
d2db32f
5bb2e31
55d7f2a
 
 
 
 
 
 
5bb2e31
 
d2db32f
96a399e
d2db32f
 
 
5bb2e31
 
d2db32f
 
 
 
 
 
 
5bb2e31
55d7f2a
96a399e
 
 
 
 
 
 
 
 
 
 
 
 
 
5bb2e31
d2db32f
55d7f2a
d2db32f
5bb2e31
96a399e
 
 
 
 
 
 
 
5bb2e31
d2db32f
5bb2e31
 
 
 
 
 
 
6460d5f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
# modules/ui/ui.py
import streamlit as st
from PIL import Image
import base64
from streamlit_player import st_player
import logging
from datetime import datetime
from dateutil.parser import parse

#########################################################
# Configuración de estilo CSS para el carrusel
st.markdown("""
<style>
    .carousel-container {
        position: relative;
        max-width: 800px;
        margin: 0 auto;
    }
    .carousel-image {
        width: 100%;
        border-radius: 10px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        display: none;
    }
    .carousel-image.active {
        display: block;
        animation: fadeIn 0.5s;
    }
    @keyframes fadeIn {
        from {opacity: 0.4;}
        to {opacity: 1;}
    }
    .carousel-caption {
        text-align: center;
        margin-top: 10px;
        font-size: 1.1em;
        color: #333;
    }
    .carousel-nav {
        display: flex;
        justify-content: center;
        margin-top: 15px;
    }
    .carousel-dot {
        height: 12px;
        width: 12px;
        margin: 0 5px;
        background-color: #bbb;
        border-radius: 50%;
        display: inline-block;
        cursor: pointer;
    }
    .carousel-dot.active {
        background-color: #717171;
    }
</style>
""", unsafe_allow_html=True)

# Datos del carrusel (imágenes y descripciones)
eventos = [
    {
        "imagen": "assets/img/socialmedia/WebSummit_ShowCase_2025.png",
        "titulo": "WebSummitRio 2025, Rio, Brasil, april, 27-30",
        "descripcion": "AIdeaText showcase"
    },
    
    {
        "imagen": "assets/img/socialmedia/image_pycon_2024.png",
        "titulo": "PyCon 2024, Medellin, Colombia, june, 7-9",
        "descripcion": "AIdeaText showcase"
    },

    {
        "imagen": "assets/img/socialmedia/_MG_2845.JPG",
        "titulo": "MakerFaire 2024, Mexico City, Mexico, octuber, 12-13",
        "descripcion": "AIdeaText showcase"
    }    
]

#####################
def initialize_carousel_state():
    """Inicializa todas las variables de estado necesarias para el carrusel"""
    if not hasattr(st.session_state, 'current_event'):
        st.session_state.current_event = 0
    if not hasattr(st.session_state, 'carousel_initialized'):
        st.session_state.carousel_initialized = True

#####################
def show_carousel():
    """Muestra el carrusel de imágenes con inicialización segura del estado"""
    try:
        # Inicialización segura del estado
        initialize_carousel_state()
        
        # Verificación adicional
        if not hasattr(st.session_state, 'current_event'):
            st.session_state.current_event = 0
            st.rerun()
            
        current_idx = st.session_state.current_event
        
        with st.container():
            #st.markdown("<h2 style='text-align: center; margin-bottom: 30px;'>Eventos Relevantes</h2>", 
            #           unsafe_allow_html=True)
            
            # Controles de navegación
            col1, col2, col3 = st.columns([1, 6, 1])
            
            with col1:
                if st.button("◀", key="carousel_prev"):
                    st.session_state.current_event = (current_idx - 1) % len(eventos)
                    st.rerun()
            
            with col2:
                event = eventos[current_idx]
                img = Image.open(event["imagen"]) if isinstance(event["imagen"], str) else event["imagen"]
                st.image(
                    img,
                    use_container_width=True,  # <-- Cambio realizado aquí
                    caption=f"{event['titulo']} - {event['descripcion']}"
                )
            
            with col3:
                if st.button("▶", key="carousel_next"):
                    st.session_state.current_event = (current_idx + 1) % len(eventos)
                    st.rerun()
            
            # Indicadores de posición (solo visuales, no botones)
            st.markdown("<div class='carousel-nav'>", unsafe_allow_html=True)
            for i in range(len(eventos)):
                active_class = "carousel-dot active" if i == current_idx else "carousel-dot"
                st.markdown(f"<span class='{active_class}'></span>", unsafe_allow_html=True)
            st.markdown("</div>", unsafe_allow_html=True)
                        
    except Exception as e:
        st.error(f"Error al mostrar el carrusel: {str(e)}")
        logger.error(f"Error en show_carousel: {str(e)}")

#########################################################
# Configura el logger PRIMERO, antes de cualquier uso
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

#########################################################
# Importaciones locales
from session_state import initialize_session_state, logout
from translations import get_translations, get_landing_translations
from ..auth.auth import authenticate_user, authenticate_student, authenticate_admin
from ..database.sql_db import store_application_request
from ..admin.admin_ui import admin_page

#########################################################
# Intento de importación con logger YA DEFINIDO
try:
    from .user_page import user_page
except ImportError as e:
    logger.error(f"No se pudo importar user_page: {str(e)}. Asegúrate de que el archivo existe.")
    
    # Función de respaldo
    def user_page(lang_code, t):
        st.error("La página de usuario no está disponible. Por favor, contacta al administrador.")

#############################################################
def main():
    logger.info(f"Entrando en main() - Página actual: {st.session_state.page}")

    if 'nlp_models' not in st.session_state:
        logger.error("Los modelos NLP no están inicializados.")
        st.error("Los modelos NLP no están inicializados. Por favor, reinicie la aplicación.")
        return

    lang_code = st.session_state.get('lang_code', 'en')
    t = get_translations(lang_code)

    logger.info(f"Página actual antes de la lógica de enrutamiento: {st.session_state.page}")

    if st.session_state.get('logged_out', False):
        st.session_state.logged_out = False
        st.session_state.page = 'login'
        st.rerun()

    if not st.session_state.get('logged_in', False):
        logger.info("Usuario no ha iniciado sesión. Mostrando página de login/registro")
        login_register_page(lang_code, t)
    elif st.session_state.page == 'user':
        if st.session_state.role == 'Administrador':
            logger.info("Redirigiendo a la página de administrador")
            st.session_state.page = 'Admin'
            st.rerun()
        else:
            logger.info("Renderizando página de usuario")
            user_page(lang_code, t)
    elif st.session_state.page == "Admin":
        logger.info("Renderizando página de administrador")
        admin_page()
    else:
        logger.error(f"Página no reconocida: {st.session_state.page}")
        st.error(t.get('unrecognized_page', 'Página no reconocida'))
        # Redirigir a la página de usuario en caso de error
        st.session_state.page = 'user'
        st.rerun()

    logger.info(f"Saliendo de main() - Estado final de la sesión: {st.session_state}")

#############################################################
#############################################################    

def login_register_page(lang_code, t):
    # Obtener traducciones específicas para landing page
    landing_t = get_landing_translations(lang_code)
    
    # Language selection dropdown at the top
    languages = {
        'English': 'en', 
        'Español': 'es', 
        'Français': 'fr', 
        'Português': 'pt'
    }
    
    # Estilo personalizado para mejorar el espaciado y alineación
    st.markdown("""
    <style>
        div.row-widget.stHorizontalBlock {
            align-items: center;
        }
        /* Resaltar el tab de registro */
        .stTabs [data-baseweb="tab-list"] {
            gap: 0px;
        }
        .stTabs [data-baseweb="tab"] {
            padding: 10px 20px;
            font-weight: 600;
        }
        .stTabs [aria-selected="true"] {
            background-color: #1E3A8A;
            color: white !important;
            border-radius: 5px 5px 0 0;
        }
        /* Estilo para contenedor de inicio */
        .start-container {
            background: linear-gradient(135deg, #1E3A8A 0%, #3730A3 100%);
            color: white;
            padding: 15px;
            border-radius: 10px 10px 0 0;
            text-align: center;
            margin-bottom: 10px;
        }
        .language-inline {
            display: inline-block;
            margin-left: 10px;
            vertical-align: middle;
        }
        
        /* CENTRAR EL LOGO - NUEVO ESTILO */
        .logo-center-container {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 20px 0 30px 0;
            width: 100%;
        }
        .logo-center-container img {
            display: block;
            margin: 0 auto;
        }
        /* Centrar el contenedor de imagen de Streamlit */
        [data-testid="stImage"] {
            text-align: center;
            margin: 0 auto;
        }
        /* Forzar centrado del logo */
        div.stImage {
            text-align: center;
        }
        div.stImage > img {
            margin: 0 auto;
            display: block;
        }
        
    </style>
    """, unsafe_allow_html=True)

    # ============================================
    # [1] LOGO AIdeaText CENTRADO - UNA SOLA FILA
    # ============================================
    # Opción 1: Usar columnas para centrar
    st.markdown("""
    <div style="text-align: center; margin: 20px 0 30px 0;">
        <img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/AIdeaText_Logo_vectores.png" 
             width="200" style="display: block; margin: 0 auto;">
    </div>
    """, unsafe_allow_html=True)
    
    st.markdown("---")
#######################################################################
    
    # Main content with columns
    left_column, right_column = st.columns([1, 3])
    
    with left_column:
        
        # ============================================
        # [2] CONTENEDOR "COMIENZA" CON SELECTOR DE IDIOMA
        # ============================================
        st.markdown("""
        <div class="start-container">
            <h3 style='margin: 0;'>
                🚀 Comienza en 
                <span class="language-inline">
        """, unsafe_allow_html=True)
        
        # Selector de idioma inline
        selected_lang = st.selectbox(
            "",
            list(languages.keys()),
            index=list(languages.keys()).index('English'),  # [3.2] Inglés por defecto
            label_visibility="collapsed",
            key="landing_language_selector"
        )
        
        st.markdown("""
                </span>
            </h3>
        </div>
        """, unsafe_allow_html=True)
        
        new_lang_code = languages[selected_lang]
        if lang_code != new_lang_code:
            st.session_state.lang_code = new_lang_code
            st.rerun()
        
        # Crear tabs - REGISTRO siempre primero
        tab_titles = [f"📝 {landing_t['register']}", f"🔐 {landing_t['login']}"]
        tabs = st.tabs(tab_titles)
        
        # TAB 1: FORMULARIO DE REGISTRO (Siempre visible por defecto)
        with tabs[0]:
            register_form(lang_code, landing_t)
        
        # TAB 2: FORMULARIO DE LOGIN
        with tabs[1]:
            login_form(lang_code, landing_t)
    
    with right_column:
        display_videos_and_info(lang_code, landing_t)


#############################################################
#############################################################
def login_form(lang_code, landing_t):
    with st.form("login_form"):
        username = st.text_input(landing_t['email'])
        password = st.text_input(landing_t['password'], type="password")
        submit_button = st.form_submit_button(landing_t['login_button'])

    if submit_button:
        success, role = authenticate_user(username, password)
        if success:
            st.session_state.logged_in = True
            st.session_state.username = username
            st.session_state.role = role
            if role == 'Administrador':
                st.session_state.page = 'Admin'
            else:
                st.session_state.page = 'user'
            logger.info(f"Usuario autenticado: {username}, Rol: {role}")
            st.rerun()
        else:
            st.error(landing_t['invalid_credentials'])
            
#############################################################

def register_form(lang_code, landing_t):
    """Formulario de registro simplificado - SOLO 3 CAMPOS"""
    
    # Verificar si acabamos de registrar exitosamente
    if 'just_registered' in st.session_state and st.session_state.just_registered:
        st.success("✅ ¡Registro exitoso! Tu solicitud ha sido enviada.")
        st.info("Por favor revisa tu correo para más instrucciones.")
        
        # Botón para limpiar y empezar de nuevo
        if st.button("Hacer otro registro"):
            del st.session_state.just_registered
            st.rerun()
        return
    
    # Solo 3 campos requeridos
    name = st.text_input("Nombre completo *", key="reg_name")
    email = st.text_input("Correo institucional *", key="reg_email") 
    institution = st.text_input("Institución educativa *", key="reg_institution")
    
    # Botón simplificado
    if st.button(landing_t['submit_application'], type="primary"):
        logger.info(f"Intentando enviar solicitud para {email}")
        
        # Validaciones básicas
        if not name or not email or not institution:
            st.error("Por favor completa los campos obligatorios (*)")
            return
        
        if not is_institutional_email(email):
            st.error("Por favor usa un correo institucional (no gmail, hotmail, etc.)")
            return
        
        # Enviar solicitud
        success = store_application_request(
            name=name,
            lastname="",
            email=email,
            institution=institution,
            current_role="Estudiante",
            desired_role="Estudiante",  
            reason="Nuevo registro"
        )
        
        if success:
            # Marcar que acabamos de registrar
            st.session_state.just_registered = True
            logger.info(f"Solicitud almacenada exitosamente para {email}")
            
            # Mostrar mensaje y recargar
            st.success("✅ ¡Tu solicitud ha sido enviada! Recibirás un correo con instrucciones.")
            st.balloons()
            
            # Recargar después de 2 segundos
            import time
            time.sleep(2)
            st.rerun()
        else:
            st.error("❌ Hubo un error al enviar tu solicitud. Por favor, inténtalo de nuevo.")
            logger.error(f"Error al almacenar solicitud para {email}")


#############################################################
#############################################################
def is_institutional_email(email):
        forbidden_domains = ['gmail.com', 'hotmail.com', 'yahoo.com', 'outlook.com']
        return not any(domain in email.lower() for domain in forbidden_domains)

#############################################################
#############################################################

def display_videos_and_info(lang_code, landing_t):
    # ============================================
    # NUEVO ORDEN DE TABS CON 6 OPCIONES
    # ============================================
    tab_about, tab_programs, tab_competitions, tab_use_case, tab_presentations, tab_gallery = st.tabs([
        "👥 About Us",
        "🏆 Current Programs", 
        "💰 Competitions",
        "🎯 Use Cases",
        "🎬 Pitches & Presentations",
        "📸 Events & Recognition"
    ])

    # ============================================
    # ESTILOS GLOBALES PARA CONSISTENCIA
    # ============================================
    st.markdown("""
    <style>
        /* Estilos para títulos consistentes */
        .tab-title {
            font-size: 1.8em;
            font-weight: 700;
            color: #1E3A8A;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 3px solid #1E3A8A;
        }
        .section-title {
            font-size: 1.4em;
            font-weight: 600;
            color: #374151;
            margin: 25px 0 15px 0;
        }
        .subsection-title {
            font-size: 1.2em;
            font-weight: 600;
            color: #4B5563;
            margin: 20px 0 10px 0;
        }
        .content-text {
            font-size: 1em;
            line-height: 1.6;
            color: #6B7280;
        }
        .highlight-box {
            background-color: #F3F4F6;
            border-left: 4px solid #1E3A8A;
            padding: 15px;
            margin: 15px 0;
            border-radius: 0 5px 5px 0;
        }
        .logo-grid {
            display: flex;
            align-items: center;
            margin: 15px 0;
            padding: 15px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
    </style>
    """, unsafe_allow_html=True)

    # ============================================
    # TAB 1: 👥 ABOUT US
    # ============================================
    with tab_about:
        # NO repetir "About Us" - el tab ya lo dice
        about_texts = {
            'en': """
            <div class="content-text">
            <div class="highlight-box">
            <strong>AIdeaText</strong> is a digital technology company for human cognitive development based in Mexico. 
            Our solution has its core business in <strong>Semantic Reasoning Graphs (SRGs)</strong>, a technological 
            configuration that makes the critical thinking process visible, connecting educational 
            training with business needs by implementing a cognitive development measurement system 
            based on advanced natural language processing.
            </div>
            
            <div class="section-title">Validation & Stage</div>
            We have been validated by the <strong>NVIDIA Inception</strong> program for emerging companies and are in 
            an advanced development stage with a <a href="https://youtu.be/_4WMufl6MTA" target="_blank">functional MVP Demo</a><br> and a scalable <a href="https://youtu.be/Nt7IEas_P54" target="_blank"> business model</a> 
            in Latin America.
            
            <div class="section-title">Mission & Vision</div>
            <strong>Mission:</strong> To transform how the world measures and develops critical thinking.<br>
            <strong>Vision:</strong> To be the global standard for cognitive development assessment.
            
            <div class="section-title">Key Differentiators</div>
            • <strong>First cognitive development measurement system</strong> based on NLP<br>
            • <strong>Semantic Reasoning Graphs</strong> make thinking visible<br>
            • <strong>Validated by NVIDIA</strong> Inception Program<br>
            • <strong>Scalable model</strong> for Latin American education market
            """,
            
            'es': """
            <div class="content-text">
            <div class="highlight-box">
            <strong>AIdeaText</strong> es una empresa de tecnología digital para el desarrollo cognitivo humano con base en México. 
            Nuestra solución tiene su core business en los <strong>Grafos de Razonamiento Semántico (GRS)</strong>, una configuración 
            tecnológica que hace visible el proceso de pensamiento crítico, conectando la formación educativa con las 
            necesidades empresariales implementando un sistema de medición del desarrollo cognitivo basado en el 
            procesamiento avanzado del lenguaje natural.
            </div>
            
            <div class="section-title">Validación y Etapa</div>
            Hemos sido validados por el programa <strong>NVIDIA Inception</strong> para empresas emergentes y estamos en una fase 
            avanzada de desarrollo con un <a href="https://youtu.be/_4WMufl6MTA" target="_blank"> MVP funcional</a><br> 
            y un <a href="https://youtu.be/Nt7IEas_P54" target="_blank">modelo de negocio</a> escalable en Latinoamérica.
            
            <div class="section-title">Misión y Visión</div>
            <strong>Misión:</strong> Transformar cómo el mundo mide y desarrolla el pensamiento crítico.<br>
            <strong>Visión:</strong> Ser el estándar global para la evaluación del desarrollo cognitivo.
            
            <div class="section-title">Diferenciadores Clave</div>
            • <strong>Primer sistema de medición de desarrollo cognitivo</strong> basado en PLN.<br>
            • <strong>Grafos de Razonamiento Semántico</strong> hacen visible el pensamiento-<br>
            • <strong>Validado por NVIDIA</strong> Inception Program.<br>
            • <strong>Modelo escalable</strong> para el mercado educativo latinoamericano- 
            """
        }
        
        about_content = about_texts.get(lang_code, about_texts['en'])
        st.markdown(about_content, unsafe_allow_html=True)
        
    # ============================================
    # TAB 2: 🏆 CURRENT PROGRAMS
    # ============================================
    with tab_programs:
        # NO repetir "Current Programs" - el tab ya lo dice
        
        st.markdown('<div class="section-title">NVIDIA Inception Program</div>', unsafe_allow_html=True)
        
        # Fila 1: NVIDIA Inception
        col_nvidia_logo, col_nvidia_text = st.columns([1, 3])
        with col_nvidia_logo:
            st.image("https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/socialmedia/nvidia/nvidia-inception-program-badge-rgb-for-screen.png", 
                    width=300)
        with col_nvidia_text:
            st.markdown("""
            <div class="content-text">
            <strong>Exclusive program for AI and Deep Tech startups</strong>
            
            • **Access to NVIDIA GPUs** for training and inference
            • **Technical mentoring** from NVIDIA engineers
            • **Venture capital** opportunities ($250K+)
            • **Market validation** and business development
            • **Global network** of AI innovators
            
            <em>Status: Active Member</em>
            </div>
            """, unsafe_allow_html=True)
        
        st.markdown("---")
                
        st.markdown('<div class="section-title">incMTY Accelerator</div>', unsafe_allow_html=True)
        
        # Fila 2: incMTY
        col_inc_logo, col_inc_text = st.columns([1, 3])
        with col_inc_logo:
            st.image("https://huggingface.co/spaces/AIdeaText/v5Dev/resolve/main/assets/img/Logo_incMTY.png", 
                    width=250)
        with col_inc_text:
            st.markdown("""
            <div class="content-text">
            <strong>Deep Tech acceleration program</strong>
            
            <p>Inception is a free program that guides AI startups through the NVIDIA platform and ecosystem. 
            From prototype to production, Inception meets you where you are, with member benefits to help 
            you discover new AI opportunities, build with world-class technologies, and grow your business.</p>
            
            <em>Status: Current member</em>
            </div>
            """, unsafe_allow_html=True)
        
    # ============================================
    # TAB 3: 💰 COMPETITIONS
    # ============================================
    with tab_competitions:
        # NO repetir "Competitions" - el tab ya lo dice
        
        competitions_text = {
            'en': """
            <div class="content-text">
            <div class="highlight-box">
            Competing for <strong>$950K USD</strong> in prizes across multiple prestigious competitions.
            </div>
            
            <div class="section-title">Learning Tools Competition - $600K</div>
            <strong>Phase II - Top 50 Global</strong><br>
            <em>International Society for Technology in Education (ISTE)</em><br>
            Competing with 1,200 projects from 75 countries
            
            <div class="section-title">NVIDIA Inception - $250K</div>
            <strong>Venture Capital Program</strong><br>
            <em>NVIDIA Corporation</em><br>
            Exclusive program for Deep Tech startups
            
            <div class="section-title">Kaggle/Google - $100K</div>
            <strong>Explainable AI Models</strong><br>
            <em>Google Research</em><br>
            Research in interpretable AI for education
            </div>
            """,
            
            'es': """
            <div class="content-text">
            <div class="highlight-box">
            Competimos por <strong>$950K USD</strong> en premios en múltiples competencias prestigiosas.
            </div>
            
            <div class="section-title">Learning Tools Competition - $600K</div>
            <strong>Fase II - Top 50 Global</strong><br>
            <em>International Society for Technology in Education (ISTE)</em><br>
            Compitiendo con 1,200 proyectos de 75 países
            
            <div class="section-title">NVIDIA Inception - $250K</div>
            <strong>Programa de Capital de Riesgo</strong><br>
            <em>NVIDIA Corporation</em><br>
            Programa exclusivo para startups de Deep Tech
            
            <div class="section-title">Kaggle/Google - $100K</div>
            <strong>Modelos Explicables de IA</strong><br>
            <em>Google Research</em><br>
            Investigación en IA interpretable para educación
            </div>
            """
        }
        
        content = competitions_text.get(lang_code, competitions_text['en'])
        st.markdown(content, unsafe_allow_html=True)
        
        #st.markdown("---")
        #if st.button("🎯 Apply as Beta Tester", use_container_width=True):
        #    st.info("Beta tester program launching Q1 2025")

    # ============================================
    # TAB 4: 🎯 USE CASES
    # ============================================
    with tab_use_case:
        # NO repetir "Use Cases" - el tab ya lo dice
        
        st.markdown("""
        <div class="content-text">
        Select a demonstration to see practical applications of our technology:
        </div>
        """, unsafe_allow_html=True)
        
        use_case_videos = {
            "📊 Semantic Analysis Advanced": "https://youtu.be/_4WMufl6MTA",
            "🧠 Reasoning Mapping": "https://youtu.be/hXnwUvN1Q9Q",
            "🎓 Formative Assessment": "https://www.youtube.com/watch?v=Fqi4Di_Rj_s"
        }
        
        selected_title = st.selectbox(
            "Select demonstration:" if lang_code == 'en' else "Selecciona demostración:", 
            list(use_case_videos.keys())
        )
        
        if selected_title in use_case_videos:
            try:
                st_player(
                    use_case_videos[selected_title],
                    height=400,
                    playing=False,
                    controls=True,
                    light=True
                )
            except Exception as e:
                st.error(f"Error loading video: {str(e)}" if lang_code == 'en' else f"Error al cargar el video: {str(e)}")
        
        # Información adicional sobre casos de uso
        st.markdown("""
        <div class="content-text">
        <div class="section-title">Applications</div>
        
        <strong>For Students:</strong>
        • Visualize thinking processes
        • Receive immediate feedback
        • Improve academic writing
        • Track cognitive progress
        
        <strong>For Educators:</strong>
        • Assess deep understanding
        • Identify individual needs
        • Personalize teaching
        • Save grading time
        
        <strong>For Institutions:</strong>
        • Measure cognitive development
        • Improve academic outcomes
        • Validated educational innovation
        • Data for research
        </div>
        """, unsafe_allow_html=True)

    # ============================================
    # TAB 5: 🎬 PITCHES & PRESENTATIONS
    # ============================================
    with tab_presentations:
        # NO repetir "Pitches & Presentations" - el tab ya lo dice
        
        st.markdown("""
        <div class="content-text">
        Watch our key pitches, demonstrations, and conference presentations:
        </div>
        """, unsafe_allow_html=True)
        
        videos = {
            "🎬 AIdeaText Reel (90 seconds)": "https://youtu.be/hXnwUvN1Q9Q",
            "🏆 SENDA UNAM Presentation": "https://www.youtube.com/watch?v=XFLvjST2cE0",        
            "🐍 PyCon 2024 Presentation": "https://www.youtube.com/watch?v=Jn545-IKx5Q",
            "👨‍🏫 Ser Maaestro Foundation": "https://www.youtube.com/watch?v=imc4TI1q164",
            "🚀 Tec de Monterrey Demo": "https://www.youtube.com/watch?v=Fqi4Di_Rj_s",
            "🎙️ Interview with Dr. Guillermo Ruíz": "https://www.youtube.com/watch?v=_ch8cRja3oc",
            "💻 Desktop Version Demo": "https://www.youtube.com/watch?v=nP6eXbog-ZY"
        }

        selected_title = st.selectbox(
            "Select video:" if lang_code == 'en' else "Selecciona video:", 
            list(videos.keys())
        )
        
        if selected_title in videos:
            try:
                st_player(
                    videos[selected_title],
                    height=400,
                    playing=False,
                    controls=True,
                    light=True
                )
            except Exception as e:
                st.error(f"Error loading video: {str(e)}" if lang_code == 'en' else f"Error al cargar el video: {str(e)}")
        
        # Próximos eventos
        st.markdown("""
        <div class="content-text">
        <div class="section-title">Upcoming Events</div>
        
        <strong>2025</strong>
        • <strong>WebSummit Rio 2025</strong> - April 27-30, Rio de Janeiro, Brazil<br>
        • <strong>ISTE Conference 2025</strong> - June 22-25, Denver, USA<br>
        • <strong>EdTechX Europe 2025</strong> - October, London, UK
        
        <em>Confirmed participation in showcases and panels.</em>
        </div>
        """, unsafe_allow_html=True)

    # ============================================
    # TAB 6: 📸 EVENTS & RECOGNITION
    # ============================================
    with tab_gallery:
        # NO repetir "Events & Recognition" - el tab ya lo dice
        
        st.markdown("""
        <div class="content-text">
        Gallery of our participation in events and recognition received:
        </div>
        """, unsafe_allow_html=True)
        
        show_carousel()
        
#############################################################
#############################################################
# Definición de __all__ para especificar qué se exporta
__all__ = ['main', 'login_register_page', 'initialize_session_state']

# Bloque de ejecución condicional
if __name__ == "__main__":
    main()