/* --- Root Variables --- */
:root {
    --primary-color: #0084ff;
    --error-color: #dc3545;
    --online-color: #31a24c;

    /* Light Theme */
    --light-bg: #f0f2f5;
    --light-container-bg: #ffffff;
    --light-text: #050505;
    --light-bubble-sent: #0084ff;
    --light-bubble-sent-text: #ffffff;
    --light-bubble-received: #e4e6eb;
    --light-bubble-received-text: #050505;
    --light-border: #ced0d4;
    --light-meta-text: #65676b;

    /* Dark Theme */
    --dark-bg: #18191a;
    --dark-container-bg: #242526;
    --dark-text: #e4e6eb;
    --dark-bubble-sent: #0084ff;
    --dark-bubble-sent-text: #ffffff;
    --dark-bubble-received: #3a3b3c;
    --dark-bubble-received-text: #e4e6eb;
    --dark-border: #3a3b3c;
    --dark-meta-text: #b0b3b8;
}

/* --- General Body & Themeing --- */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body.light-theme {
    background-color: var(--light-bg);
    color: var(--light-text);
}

body.dark-theme {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

.container {
    width: 100%;
    max-width: 700px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s;
}

body.light-theme .container { background: var(--light-container-bg); }
body.dark-theme .container { background: var(--dark-container-bg); }


/* --- Nav Menu --- */
.menus {
    width: 100%;
    max-width: 590px;
    z-index: 10;
}

.name{
    font-size: 50px;
    font-weight: bold;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.catagory{
    color: var(--error-color);
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    margin-top: 20px;
}
nav {
    margin: 0;
    position: relative;
    width: 100%;
    height: 50px;
    background-color: #34495e;
    border-radius: 50px;
    font-size: 0;
    display: flex;
}
nav a {
    flex: 1;
    line-height: 50px;
    height: 100%;
    font-size: 15px;
    display: inline-block;
    position: relative;
    z-index: 1;
    text-decoration: none;
    text-transform: uppercase;
    text-align: center;
    color: white;
    cursor: pointer;
}
nav .animation {
    position: absolute;
    height: 100%;
    top: 0;
    z-index: 0;
    transition: all .5s ease 0s;
    border-radius: 50px;
}
/* These fixed widths are problematic for responsiveness. Flexbox handles it better. */
/* The hover logic below is complex; a simpler JS-based solution would be more maintainable */
nav a:nth-child(1):hover~.animation { width: 110px; left: 0px; background-color: #1abc9c; }
nav a:nth-child(2):hover~.animation { width: 110px; left: 120px; background-color: #e74c3c; }
nav a:nth-child(3):hover~.animation { width: 100px; left: 245px; background-color: #3498db; }
nav a:nth-child(4):hover~.animation { width: 120px; left: 352px; background-color: #9b59b6; }
nav a:nth-child(5):hover~.animation { width: 120px; left: 470px; background-color: #e67e22; }

/* --- Lobby View --- */
#lobby-container {
    margin-bottom: 60px;
}

.app-name{
    color: #34495e;
}

.app-des{
    font-size: 20px;
    color: #1abc9c;
    font-weight: bold;
}
#lobby-container p {
    text-align: center;
}
.instructions {
    margin-top: 20px;
    font-size: 0.9em;
    color: var(--light-meta-text);
}
body.dark-theme .instructions {
    color: var(--dark-meta-text);
}
.instructions ul {
    text-align: left;
    padding-left: 20px;
}

.form-field {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-family: inherit;
    border-radius: 8px;
    border: 1px solid var(--light-border);
    background: var(--light-bg);
    transition: border-color .3s ease, box-shadow .3s ease;
    box-sizing: border-box;
}
body.dark-theme .form-field {
    border-color: var(--dark-border);
    background: var(--dark-bg);
    color: var(--dark-text);
}
.form-field::placeholder {
    color: var(--light-meta-text);
}
body.dark-theme .form-field::placeholder {
    color: var(--dark-meta-text);
}
.form-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.25);
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

/* --- Chat View --- */
#chat-app-container { 
    display: flex; 
    gap: 20px; 
    width: 100%; 
    max-width: 1200px;
    height: 85vh;
}
#user-list-container {
    flex: 0 0 220px;
    padding: 20px;
    border-radius: 12px;
    height: 100%;
    box-sizing: border-box;
}
body.light-theme #user-list-container { background: var(--light-container-bg); }
body.dark-theme #user-list-container { background: var(--dark-container-bg); }

#user-list { list-style: none; padding: 0; margin: 0; }
#user-list li { padding: 8px 0; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.online-indicator { width: 10px; height: 10px; background-color: var(--online-color); border-radius: 50%; }

#chat-container { 
    flex-grow: 1; 
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

h1, h2, h3 { color: var(--primary-color); margin-top: 0; }
h1 { text-align: center; }
h2 { font-size: 1.2em; margin: 0; flex-grow: 1; text-align: left; }
h3 { margin-bottom: 10px; border-bottom: 1px solid; padding-bottom: 10px; }
body.light-theme h3 { border-color: var(--light-border); }
body.dark-theme h3 { border-color: var(--dark-border); }

.chat-header {
    display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid;
}
body.light-theme .chat-header { border-color: var(--light-border); }
body.dark-theme .chat-header { border-color: var(--dark-border); }

/* --- NEW: WhatsApp/Messenger Style Messages --- */
#messages {
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 20px; 
    display: flex; 
    flex-direction: column;
    gap: 12px;
}
.message-wrapper { 
    display: flex; 
    flex-direction: column; 
    max-width: 80%;
}
.message-wrapper.sender { align-self: flex-end; align-items: flex-end; }
.message-wrapper.receiver { align-self: flex-start; align-items: flex-start; }

.message { 
    padding: 10px 15px; 
    border-radius: 18px; 
    word-wrap: break-word; 
    position: relative;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}
.message:hover .delete-btn { opacity: 1; }

/* Bubble colors and shapes */
.message.sender { 
    background-color: var(--light-bubble-sent); 
    color: var(--light-bubble-sent-text); 
    border-bottom-right-radius: 4px; 
}
.message.receiver { 
    background-color: var(--light-bubble-received); 
    color: var(--light-bubble-received-text); 
    border-bottom-left-radius: 4px;
}
body.dark-theme .message.sender { background-color: var(--dark-bubble-sent); color: var(--dark-bubble-sent-text); }
body.dark-theme .message.receiver { background-color: var(--dark-bubble-received); color: var(--dark-bubble-received-text); }

/* Bubble "tails" using pseudo-elements */
.message::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border: 10px solid transparent;
}
.message.sender::after {
    right: -10px;
    border-left-color: var(--light-bubble-sent);
    border-bottom-color: var(--light-bubble-sent);
}
.message.receiver::after {
    left: -10px;
    border-right-color: var(--light-bubble-received);
    border-bottom-color: var(--light-bubble-received);
}
body.dark-theme .message.sender::after {
    border-left-color: var(--dark-bubble-sent);
    border-bottom-color: var(--dark-bubble-sent);
}
body.dark-theme .message.receiver::after {
    border-right-color: var(--dark-bubble-received);
    border-bottom-color: var(--dark-bubble-received);
}
/* --- END: New Message Styles --- */

.message-meta { 
    font-size: 0.75em; 
    margin-top: 4px;
    padding: 0 5px;
}
body.light-theme .message-meta { color: var(--light-meta-text); }
body.dark-theme .message-meta { color: var(--dark-meta-text); }

.message-content img, .message-content video, .message-content audio { max-width: 100%; border-radius: 10px; margin-top: 5px; }
.message-content a { color: inherit !important; text-decoration: underline; }

.delete-btn {
    position: absolute; top: -10px; right: 0px; background: #ff4d4d; color: white; border: none;
    border-radius: 50%; width: 22px; height: 22px; cursor: pointer; opacity: 0;
    transition: opacity 0.2s, transform 0.2s; font-size: 12px; line-height: 22px; text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.delete-btn:hover { transform: scale(1.1); }
.message.receiver .delete-btn { right: auto; left: 0px; }


/* --- Input Area --- */
.message-input-area { 
    display: flex; 
    gap: 10px; 
    padding: 10px 20px;
    align-items: center; 
    position: relative; 
    border-top: 1px solid var(--light-border);
}
body.dark-theme .message-input-area {
    border-top-color: var(--dark-border);
}

.input-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
}

#message-input {
    width: 100%;
    padding: 12px 18px 12px 45px;
    border-radius: 22px; 
    border: 1px solid transparent;
    transition: border-color 0.3s;
    box-sizing: border-box;
}
body.light-theme #message-input { background: var(--light-bubble-received); border-color: var(--light-border); color: var(--light-text); }
body.dark-theme #message-input { background: var(--dark-bubble-received); border-color: var(--dark-border); color: var(--dark-text); }
#message-input:focus { outline: none; border-color: var(--primary-color); }

.input-action-btn, .file-input-label, #send-btn {
    font-size: 1.4em; 
    cursor: pointer; 
    border: none; 
    background: transparent; 
    padding: 8px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s, background-color 0.2s;
}
body.light-theme .input-action-btn, body.light-theme .file-input-label, body.light-theme #send-btn { color: var(--light-meta-text); }
body.dark-theme .input-action-btn, body.dark-theme .file-input-label, body.dark-theme #send-btn { color: var(--dark-meta-text); }
.input-action-btn:hover, .file-input-label:hover, #send-btn:hover { 
    color: var(--primary-color); 
    background-color: rgba(0,0,0,0.05);
}
#send-btn { background-color: var(--primary-color); color: white; }
#send-btn:hover { background-color: #0060c0; color: white; }

#emoji-btn { 
    position: absolute; 
    left: 0; 
    top: 50%; 
    transform: translateY(-50%); 
}

/* --- Emoji Picker --- */
emoji-picker { position: absolute; bottom: 65px; left: 10px; z-index: 100; }

/* --- Camera Modal --- */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 20px; border-radius: 12px; text-align: center; }
#camera-feed { width: 100%; max-width: 500px; border-radius: 8px; }

/* --- General UI & Button Animations --- */
button {
    padding: 10px 20px; 
    background-color: var(--primary-color); 
    color: white; 
    border: none;
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s ease-out;
}
button:hover { 
    background-color: #0073e6;
    transform: scale(1.03);
}
button:active {
    background-color: #0060c0;
    transform: scale(0.98);
}
.header-buttons button { background: transparent; }
body.light-theme .header-buttons button { color: var(--light-meta-text); }
body.dark-theme .header-buttons button { color: var(--dark-meta-text); }
.header-buttons button:hover { background: rgba(0,0,0,0.1); transform: scale(1.05); }

.error { color: var(--error-color); text-align: center; margin-top: 15px; height: 1em; font-weight: 500; }

/* --- NEW: Footer Styles --- */
footer {
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 5px;
    background-color: var(--light-footer-bg);
    border-top: 1px solid var(--light-border);
    transition: background-color 0.3s, border-color 0.3s;
    z-index: 999;
}
body.dark-theme footer {
    background-color: var(--dark-footer-bg);
    border-top-color: var(--dark-border);
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.footer-content p {
    text-align: center;
    margin: 0;
    font-size: 0.9em;
}
.social-links {
    display: flex;
    gap: 10px;
}
.social-links a {
    color: inherit;
    font-size: 1.2em;
    width: 36px;
    height: 36px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
}
.social-links a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}


/* --- RESPONSIVE DESIGN --- */

/* Tablet View */
@media (max-width: 1024px) {
    #chat-app-container {
        max-width: 95%;
    }
    #user-list-container {
        flex-basis: 180px;
    }
}

/* Mobile View */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    .menus {
        top: 0;
        width: 100%;
        max-width: 100%;
        position: relative;
        transform: none;
        left: 0;
    }

    #main-nav{
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    nav {
        border-radius: 0;
        height: auto;
        flex-wrap: wrap;
    }
    nav a {
        font-size: 13px;
        flex-basis: 33.33%; /* 3 items per row */
        line-height: 40px;
    }
    nav .animation {
        display: none; /* Hiding complex animation on mobile for simplicity */
    }
     .footer-content {
        flex-direction: column;
        gap: 10px;
    }
    

    #lobby-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        justify-content: flex-start;
        padding-top: 50px;
        margin-top: 0;
    }

    #chat-app-container {
        flex-direction: column;
        width: 100%;
        height: calc(100vh - 50px); /* Adjust height for nav bar */
        gap: 0;
        max-width: 100%;
    }
    #user-list-container {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        max-height: 25vh;
        overflow-y: auto;
        border-radius: 0;
        border-bottom: 1px solid var(--light-border);
    }
    body.dark-theme #user-list-container {
        border-bottom-color: var(--dark-border);
    }

    #chat-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .chat-header {
        border-radius: 0;
    }
    #messages {
        padding: 10px;
    }
    .message-wrapper {
        max-width: 90%;
    }
    .message-input-area {
        padding: 8px 10px;
    }
}



.office-link{
    text-decoration: none;
    color: black;
    font-weight: bold;
    font-size: 22px
}