/* Basic Reset */
* {
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Share Tech Mono', monospace, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    color: #00ff99;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background-color: #00ff99;
    border-radius: 4px;
    border: 2px solid #0a0a0a;
}

/* Login Page */
.login-body {
    background: linear-gradient(135deg, #000000 0%, #003300 100%);
    color: #00ff99;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
    user-select: none;
}

.login-container {
    background: rgba(0, 255, 153, 0.1);
    padding: 40px 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow:
        0 0 10px #00ff99,
        0 0 20px #00ff99,
        0 0 30px #00ff99;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #00ff99;
    backdrop-filter: blur(6px);
    position: relative;
}

.login-container:hover {
    transform: translateY(-8px);
    box-shadow:
        0 0 20px #00ff99,
        0 0 40px #00ff99,
        0 0 60px #00ff99;
}

.login-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.15em;
    text-shadow: 0 0 8px #00ff99;
    text-transform: uppercase;
}

/* Inputs */
.login-container input {
    width: 100%;
    padding: 14px 15px;
    margin: 12px 0;
    border: 1px solid #00ff99;
    border-radius: 8px;
    background: transparent;
    color: #00ff99;
    font-size: 1rem;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    font-family: 'Share Tech Mono', monospace;
}

.login-container input::placeholder {
    color: #00ff9944;
}

.login-container input:focus {
    outline: none;
    border-color: #00ff99;
    box-shadow: 0 0 15px #00ff99;
}

/* Buttons */
.login-container button {
    background: #00ff99;
    color: black;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow: 0 0 10px #00ff99;
}

.login-container button:hover {
    background: #00cc66;
    box-shadow: 0 0 20px #00ff99, 0 0 30px #00cc66;
}

/* Logout Link */
.logout-link {
    display: inline-block;
    margin-top: 15px;
    color: #00ff99aa;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.3s ease;
    font-family: 'Share Tech Mono', monospace;
}

.logout-link:hover {
    text-decoration: underline;
    color: #ff3333;
}

/* Chat App Layout */
.chat-wrapper {
    display: flex;
    height: 100vh;
    background: #000000;
    overflow: hidden;
    color: #00ff99;
}

/* Sidebar */
.chat-sidebar {
    width: 280px;
    background: #001a00;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #00ff99 transparent;
    border-right: 1px solid #00ff99;
    box-shadow:
        inset -2px 0 8px #00ff99;
}

.chat-sidebar::-webkit-scrollbar {
    width: 6px;
}

.chat-sidebar::-webkit-scrollbar-thumb {
    background-color: #00ff99;
    border-radius: 3px;
}

.chat-sidebar h3 {
    margin-top: 0;
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0 0 10px #00ff99;
}

.chat-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.chat-sidebar li a {
    display: block;
    color: #00ff99cc;
    padding: 10px 12px;
    margin-bottom: 8px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.05em;
    text-shadow: 0 0 5px #00ff99;
}

.chat-sidebar li a.active,
.chat-sidebar li a:hover {
    background: #004d00;
    color: #00ff99;
    box-shadow: 0 0 10px #00ff99;
}

/* Clear button */
.chat-sidebar .clear-btn {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    background: #00ff99;
    color: black;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.1em;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 10px #00ff99;
}

.chat-sidebar .clear-btn:hover {
    background: #00cc66;
    box-shadow: 0 0 20px #00ff99, 0 0 30px #00cc66;
}

/* Logout fixed */
.logout-fixed {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

.logout-link {
    color: #ff3333;
    font-weight: 700;
    text-decoration: none;
    font-family: 'Share Tech Mono', monospace;
}

.logout-link:hover {
    text-decoration: underline;
    color: #ff6666;
}

/* Chat Main Section */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000000;
    box-shadow: inset 4px 0 8px #00ff99;
    border-left: 1px solid #00ff99;
    overflow: hidden;
}

.chat-header {
    background: #003300;
    color: #00ff99;
    padding: 18px 20px;
    font-weight: 700;
    font-size: 1.5rem;
    text-align: center;
    user-select: none;
    box-shadow: 0 2px 6px #00ff99;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 0 0 15px #00ff99;
}

/* Chat Box */
.chat-box {
    flex: 1;
    padding: 25px 20px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #00ff99 transparent;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #00ff99;
    text-shadow: 0 0 5px #00ff99;
}

/* Chat Form */
.chat-form {
    display: flex;
    border-top: 1px solid #004d00;
    padding: 10px 15px;
    background: #001a00;
}

.chat-form input[type="text"] {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid #00ff99;
    border-radius: 25px;
    background: transparent;
    color: #00ff99;
    font-size: 1rem;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.05em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-form input[type="text"]::placeholder {
    color: #00ff9977;
}

.chat-form input[type="text"]:focus {
    outline: none;
    border-color: #00ff99;
    box-shadow: 0 0 15px #00ff99;
}

.chat-form button {
    margin-left: 15px;
    padding: 14px 25px;
    background: #00ff99;
    border: none;
    border-radius: 25px;
    color: black;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 10px #00ff99;
}

.chat-form button:hover {
    background: #00cc66;
    box-shadow: 0 0 20px #00ff99, 0 0 30px #00cc66;
}

/* Messages */
.msg {
    margin-bottom: 14px;
    line-height: 1.5;
    font-size: 1rem;
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 20px;
    display: inline-block;
    word-wrap: break-word;
    box-shadow: 0 0 10px #00ff99;
    font-family: 'Share Tech Mono', monospace;
}

.msg.user {
    background: #00ff99;
    color: black;
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 4px;
    text-shadow: none;
}

.msg.ai {
    background: #003300;
    color: #00ff99;
    text-align: left;
    border-bottom-left-radius: 4px;
    text-shadow: 0 0 8px #00ff99;
}

/* Sidebar Actions */
.sidebar-actions {
    margin-top: 20px;
}

.sidebar-actions form,
.sidebar-actions a {
    display: block;
    margin-top: 12px;
}

/* Responsive Design */

/* Tablets and smaller desktops */
@media (max-width: 1024px) {
    .chat-sidebar {
        width: 220px;
    }
    .login-container {
        max-width: 350px;
    }
}

/* Mobile phones */
@media (max-width: 768px) {
    .chat-wrapper {
        flex-direction: column;
        height: 100vh;
    }
    .chat-sidebar {
        width: 100%;
        height: 140px;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px 8px;
        flex-wrap: nowrap;
        border-right: none;
        border-bottom: 1px solid #00ff99;
        box-shadow: inset 0 -2px 8px #00ff99;
    }
    .chat-sidebar ul {
        display: flex;
        flex-direction: row;
        gap: 12px;
        padding: 0;
        margin: 0;
    }
    .chat-sidebar li a {
        padding: 10px 16px;
        white-space: nowrap;
        border-radius: 14px;
        font-size: 1rem;
        transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
    }
    .chat-sidebar .clear-btn {
        flex-shrink: 0;
        margin-top: 0;
        height: 42px;
        align-self: center;
        padding: 0 24px;
        font-size: 1rem;
        border-radius: 14px;
    }
    .logout-fixed {
        position: static;
        margin-top: 14px;
        text-align: center;
    }
    .chat-main {
        flex: 1;
        height: calc(100vh - 140px);
        min-height: 0;
    }
    .chat-header {
        font-size: 1.4rem;
        padding: 14px 12px;
    }
    .chat-box {
        padding: 18px 14px;
        font-size: 1.05rem;
    }
    .chat-form input[type="text"] {
        font-size: 1rem;
        padding: 14px 16px;
        border-radius: 25px;
    }
    .chat-form button {
        padding: 14px 24px;
        font-size: 1rem;
        border-radius: 25px;
    }
    .login-container {
        max-width: 90vw;
        padding: 30px 24px;
        border-radius: 14px;
        box-shadow:
            0 0 15px #00ff99,
            0 0 30px #00ff99;
    }
    .login-container h2 {
        font-size: 1.7rem;
        margin-bottom: 18px;
    }
    .login-container input {
        font-size: 1.1rem;
        padding: 14px 16px;
        border-radius: 10px;
    }
    .login-container button {
        font-size: 1.1rem;
        padding: 14px;
        border-radius: 10px;
    }
    .logout-link {
        font-size: 0.95rem;
        margin-top: 18px;
    }
}

/* Very small phones */
@media (max-width: 400px) {
    .login-container {
        padding: 25px 20px;
    }
    .chat-sidebar {
        height: 120px;
    }
    .chat-sidebar li a {
        font-size: 0.9rem;
        padding: 8px 14px;
    }
    .chat-header {
        font-size: 1.15rem;
        padding: 10px 8px;
    }
}
