import streamlit as st
from .join_us import join_us

def home():

    # Custom CSS to style the page
    st.markdown("""
        <style>
            body {
                
                background-color: #f4f4f4;
            }

            .header-content {
                background-color: #ffffff;
                color: #450012;
                max-width: 800px;
                margin: 0 auto;
                padding: 1rem;
                text-align: center;
            }

          

            .container {
                max-width: 800px;
                margin: 0 auto 2rem;
                padding: 1rem;
                background-color: #fff;
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            }

            h2 {
                border-bottom: 2px solid #333;
                padding-bottom: 10px;
            }

            ul {
                list-style-type: none;
                padding: 0;
            }

            ul li {
                padding: 10px 0;
            }

            .faculty-row {
                display: flex;
                justify-content: space-between;
                margin-top: 10px;
            }
            
            .faculty {
                text-align: center;
                flex: 1;
                margin: 0 15px;
            }
            
            .faculty img {
                height: 210px;
                width: 140px;
                margin-bottom: 10px;
            }
            
            .faculty-info {
                margin-top: 10px;
            }

            .join {
                text-align: center;
                margin-top: 2rem;
            }
           
        </style>
    """, unsafe_allow_html=True)

    # Header
    st.markdown("""
        <div class="header-content">
            <h1>BuffTeks Student Organization</h1>
            <p>Building Skills, Crafting Code, Bridging Communities</p>
        </div>
    """, unsafe_allow_html=True)


    # Our Mission
    st.markdown("""
        <section>
            <h2>Our Mission</h2>
            <p>Empower members with advanced software development knowledge, foster new skills and technologies in a collaborative and engaging community.</p>
        </section>
    """, unsafe_allow_html=True)

    # Our Activities
    st.markdown("""
        <section>
            <h2>Our Activities</h2>
            <ul>
                <li><strong>BuffTeks Project:</strong> Faculty-led coding projects to provide IT solutions and support to problems facing local communities as part of an experiential learning effort.</li>
                <li><strong>BuffTeks Classroom:</strong> An open learning platform devoted to sharing knowledge of information technology including Python programming and web application development.</li>
                <li><strong>BuffTeks Event:</strong> Host competitions and hackathons that empower students to use classroom knowledge for real-world solutions.</li>
            </ul>
        </section>
    """, unsafe_allow_html=True)

    # Faculty Advisors
    st.markdown(
        """
        <section>
            <h2>Faculty Advisors</h2>
            <div class="faculty-container">
                <div class="faculty-row">
                    <div class="faculty">
                        <img src="https://www.wtamu.edu/_files/images/academics/college-business/headshots/babb-jeffry-22.png" alt="Dr. Jeffry Babb">
                        <div class="faculty-info">
                            <strong>Dr. Jeffry Babb</strong><br>
                            BuffTeks Founder<br>
                        </div>
                    </div>
                    <div class="faculty">
                        <img src="https://www.wtamu.edu/_files/images/academics/college-business/headshots/zhang-carl-22.png" alt="Dr. Carl Zhang">
                        <div class="faculty-info">
                            <strong>Dr. Carl Zhang</strong><br>
                            <a href="mailto:czhang@wtamu.edu">czhang@wtamu.edu</a>
                        </div>
                    </div>
                    <div class="faculty">
                        <img src="https://www.wtamu.edu/_files/images/academics/college-business/headshots/dana-kareem-22.png" alt="Mr. Kareem Dana">
                        <div class="faculty-info">
                            <strong>Mr. Kareem Dana</strong><br>
                            <a href="mailto:kdana@wtamu.edu">kdana@wtamu.edu</a>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    """, unsafe_allow_html=True)
    
    # Student Officers
    # load image in base64
    
    import base64
    def load_image(image_path):
        with open(image_path, "rb") as image_file:
            return base64.b64encode(image_file.read()).decode()

    jesus_torres_img = load_image("./images/student_officer_photo/jesus_torres.jpg")
    benjamin_mosley_img = load_image("./images/student_officer_photo/benjamin_mosley.jpg")

    st.markdown(
        f"""
        <section>
            <h2>Student Officers</h2>
            <div class="faculty-container">
                <div class="faculty-row">
                    <div class="faculty">
                        <img src="data:image/jpeg;base64,{jesus_torres_img}" alt="Jesus Torres">
                        <div class="faculty-info">
                            <strong>Jesus Torres</strong><br>
                            President <br>
                            <a href="mailto:jtorres8@buffs.wtamu.edu">jtorres8@buffs.wtamu.edu</a>
                        </div>
                    </div>
                    <div class="faculty">
                        <img src="data:image/jpeg;base64,{benjamin_mosley_img}" alt="Benjamin Mosley">
                        <div class="faculty-info">
                            <strong>Benjamin Mosley</strong><br>
                            Tech Lead <br>
                            <a href="mailto:brmosley1@buffs.wtamu.edu">brmosley1@buffs.wtamu.edu</a>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    """, unsafe_allow_html=True)
