html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: url('../img/404_background.png') no-repeat center center fixed;
    background-size: cover;
    font-family: Arial, sans-serif;
    color: #fff;
}

.ui-dialog {
    box-shadow: 0 0 30px rgba(0, 191, 255, 0.8);
    border: 2px solid #0080c0;
    background: rgba(5, 5, 15, 0.92);
    backdrop-filter: blur(3px);
}

.ui-dialog-titlebar {
    background: #000c1a;
    color: #00bfff;
    border: none;
}

.ui-dialog .ui-dialog-content {
    overflow: hidden;
}

.ui-dialog .ui-dialog-titlebar-reset {
    background: none;
    border: none;
    color: #00bfff;
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    margin-left: 0.5em;
}

.ui-widget-content {
    color: #aaa;
}

.ui-dialog .ui-dialog-titlebar-reset:hover {
    color: #44cc44;
}

#loginForm label,
#loginForm input,
#loginForm button {
    display: block;
    margin: 10px auto;
    width: 80%;
}

#loginForm input {
    padding: 10px;
    border: none;
    border-radius: 5px;
}

#loginForm button {
    background-color: #00bfff;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
}

#chatDialog {
    display: none;
    font-size: 14px;
}

/* Chat log styling */
#chatMessages {
    height: 600px;
    overflow-y: auto;
    background: #111;
    padding: 10px;
    border: 1px solid #00bfff;
    margin-bottom: 10px;

    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Bubble base */
.bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 20px;
    word-wrap: break-word;
    position: relative;
    line-height: 1.4;
}

/* User (blue) bubbles on the right */
.bubble.user {
    align-self: flex-end;
    background: #007aff;
    color: #fff;
    border-bottom-right-radius: 5px;
}

/* Assistant (gray) bubbles on the left */
.bubble.assistant {
    align-self: flex-start;
    background: #444444;
    color: #fff;
    border-bottom-left-radius: 5px;
    min-width: 17px;
}

.bubble.assistant img {
    width: 100%;
}

#chatInput {
    width: calc(100% - 22px);
    padding: 10px;
}

#accessDenied {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    color: #ff4444;
    font-size: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    text-align: center;
    padding: 20px;
    white-space: pre-wrap;
    font-family: monospace;
}

#connectingIndicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    color: #44cc44;
    font-size: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    text-align: center;
    padding: 20px;
    white-space: pre-wrap;
    font-family: monospace;
}

.bubble.assistant.typing {
    position: relative;
}

.typing-dots {
    display: inline-flex;
    gap: 0.25rem;
    align-items: flex-end;
    height: 0.2rem;
}

.dot {
    width: 0.2rem;
    height: 0.2rem;
    border-radius: 9999px;
    background: rgba(148 163 184 / 0);
    animation: wave 1s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: 0s;      }
.dot:nth-child(2) { animation-delay: 0.33s;   }
.dot:nth-child(3) { animation-delay: 0.66s;   }

@keyframes wave {
    0%   { transform: translateY(0);    background: rgba(255 255 255 / 0);   }
    50%  { transform: translateY(-0.5rem); background: rgba(255 255 255 / 0.8); }
    100% { transform: translateY(0);    background: rgba(255 255 255 / 0);   }
}


/*-----------------------------------
  Mobile & small‑screen adaptations
------------------------------------*/
@media only screen and (max-width: 600px) {
    /* full‑screen dialogs */
    .ui-dialog {
        width: 100% !important;
        height: 100% !important;
        margin: 0;
        padding: 0;
        border-radius: 0;
        top: 0 !important;
        left: 0 !important;
    }

    .ui-dialog .ui-dialog-content {
        /* fill most of screen, leave room for input */
        box-sizing: border-box;
        height: calc(100vh - 56px) !important; /* 56px ~ titlebar height */
        padding: 0;
        overflow-y: auto;
    }

    /* chatMessages takes up the space above the input */
    #chatMessages {
        height: calc(100vh - 120px) !important; /* adjust if your input + padding differ */
        padding: 8px;
    }

    /* full‑width input stuck to bottom */
    #chatInput {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100% !important;
        box-sizing: border-box;
        font-size: 1.1em;
        padding: 12px;
        border-top: 1px solid #00bfff;
        background: rgba(0, 0, 0, 0.9);
        color: #fff;
    }

    /* slightly larger bubbles for readability */
    .bubble {
        font-size: 1em;
        max-width: 85%;
        padding: 12px 16px;
        line-height: 1.5;
    }

    .bubble.user {
        border-bottom-right-radius: 8px;
    }

    .bubble.assistant {
        border-bottom-left-radius: 8px;
    }

    /* tweak titlebar text / reset‑button sizes */
    .ui-dialog-titlebar {
        padding: 0.4em 1em;
    }

    .ui-dialog-title {
        font-size: 1.2em;
    }

    .ui-dialog .ui-dialog-titlebar-reset {
        font-size: 1.4em;
        margin-left: 0.5em;
    }
}

/*-----------------------------------
  Landscape on small‑height devices
------------------------------------*/
@media only screen
and (orientation: landscape)
and (max-height: 600px) {

    /* keep dialogs full screen */
    .ui-dialog {
        width: 100% !important;
        height: 100% !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0;
        border-radius: 0;
    }

    .ui-dialog .ui-dialog-content {
        /* leave room for titlebar+input */
        height: calc(100vh - 44px) !important;
    }

    /* shrink chatMessages so it fits */
    #chatMessages {
        height: calc(100vh - 72px) !important; /* 44px title + ~28px input */
    }

    /* adjust the input bar */
    #chatInput {
        font-size: 1em;
        padding: 8px;
        border-top: 1px solid #00bfff;
        color: #fff;
    }

    /* slightly tighter bubbles */
    .bubble {
        max-width: 80%;
        padding: 10px 14px;
        font-size: 0.95em;
    }

    /* titlebar tweaks */
    .ui-dialog .ui-dialog-titlebar {
        padding: 0.3em 0.8em;
    }

    .ui-dialog .ui-dialog-title {
        font-size: 1.1em;
    }

    .ui-dialog .ui-dialog-titlebar-reset {
        font-size: 1.2em;
    }
}

.video-container {
    position: relative;
    display: inline-block;
    line-height: 0;       /* no extra descender gap */
}

.video-preview {
    display: block;
    max-width: 100%;
}

.video-icon {
    position: absolute;
    top: 15px;
    right: 10px;
    font-size: 1em;
    pointer-events: none;
    opacity: 0.7;
}

/* make icon more visible on hover */
.video-container:hover .video-icon {
    opacity: 1;
}

footer {
    position: fixed;       /* stay in one spot as you scroll */
    bottom: 0;             /* align to the bottom */
    left: 0;               /* align to the left */
    padding: 0.5rem 1rem;  /* small padding */

    font-size: 0.75rem;    /* make the text small */
    line-height: 1.2;      /* tighten up the height */

    background-color: rgba(0, 0, 0, 0);
    color: #ccc;           /* light text for contrast */

    opacity: 0.8;          /* overall transparency if you like */
    border-top-right-radius: 0.25rem; /* optional rounded corner */

    z-index: 1000;         /* make sure it sits above other content */
}