* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    background: #eef1f5;
    color: #263445;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
}

.container {
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 24px;
}

header h1 {
    margin-bottom: 6px;
    color: #243c59;
}

.subtitle {
    margin-top: 0;
    color: #687789;
}

.panel {
    background: #ffffff;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.hidden {
    display: none !important;
}

h2, h3 {
    margin-top: 0;
    color: #294766;
}

label {
    display: block;
    margin: 14px 0 6px;
    font-weight: bold;
}

input,
textarea,
select {
    display: block;
    width: 100%;
    padding: 11px;
    border: 1px solid #bdc8d4;
    border-radius: 5px;
    background: #ffffff;
    color: #263445;
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 75px;
}

button {
    padding: 11px 17px;
    border: 0;
    border-radius: 5px;
    background: #315f8b;
    color: white;
    font-size: 15px;
    cursor: pointer;
}

button:hover {
    background: #244b70;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#login-form button {
    width: 100%;
    margin-top: 18px;
}

.secondary {
    background: #647587;
}

.secondary:hover {
    background: #4d5e70;
}

.danger {
    background: #a64040;
}

.danger:hover {
    background: #823030;
}

.room-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 16px;
}

.room-heading h2 {
    margin-bottom: 5px;
}

#connection-status,
.status {
    margin: 4px 0;
    color: #647587;
    font-size: 14px;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
}

.classroom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 18px;
    align-items: start;
}

.conversation {
    min-width: 0;
}

.conversation-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.conversation-heading h3 {
    margin-bottom: 12px;
}

#current-mode {
    color: #647587;
    font-size: 13px;
    text-align: right;
}

#chat-messages {
    height: 430px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #d9e0e8;
    border-radius: 5px;
    background: #fafbfd;
    overflow-wrap: anywhere;
}

.chat-entry {
    padding: 8px 4px;
    border-bottom: 1px solid #e8edf2;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-entry:last-child {
    border-bottom: 0;
}

.chat-name {
    color: #294766;
    font-weight: bold;
}

.chat-time {
    color: #8290a0;
    font-size: 12px;
    margin-left: 7px;
}

.chat-notice {
    color: #687789;
    font-size: 13px;
    font-style: italic;
    padding: 7px 4px;
}

.send-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 9px;
}

#character-count {
    color: #758394;
    font-size: 13px;
}

#participant-list {
    margin: 0;
    padding-left: 20px;
}

#participant-list li {
    padding: 5px 0;
    overflow-wrap: anywhere;
}

.error {
    color: #a12626;
    font-size: 14px;
}

footer {
    padding: 12px;
    text-align: center;
    color: #8491a0;
    font-size: 13px;
}

@media (max-width: 700px) {
    body {
        padding: 10px;
    }

    .classroom {
        grid-template-columns: 1fr;
    }

    .participants {
        order: -1;
    }

    #chat-messages {
        height: 350px;
    }

    .room-heading {
        align-items: flex-start;
    }

    .control-row button {
        flex: 1 1 140px;
    }
}

.remove-button {
    margin-left: 8px;
    padding: 5px 8px;
}


/* Teacher image sharing and classroom image display */
.image-upload {
    margin-top: 1rem;
    display: grid;
    gap: 0.6rem;
}

.image-upload input[type="file"] {
    max-width: 100%;
}

.shared-images {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.shared-image-entry {
    margin: 0;
    padding: 0.75rem;
    border: 1px solid #d7dce2;
    border-radius: 8px;
    background: #fff;
}

.shared-image-entry figcaption {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.shared-image {
    display: block;
    max-width: 100%;
    max-height: 600px;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}
