/*
 * - Styles the shared layout and controls used by the HTML pages.
 * - Connects to index.html, ask.html, ask-mykai.html, chat.html, about.html, and video-test.html.
 */

/* The whole page.
           font-family = the font. Try Georgia or Verdana.
           background = page color. Try #eaf4fb (lighter) or #aed6f1 (stronger).
           max-width = how wide the column gets. Raise it for a wider page.
           margin: 40px auto = 40px of space on top, and "auto" centers the column.
           padding: 0 16px = space on the left and right so text never touches a phone's edge. */
        body { font-family: Arial, sans-serif; background: #d6eaf8; max-width: 600px; margin: 40px auto; padding: 0 16px; }
 
        /* The big heading. Change the color name, or use a hex like #ff6600.
           Keep it dark so it stays readable on the light blue. */
        h1 { color: darkblue; }
 
        /* One row = a label and its box side by side.
           display: flex puts items on one line.
           align-items: flex-start lines them up at the top.
           gap = space between the label and the box.
           margin-bottom = space under each row. */
        .row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
 
        /* The typing boxes inside a row.
           flex: 1 = fill all the leftover width.
           padding = space between the box edge and the text you type (bigger = roomier).
           box-sizing keeps the padding from making the box too wide. */
        .row input, .row textarea { flex: 1; padding: 8px; box-sizing: border-box; }
 
        /* Height of the big description box. Raise it for a taller box. */
        textarea { height: 100px; }
 
        /* The words "Question:" and "Description:".
           font-weight: bold = thick text (use normal for thin).
           width: 110px = keeps both boxes lined up. Raise it if a label wraps onto two lines.
           padding-top = pushes the label down so it lines up with the box text. */
        label { font-weight: bold; width: 110px; padding-top: 8px; }
 
        /* The Submit button.
           background = button color. color = text color. Keep them contrasting so it's readable.
           border: none removes the default outline. cursor: pointer shows a hand when hovering. */
        button { padding: 10px 20px; background: darkblue; color: white; border: none; cursor: pointer; }
 
        /* The "Chat" button inside a card. Same dark blue as Submit so the site feels consistent.
           display: inline-block lets it have padding but stay only as wide as its text. */
        .card a { display: inline-block; margin-top: 8px; padding: 6px 14px; background: darkblue; color: white; text-decoration: none; }
 
        /* Small gray text, like "33% similar". Change font-size for bigger or smaller. */
        .small { font-size: 13px; color: #444; }


        /* Each choice is a white card that is also a link. padding = space inside, border = dark blue outline */
        .card { display: block; background: white; color: darkblue; text-decoration: none; padding: 20px; margin-bottom: 14px; border: 2px solid darkblue; border-radius: 8px; text-align: left; }

        /* Card title: big and bold so visitors can scan the choices quickly */
        .card strong { display: block; font-size: 20px; }

        /* Small gray description under each title. Keep it to one short line */
        .card span { display: block; font-size: 14px; color: #444; margin-top: 4px; }

        /* Hover effect: card turns light blue when the mouse is over it, so visitors know it's clickable */
        .card:hover { background: #eaf4fb; }

        /* Panels for profile setup and the personal chat-room list. */
        .profile-panel { background: white; padding: 14px; margin: 16px 0; border: 1px solid darkblue; border-radius: 8px; }
        .profile-panel h2 { margin-top: 0; }

        /* The line under the heading showing what the two questions are about.
           font-size = text size. color = gray. margin-bottom = space below it. */
        #topic { font-size: 14px; color: #444; margin-bottom: 12px; }

        /* The white box where messages appear.
           height = how tall it is (raise it for a taller chat).
           overflow-y: auto = adds a scrollbar when messages don't fit.
           border-radius = rounded corners. padding = space inside the box. */
        #messages { background: white; border-radius: 6px; height: 360px; overflow-y: auto; padding: 12px; }

        /* One message bubble (applies to every message).
           max-width: 75% = a bubble never gets wider than 3/4 of the box, so long messages wrap.
           padding = space around the text inside the bubble. margin-bottom = space between bubbles.
           border-radius: 12px = rounded bubble (bigger number = rounder).
           word-wrap makes very long words break instead of overflowing. */
        .msg { max-width: 75%; padding: 8px 12px; margin-bottom: 8px; border-radius: 12px; word-wrap: break-word; }

        /* YOUR messages: dark blue with white text, pushed to the right.
           margin-left: auto is what pushes it right. Change the colors to restyle your bubbles. */
        .mine { background: darkblue; color: white; margin-left: auto; }

        /* THEIR messages: light blue with dark text, on the left (the default side). */
        .theirs { background: #d6eaf8; color: #222; }

        /* The row holding the typing box and Send button.
           display: flex puts them on one line. gap = space between them. margin-top = space above. */
        #sendRow { display: flex; gap: 8px; margin-top: 12px; }

        /* The text box where you type. flex: 1 = it takes all the leftover width. */
        #text { flex: 1; padding: 10px; box-sizing: border-box; }

         /* Arrange the local and remote camera previews in two equal columns. */
         .call-videos {
            display: grid; /* Use a grid so both previews line up. */
            grid-template-columns: repeat(2, minmax(0, 1fr)); /* Make two equal-width video columns. */
            gap: 8px; /* Leave space between the previews. */
            margin: 12px 0; /* Separate the previews from nearby controls. */
         }

         .call-remote-videos {
            display: grid; /* Keep each remote participant in a separate tile. */
            grid-template-columns: repeat(2, minmax(0, 1fr)); /* Show several call participants in a grid. */
            gap: 8px; /* Separate the participant tiles. */
         }

         .call-video span {
            display: block; /* Put each participant's name below their video. */
            margin-top: 4px; /* Add a little space below the video. */
         }

         /* Keep each video inside its column and crop it to a consistent shape. */
         .call-videos video {
            width: 100%; /* Fill the available column width. */
            aspect-ratio: 4 / 3; /* Keep video previews at a familiar camera shape. */
            object-fit: cover; /* Fill the frame without stretching the video. */
            background: #111; /* Show a dark area before video arrives. */
            border-radius: 6px; /* Slightly soften the video frame corners. */
         }

         /* Stack the previews on narrow phones so each remains large enough to see. */
         @media (max-width: 480px) {
            .call-videos { grid-template-columns: 1fr; } /* Switch to one column below 480px. */
            .call-remote-videos { grid-template-columns: 1fr; } /* Keep remote videos readable on phones. */
         }

        /* The Send button. Same dark blue as the other pages so the site feels consistent. */
        button { padding: 10px 20px; background: darkblue; color: white; border: none; cursor: pointer; }

        /* The strip that holds the tags. flex + wrap puts tags side by side and wraps to a new line on narrow phones. */
#minorTags { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

/* One tag: a rounded pill. CHANGE: background (fill) and color (text) to match your site. */
.tag { background: #dbeafe; color: #1e3a8a; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }

/* The x button inside a tag. No border or fill, so it looks like part of the pill rather than a big button. */
.tag button { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }

/* Public-room cards keep join and invite actions together. */
.card button { margin-top: 8px; margin-left: 8px; }
/* Shows disabled form buttons as unavailable until the user can submit. */
button:disabled { opacity: 0.6; cursor: wait; }
/* Makes hidden account forms and controls stay out of the layout. */
[hidden] { display: none !important; }

/* Stacks only the room-creation fields on narrow screens for easier input. */
@media (max-width: 480px) {
    #createRoomForm .row { flex-direction: column; gap: 6px; }
    #createRoomForm label { width: auto; }
}