.nav-fixed .topnav {
    z-index: 1039;
}

.fixed-top{
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem 0 0;
    height: 3.5rem;
    z-index: 1039;
    background: var(--md-navbar-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.navbar .form-control, .topnav {
    font-size: 1rem;
}

.form-control {
    display: block;
    padding: 0.4rem 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--md-on-surface);
    background-color: var(--md-input-bg);
    background-clip: padding-box;
    border: 1px solid var(--md-input-border);
    border-radius: 5px;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.form-control:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px var(--md-input-focus);
    outline: none;
}

.form-control-inline {
    display: inline-block;
}

.shadow {
    box-shadow: 0 .15rem 1.75rem 0 rgba(31,45,65,.15);
}
.bg-white {
    background-color: #fff;
}

.bg-gray {
    background-color: #eee;
}

.profile {
    width: 230px;
}

.profile-logo {
    float: left;
    width: 50px;
    height: 50px;
    background: var(--md-navbar-bg);
    border-radius: 25px;
    text-align: center;
    vertical-align: middle;
    font-size: 1.4em;
    padding: 7px;
    color: #fff;
}

.profile-info {
    float: left;
    margin-left: 10px;
    margin-top: 8px;
    color: var(--md-on-surface-secondary);
    width: 120px;
}

.user-logout {
    float: right;
    text-align: center;
}

.logout-icon {
    display: block;
    font-size: 1.5em;
}

.logout-text {
    font-size: .7em;
}

.profile-info span {
    display: block;
    line-height: 1.2;
    text-transform: capitalize;
}

#permspan {
    font-size: .9em;
    color: #108e07;
    font-style: italic;
}

#chpwspan a {
    padding: 4px 0;
    font-size: 0.9em;
    color: #4a4f63;
}

#chpwspan.invisible {
    display: none;
}

.hidden {
    display: none !important;
}

.sidenav .user-logout a {
    font-size: 1em;
    padding: 7px 0 0;
    color: #4a4f63;
    cursor: pointer;
    line-height: .7;
}

.sidenav .user-logout a:hover {
    color: var(--md-navbar-bg);
}

.navbar {
    position: relative;
    padding: 0;
    background: var(--md-navbar-bg);
}

.topnav .navbar-brand {
    width: 15rem;
    padding-left: 1rem;
    padding-right: 1rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.btn {
    display: inline-block;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.3rem 0.9rem;
    line-height: 1.5;
    border-radius: 4px;
    transition: color .12s ease-in-out, background-color .12s ease-in-out, box-shadow .12s ease-in-out, transform .12s ease-in-out;
}

.btn:not(:disabled):not(.disabled) {
    cursor: pointer;
}

.btn-default {
    color: #fff;
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18);
}

.btn-default:hover {
    color: #fff;
    background: linear-gradient(135deg, #7a838c 0%, #616870 100%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
    transform: translateY(-1px);
}

.btn-success {
    color: #fff;
    background: linear-gradient(135deg, #34a853 0%, #1e8a3a 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(52,168,83,0.3);
}

.btn-success:hover {
    color: #fff;
    background: linear-gradient(135deg, #3dbc60 0%, #2a9a48 100%);
    box-shadow: 0 4px 10px rgba(52,168,83,0.4);
    transform: translateY(-1px);
}

.btn-cancel {
    color: #fff;
    background: linear-gradient(135deg, #ea4335 0%, #c5221f 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(234,67,53,0.3);
}

.btn-cancel:hover {
    color: #fff;
    background: linear-gradient(135deg, #f4574a 0%, #d12f2c 100%);
    box-shadow: 0 4px 10px rgba(234,67,53,0.4);
    transform: translateY(-1px);
}

.btn-blue {
    color: #fff;
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(26,115,232,0.3);
}

.btn-blue:hover {
    color: #fff;
    background: linear-gradient(135deg, #2684fc 0%, #1666c1 100%);
    box-shadow: 0 4px 10px rgba(26,115,232,0.4);
    transform: translateY(-1px);
}

.btn-warn {
    color: var(--md-warning);
    background: transparent;
    background-image: none;
    border: 1.5px solid var(--md-warning);
}

.btn-warn:hover {
    color: #202124;
    background: var(--md-warning);
    border-color: var(--md-warning);
}

.btn-large {
    font-size: 110%;
}

/* ── Theme toggle in sidebar ─────────────────────────────────── */
#theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--md-background);
    border: 1px solid var(--md-border);
    color: var(--md-on-surface-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    line-height: 1.4;
    margin-top: 2px;
}
#theme-toggle:hover {
    border-color: var(--md-primary);
    color: var(--md-primary);
    background: var(--md-background);
    transform: none;
    box-shadow: none;
}
#theme-toggle i {
    font-size: 0.85rem;
}

/* ── Theme toggle on index / standalone pages ─────────────────── */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px solid var(--md-border);
    color: var(--md-on-surface-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.theme-toggle-btn:hover {
    border-color: var(--md-primary);
    color: var(--md-primary);
    transform: none;
    box-shadow: none;
}

/* ── Theme row wrapper ────────────────────────────────────────── */
.theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    margin-bottom: 4px;
}
.theme-row label {
    margin: 0;
    font-size: 0.8rem;
}

.app {
    background-color: var(--md-background);
    overflow: hidden;
    margin: 0;
    padding: 0;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .06), 0 2px 5px 0 rgba(0, 0, 0, .2);
}

.coln-left {
    flex: 30%;
    padding: 0;
    margin: 0;
}

.coln-left-hide {
  flex: 0;
}

.coln-right {
    flex: 70%;
    position: relative;
}

/* Clear floats after the columns */
.row {
    display: flex;
}

.full-height {
    height: calc(var(--vh, 1vh) * 100);
}

.full-width {
    flex: 1;
    height: calc(var(--vh, 1vh) * 100 - 56px);
}

.full-width-active {
    flex: 1;
}

.container {
    width: 100%;
}

.users-header {
    height: 3.5rem;
    padding: 8px 10px;
    background: var(--md-navbar-bg);
    font-size: .875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.users-header:after, .profile-user:after, .users-header:before {
    display: table;
    content: " ";
}

.users-header:after, .profile-user:after {
    clear: both;
}

.reply {
    height: 53px;
    width: 100%;
    background-color: var(--md-background);
    padding: 10px 5px 10px 5px;
    margin: 0;
    z-index: 1000;
}

.reply textarea {
    width: 100%;
    resize: none;
    overflow: hidden;
    padding: 5px;
    outline: none;
    border: none;
    text-indent: 5px;
    box-shadow: none;
    height: 100%;
}

textarea.form-reply {
    height: 2.1em;
    margin-right: .5em;
}

.form-reply {
    display: block;
    width: 100%;
    height: 34px;
    padding: 6px 12px;
    font-size: 1rem;
    color: var(--md-on-surface);
    background-color: var(--md-input-bg);
    background-image: none;
    border: 1px solid var(--md-input-border);
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}

.form-reply::placeholder {
  opacity: .7;
}

.select {
    display: block;
    width: 100%;
    padding: 0.3rem 0.65rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--md-on-surface);
    background-color: var(--md-input-bg);
    background-clip: padding-box;
    border: 1px solid var(--md-input-border);
    border-radius: 4px;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.select-inline {
    display: inline-block;
}

/* Modern Chat Messages - Theme Support */
.message-row {
    margin-bottom: 6px;
    clear: both;
}

.message-row:after, .message-row:before {
    display: table;
    content: " ";
}

.message-row:after {
    clear: both;
}

.message {
    width: auto !important;
    max-width: 80%;
    padding: 6px 10px 8px !important;
    border-radius: 14px;
    word-wrap: break-word;
    display: inline-block;
    margin: 0;
    text-align: left;
    box-sizing: border-box;
    position: relative;
    font-size: 13px;
    line-height: 1.3;
    /* Theme-based colors */
    background: var(--md-chat-bubble, #f0f2f5);
    color: var(--md-on-chat-bubble, #1a1a1a);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Message from sender (right-aligned) */
.message-row.message-me {
    float: right;
}

.message-row.message-me .message {
    background: var(--md-chat-bubble-me, #2196F3);
    color: var(--md-on-chat-bubble-me, #ffffff);
    border-bottom-right-radius: 3px;
}

/* Message from others (left-aligned) */
.message-row.message-other {
    float: left;
}

.message-row.message-other .message {
    border-bottom-left-radius: 3px;
}

/* System messages */
.message-system {
    font-size: 11px;
    color: var(--md-chat-accent, #2196F3);
    text-align: center;
    padding: 2px 6px;
    margin: 6px auto;
    opacity: 0.7;
}

/* Private messages */
.message-private {
    background: var(--md-chat-bubble-private, #fff8e1);
    color: var(--md-on-chat-bubble-private, #856404);
}

.message-private .message-header:after {
    content: "(private)";
    margin-left: 6px;
    font-size: 10px;
    opacity: 0.6;
}

/* Message content */
.message-content {
    white-space: pre-wrap;
    margin: 0;
    padding: 0;
    word-wrap: break-word;
    word-break: break-word;
    font-weight: 400;
}

/* Message header (sender name) */
.message-header {
    margin: 0 0 1px 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--md-chat-accent, #2196F3);
    text-shadow: none;
    opacity: 0.8;
}

.message-row.message-me .message-header {
    display: none; /* Don't show own name in own messages */
}

/* Message footer (timestamp) */
.message-footer {
    margin: 3px 0 0 0;
    padding: 0;
    line-height: 1;
    text-align: right;
    font-size: 10px;
    color: var(--md-on-chat-bubble, #1a1a1a);
    opacity: 0.5;
}

.message-time {
    margin-left: 6px;
}

.message-me-asterisk, .message-me-user {
    margin-right: 3px;
}

.message-me-content {
    white-space: pre-wrap;
}

.video-container {
    height: calc(var(--vh, 1vh) * 100 - 56px);
    position: relative;
    background: rgba(0, 0, 0, 0.91);
    /* Display only when showing video */
    display: block;
}

.chat-btn {
    display: block;
    /*on top of video peers*/
    z-index: 1002;
    font-size: 1.8em;
    position: absolute;
    top: 10px;
    left: 10px;
    cursor: pointer;
}

.chat-btn .icon-chat {
    color: #cac7c7;
    height: 50px;
    padding: 10px;
    text-shadow: 0px 0px 1px #b3adad;
}

.collapse-video {
    left: inherit;
    right: 30px;
}

.video-controls, .top-video-controls {
    position: absolute;
    width: 100%;
    left: 0;
    bottom: 25px;
    text-align: center;
    color: #eaeaea;
    font-size: 1.1em;
    opacity: 0;
    height: 32px;
}

.video-controls:after, .top-video-controls:after {
    clear: both;
    display: table;
    content: " ";
}

.top-video-controls {
    text-align: right;
    bottom: inherit;
    top: 0;
    line-height: 1.1;
    font-size: 1.3em;
    text-shadow: 1px 1px 2px rgb(90 86 86);
}

.controls-button {
    padding: 3px 10px;
    vertical-align: middle;
    height: 100%;
}

.controls-left {
    float: left;
    text-align: left;
}

.controls-right {
    float: right;
    text-align: right;
}

.vc-overlay {
    background: linear-gradient(180deg, rgb(0 0 0 / 20%) 0%, rgb(0 0 0 / 50%) 0%, rgb(0 0 0 / 70%) 100%);
}

.peer:hover > .video-controls, .peer:hover > .top-video-controls {
    opacity: 1;
}

.video-controls span, .top-video-controls span {
    margin-right: 20px;
    transition: opacity .7s ease-out;
    opacity: 1;
    cursor: pointer;
}

.video-controls span:last-child, .top-video-controls span:last-child {
    margin-right: 0;
}

.video-controls span:hover, .top-video-controls span:hover {
    opacity: .8;
    transition: opacity .5s ease-out;
}

.top-video-controls .video-stop{
    display: flex;
    width: 1.5em;
    height: 1.5em;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    color: #eaeaea;
}

.video-controls .volume {
    display: inline-block;
    text-align: center;
}

.video-controls .video-play {
    font-size: 0.85em;
}

.video-controls .video-stop {
    color: #d03e3e;
}

.video-controls span.disabled, .video-controls span.disabled:hover, .top-video-controls span.disabled:hover{
    opacity: .2;
    color: #c8c8c8
}

.volume-mute {
    vertical-align: middle;
    width: 25px;
    display: var(--dv, inline);
}

.volume-slider {
    height: 4px;
    width: 60px;
    cursor: pointer;
    margin: 5px 5px;
    vertical-align: middle;
    opacity: var(--ov, 0);
    transition: opacity .5s ease-out;
}

.video-controls .volume:hover {
    --ov: 1;
    --dv: inline;
}

.mobile-container {
    display: block !important;
}

.login-container {
    height: calc(var(--vh, 1vh) * 100 - 56px);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: scroll;
    background: var(--md-background);
}

.login-box {
    width: 20em;
    padding: 2rem 1.75rem;
    margin: 4em auto;
    background: var(--md-card-bg);
    border-radius: 8px;
    border: 1px solid var(--md-border);
    box-shadow: var(--md-shadow-raised);
}

.login-box .connect {
    width: 100%;
    text-align: center;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 40px;
}

.login-version {
    font-size: 0.6rem;
    opacity: 0.28;
    color: var(--md-on-surface-secondary);
    text-align: center;
    margin-top: 0.75rem;
    letter-spacing: 0.05em;
}

/* ── No media available message ──────────────────────────── */
.no-media-message {
    height: calc(var(--vh, 1vh) * 100 - 56px);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    background: var(--md-background);
    padding: 1.5rem 1rem;
}

.no-media-card {
    background: var(--md-card-bg);
    border-radius: 6px;
    border: 1px solid var(--md-border);
    box-shadow: var(--md-shadow-raised);
    padding: 1.5rem 1.5rem 1.25rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.no-media-icon {
    color: var(--md-on-surface-secondary);
    opacity: 0.5;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: center;
}

.no-media-icon svg {
    width: 56px;
    height: 56px;
}

.no-media-card h3 {
    margin: 0 0 0.4rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--md-on-surface);
}

.no-media-card > p {
    margin: 0 0 0.85rem 0;
    color: var(--md-on-surface-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}

.no-media-list {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0 0 0.65rem 0;
}

.no-media-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.35rem;
    background: transparent;
    border-radius: 4px;
    border: 1px solid var(--md-border);
}

.no-media-list li svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--md-primary);
    opacity: 0.75;
}

.no-media-list li div {
    flex: 1;
    min-width: 0;
}

.no-media-list li strong {
    display: block;
    color: var(--md-on-surface);
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    line-height: 1.3;
}

.no-media-list li span {
    display: block;
    color: var(--md-on-surface-secondary);
    font-size: 0.7rem;
    line-height: 1.3;
}

.no-media-footer {
    margin: 0.85rem 0 0 0 !important;
    padding-top: 0.85rem;
    border-top: 1px solid var(--md-border);
    font-size: 0.75rem !important;
    color: var(--md-on-surface-secondary) !important;
    font-style: italic;
    opacity: 0.85;
}

.label-fallback {
    opacity: 0.5;
}

.label {
    left: 0;
    position: absolute;
    bottom: 0;
    width: 100%;
    z-index: 1;
    text-align: center;
    line-height: 24px;
    color: #ffffff;
}

.nav-link {
    padding: 0;
    color: #dbd9d9;
    min-width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0 8px;
    position: relative;
    line-height: 1;
}

.nav-link span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link label {
    display: block;
    cursor: pointer;
    color: #fff;
    font-size: 55%;
    font-weight: 400;
    margin: 0;
    line-height: 1.2;
}

.nav-link:hover {
    color: #c2a4e0;
}
.nav-link label:hover {
    color: #c2a4e0;
}

.nav-cancel, .muted, .nav-cancel label, .muted label {
    color: #d03e3e
}

.nav-cancel:hover, .muted:hover, .nav-cancel label:hover, .muted label:hover {
    color: #d03e3e
}

.chat-active, .chat-active label {
    color: #4CAF50
}

.chat-active:hover, .chat-active:hover label {
    color: #45a049
}

.nav-button {
    cursor: pointer;
    font-size: 1.1rem;
}

.nav-more {
    margin-left: 0;
}

.header-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #ebebeb;
    line-height: 1;
}

#header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.75rem;
}

#title {
    text-align: center;
}

h1 {
    white-space: nowrap;
}

#statdiv {
    white-space: nowrap;
    margin-bottom: 16px;
}

#errspan {
    margin-left: 1em;
}

.connected {
    color: green;
}

.disconnected {
    color: red;
    font-weight: bold;
}

.login {
    display: inline
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-on-surface);
    margin-bottom: 0.25rem;
}

.loginform label {
    min-width: 3em;
    display: inline-block;
    padding-top: 10px;
}

.loginform input[type="text"], .loginform input[type="password"] {
    width: 100%;
}

/* Permission status indicators */
.permission-status {
    display: flex;
    justify-content: space-around;
    margin: 1em 0;
    padding: 0.5em 0;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1em;
    border-radius: 0.5em;
    background-color: var(--md-background);
}

.permission-item > .fa-video,
.permission-item > .fa-microphone {
    font-size: 1.2em;
    color: #666;
}

.permission-text {
    font-size: 0.9em;
    color: #555;
}

.permission-icon {
    font-size: 1em;
    margin-left: auto;
}

/* Loading state (checking permissions) */
.permission-item.checking .permission-icon {
    color: #999;
}

/* OK state - permissions granted */
.permission-item.ok .permission-icon::before {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #28a745;
}

.permission-item.ok {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.permission-item.ok > .fa-video,
.permission-item.ok > .fa-microphone {
    color: #28a745;
}

/* Error state - permissions denied */
.permission-item.error .permission-icon::before {
    content: "\f00d";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #dc3545;
}

.permission-item.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.permission-item.error > .fa-video,
.permission-item.error > .fa-microphone {
    color: #dc3545;
}

/* Warning state - permissions not yet requested */
.permission-item.warning .permission-icon::before {
    content: "\f071";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #ffc107;
}

.permission-item.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

.permission-item.warning > .fa-video,
.permission-item.warning > .fa-microphone {
    color: #856404;
}

/* Login device selection */
.device-selection {
    display: flex;
    flex-direction: column;
    gap: 0.8em;
    margin: 1em 0;
}

/* Initially hide device selection */
.device-selection[style*="display:none"] {
    display: none !important;
}

.device-card {
    display: flex;
    flex-direction: column;
    padding: 0.8em 1em;
    border-radius: 0.5em;
    background-color: var(--md-background);
    border: 1px solid var(--md-border);
    transition: all 0.2s ease;
}

/* Initially hide device cards */
.device-card[style*="display:none"] {
    display: none !important;
}

.device-card:hover {
    background-color: var(--md-surface);
    border-color: var(--md-primary);
}

.device-card-header {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.5em;
}

.device-icon {
    font-size: 1.2em;
    color: #666;
    width: 24px;
    text-align: center;
}

.device-card-label {
    font-size: 0.9em;
    font-weight: 500;
    color: #555;
    flex-grow: 1;
}

.device-card .permission-icon {
    font-size: 1em;
    color: #999;
}

.device-card.ok .permission-icon::before {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #28a745;
}

.device-card.ok {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.device-card.ok .device-icon {
    color: #28a745;
}

.device-card.ok .device-card-label {
    color: #155724;
}

.device-select {
    width: 100%;
    padding: 0.4em 0.6em;
    font-size: 0.9em;
    border: 1px solid var(--md-input-border);
    border-radius: 0.3em;
    background-color: var(--md-input-bg);
    color: var(--md-on-surface);
    cursor: pointer;
}

.device-select:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px var(--md-input-focus);
}

.switch-radio {
    margin: 0;
}

.invisible {
    display: none;
}

.hidden {
    display: none !important;
}

.error {
    color: red;
    font-weight: bold;
}

.noerror {
    display: none;
}

.clear {
    clear: both;
    content: "";
}

#optionsdiv {
    margin-bottom: 4px;
}

#optionsdiv input[type="checkbox"] {
  vertical-align: middle;
}

#presentbutton, #unpresentbutton {
    white-space: nowrap;
    margin-right: 0.4em;
    margin-top: .1em;
    font-size: 1.1em;
    text-align: left;
    width: 5.8em;
}

#videoselect {
    text-align-last: center;
    margin-right: 0.4em;
}

#audioselect {
    text-align-last: center;
}

#sharebutton, #unsharebutton {
    white-space: nowrap;
}

#unsharebutton {
    margin-right: 0.4em;
}

#filterselect {
    text-align-last: center;
    margin-right: 0.4em;
}

#sendselect {
    text-align-last: center;
    margin-right: 0.4em;
}

#simulcastselect {
    text-align-last: center;
    margin-right: 0.4em;
}

#requestselect {
    text-align-last: center;
}

#chatbox {
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Users list section in chat (30% height) */
.chat-users {
    flex: 0 0 30%;
    min-height: 120px;
    max-height: 40%;
    overflow-y: auto;
    border-bottom: 1px solid var(--md-border, #ddd);
    padding: 8px 0;
}

.chat-users .users-header {
    padding: 4px 10px;
}

.chat-users #users {
    padding: 4px 10px;
}

.chat-users .header-sep {
    height: 1px;
    background-color: var(--md-border, #ddd);
    margin: 4px 10px;
}

#chat {
    padding: 0;
    margin: 0;
    background-color: var(--md-surface);
    background-size: cover;
    overflow-y: scroll;
    border: none;
    border-right: 4px solid var(--md-border);
    /* force to fill height */
    height: 100% !important;
    width: 100%;
    min-width: 300px;
    overflow: hidden;
}

#inputform {
    display: flex;
}

#box {
    overflow: auto;
    flex: 1;
    min-height: 0;
    padding: 10px;
}

.close-chat {
    position: absolute;
    top: 2px;
    right: 14px;
    width: 25px;
    font-size: 1em;
    text-align: center;
    font-weight: 700;
    color: #8f8f8f;
    cursor: pointer;
    border: 1px solid transparent;
}

.close-chat:hover, .close-chat:active {
    border: 1px solid #dfdfdf;
    border-radius: 4px;
}

#connectbutton {
    margin-top: 1em;
    padding: 0.37rem 1.5rem;
}

#input {
    width: 100%;
    border: none;
    resize: none;
    overflow-y: hidden;
}

#input:focus {
    outline: none;
}

#inputbutton:focus {
    outline: none;
}

#resizer {
    width: 4px;
    margin-left: -4px;
    z-index: 1000;
}

#resizer:hover {
    cursor: ew-resize;
}

#peers {
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    grid-template-rows: repeat(1, auto);
    row-gap: 5px;
    column-gap: 10px;
    position: absolute;
    top: 0;
    right: 0; 
    bottom: 0;
    min-width: 100%; 
    min-height: 100%;
    width: auto; 
    height: auto; 
    z-index: 1000;
    background-size: cover;
    overflow: hidden;
    vertical-align: top!important;
}

.peer {
    margin-top: auto;
    margin-bottom: auto;
    position: relative;
    border: 2px solid rgba(0,0,0,0);
    background: #80808014;
}

.peer-active {
    border: 2px solid var(--md-primary);
}

.peer-hidden {
    display: none;
}

.media {
    width: 100%;
    max-height: calc(var(--vh, 1vh) * 100 - 76px);
    padding-bottom: 20px;
    object-fit: contain;
}

.media-failed {
    filter: grayscale(0.5) contrast(0.5);
}

.mirror {
    transform: scaleX(-1);
}

#inputform {
    width: 100%;
}

.sidenav {
    background-color: var(--md-sidebar-bg);
    box-shadow: 0 0 24px 0 rgba(71,77,86,.1), 0 1px 0 0 rgba(71,77,86,.08);
    display: block;
    position: fixed;
    -webkit-transition: all .2s ease-out;
    transition: all .2s ease-out;
    width: 0px;
    /* on top of everything */
    z-index: 2999;
    top: 0;
    right: 0;
    height: calc(var(--vh, 1vh) * 100);
    overflow-x: hidden;
    overflow-y: hidden;
}

.sidenav a {
    padding: 10px 20px;
    text-decoration: none;
    font-size: 30px;
    color: #dbd9d9;
    display: block;
    transition: 0.3s;
    line-height: 1.0;
}

.sidenav a:hover {
    color: #c2a4e0;
}

.sidenav .closebtn {
    cursor: pointer;
    position: absolute;
    top: 0;
    right: 0;
    height: 56px;
}

.sidenav-label {
    display: block;
    margin-top: 15px;
}

.sidenav-label-first {
    display: block;
    margin-top: 0;
}

.sidenav form{
    margin-top: 15px;
}

.sidenav-header {
    height: 56px;
}

.sidenav-header h2{
    color: #fff;
    padding: 10px;
    margin: 0;
    max-width: 70%;
    line-height: 36px;
}

.sidenav-content {
    padding: 10px;
    background: var(--md-surface);
    height: calc(100% - 56px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidenav-content h2 {
    margin: 0;
}

#sharelink-section {
    margin: 10px 0;
}

#sharelinkbutton {
    width: 100%;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#sharelinkbutton i {
    font-size: 1em;
}

fieldset {
    margin: 0;
    margin-top: 16px;
    border: 1px solid var(--md-border);
    padding: 8px 10px;
    border-radius: 4px;
}
legend {
    padding: 0 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--md-on-surface-secondary);
    letter-spacing: 0.03em;
}

.nav-menu {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    gap: 2px;
}

.nav-menu .btn:not(.invisible) {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.nav-menu li {
    display: flex;
    align-items: center;
    list-style: none;
}

.show-video {
    position: absolute;
    right: 30px;
    bottom: 120px;
    color: white;
    width: 50px;
    height: 50px;
    text-align: center;
    line-height: 50px;
    font-size: 150%;
    border-radius: 30px;
    background: #600aa0;
    box-shadow: 4px 4px 7px 1px rgba(0,0,0,0.16);
}

.blink {
    -ms-animation: blink 1.0s linear infinite;
    -o-animation: blink 1.0s linear infinite;
    animation: blink 1.0s linear infinite;
}

@keyframes blink {
    0% { box-shadow: 0 0 15px #600aa0; }
    50% { box-shadow: none; }
    100% { box-shadow: 0 0 15px #600aa0; }
}

@-webkit-keyframes blink {
    0% { box-shadow: 0 0 15px #600aa0; }
    50% { box-shadow: 0 0 0; }
    100% { box-shadow: 0 0 15px #600aa0; }
}

/* Header styles (still used in chat panel) */
.galene-header {
    font-size: 1.3rem;
    font-weight: 900;
    color: #dbd9d9;
    line-height: 34px;
}

.header-sep {
    height: 20px;
}

/* Users list styles (now in chat panel) */
#users {
    padding: 0;
    margin: 0;
    height: calc(100% - 84px);
    width: 100%;
    position: relative;
    display: block;
    background-color: var(--md-surface);
    overflow-y: auto;
    border: 1px solid var(--md-border);
}

#users .user-p {
    position: relative;
    padding: 10px !important;
    border-bottom: 1px solid var(--md-border);
    height: 40px;
    line-height: 18px;
    margin: 0 !important;
    cursor: pointer;
    overflow: hidden;
    white-space: pre;
}

/* Users list hover and icon styles */
#users > div:hover {
    background-color: var(--md-background);
}

#users > div::before {
    content: "\f111";
    font-family: 'Font Awesome 6 Free';
    color: #20b91e;
    margin-right: 5px;
    font-weight: 900;
}

#users > div.user-status-raisehand::before {
    content: "\f256";
}

#users > div::after {
    font-family: 'Font Awesome 6 Free';
    color: #808080;
    margin-left: 5px;
    font-weight: 900;
    float: right;
}

#users > div.user-status-microphone::after {
    content: "\f130";
}

#users > div.user-status-camera::after {
    content: "\f030";
}

.close-icon {
    font: normal 1em/1 Arial, sans-serif;
    display: inline-block;
}

.close-icon:before{ content: "\2715"; }

/* END Sidebar Left */

@media only screen and (min-width: 1025px) {
    .coln-right .collapse-video, .coln-right .show-video {
        display: none;
    }
}

@media only screen and (max-width: 1024px) {
    #presentbutton, #unpresentbutton {
        width: auto;
    }
    .nav-link {
        margin: 0 4px;
        line-height: 1.5;
    }

    .nav-link label {
        display: none;
    }

    .nav-text {
        display: none;
    }

    .nav-more {
        padding-top: 0;
        margin-left: inherit;
    }

    .full-width {
        height: calc(var(--vh, 1vh) * 100 - 56px);
    }

    .close-chat, .show-chat, .collapse-video, .show-video {
        display: none !important;
    }

    .video-container {
        position: fixed;
        height: calc(var(--vh, 1vh) * 100 - 56px);
        top: 56px;
        right: 0;
        left: 0;
        margin-bottom: 60px;
    }

    .top-video-controls {
        opacity: 1;
    }

    .login-container {
        position: fixed;
        height: calc(var(--vh, 1vh) * 100 - 56px);
        top: 56px;
        right: 0;
        left: 0;
        background: var(--md-background);
    }

    .login-box {
        background: var(--md-card-bg);
    }

    .coln-left {
        flex: 100%;
        width: 100vw;
        /* Remove !important to allow JavaScript to control visibility */
        display: block;
    }

    .coln-right {
        flex: none;
        position: relative;
    }

    .full-width {
        flex: 1;
    }

    .sidenav a {padding: 10px 10px;}

    .sidenav-header h2 {
        line-height: 36px;
    }

    #peers {
        padding: 3px;
    }

    #resizer {
        display: none;
    }

    #chat {
        border-right: none;
    }

    .dropdown-content {
        margin-top: 10px;
    }

}

#captions-container {
    position: absolute;
    bottom: 40px;
    width: 100%;
    pointer-events: none;
    z-index: 1390;
    alpha: 0;
}

#captions {
    margin: auto;
    padding: 0 0.4rem 0 0.4rem;
    width: max-content;
    font-size: 1.2rem;
    text-align: center;
    pointer-events: none;
    background-color: rgba(255,255,255,.7);
    color: #000;
}

:root{
    --contextualMenuBg: #eee;
    --contextualMenuShadow: 1px 1px 1px #444; */
    --contextualMenuRadius: 0px; */
    --contextualMenuText: black;

    --contextualSubMenuBg: #eee;

    --contextualHover: #ddd;

    --contextualOverflowIcon: #999;
    --contextualSeperator: #999;

    /* Chat message colors - Light theme (slim with blue accent) */
    --md-chat-bubble: #f0f2f5;
    --md-on-chat-bubble: #1a1a1a;
    --md-chat-bubble-me: #2196F3;
    --md-on-chat-bubble-me: #ffffff;
    --md-chat-bubble-private: #fff8e1;
    --md-on-chat-bubble-private: #856404;
    --md-chat-accent: #2196F3;
}

/* Dark theme overrides */
.dark-theme {
    --md-chat-bubble: #2c3034;
    --md-on-chat-bubble: #e2e8f0;
    --md-chat-bubble-me: #1976D2;
    --md-on-chat-bubble-me: #ffffff;
    --md-chat-bubble-private: #1f1a0d;
    --md-on-chat-bubble-private: #ffecb3;
    --md-chat-accent: #2196F3;
}

.contextualMenu{
    z-index: 2999;
}

.file-progress {
    accent-color: var(--md-primary);
    margin-left: 10px;
    margin-right: 10px;
}

#invite-dialog {
    background-color: var(--md-card-bg);
    color: var(--md-on-surface);
}

#invite-dialog {
    border: solid 2px var(--md-primary);
}

#invite-dialog button {
    background-color: var(--md-primary);
    color: white;
    border-radius: .5em;
    padding: .5em;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-right: 2em;
    display: inline-block;
    width: 7em;
}

#invite-dialog button:hover {
   background-color: var(--md-primary-dark);
}

#invite-dialog input {
    margin-top: 1em;
    width: 12em;
    padding: .2em
}

#invite-dialog label {
    margin-top: 1em;
    display: inline-block;
    width:12em;
}

/* Style for the toastify  messages shall be within a css file */
.toastify {
    white-space: pre-line;
    max-width: 400px;
    text-align: left;
}
.toastify.error {
    background: linear-gradient(to right, #e20a0a, #df2d2d);
    color: #fff;
}
.toastify.error .toast-close {
    color: #fff;
}
.toastify.warning {
    background: linear-gradient(to right, #bdc511, #c2cf01);
    color: #000;
}
.toastify.warning .toast-close {
    color: #000;
}
.toastify.info {
    background: linear-gradient(to right, #529518, #96c93d);
    color: #000;
}
.toastify.info .toast-close {
    color: #000;
}

/* Permission dialog styles */
#permission-dialog {
    background: var(--md-card-bg);
    color: var(--md-on-surface);
    border: none;
    border-radius: .5em;
    padding: 2em;
    max-width: 400px;
    box-shadow: var(--md-shadow);
}

#permission-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

#permission-dialog h2 {
    margin-top: 0;
    margin-bottom: 1em;
    color: var(--md-on-surface);
}

#permission-dialog p {
    margin-bottom: 1em;
    color: var(--md-on-surface-secondary);
    line-height: 1.5;
}

#permission-dialog .permission-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1em;
    margin-top: 1.5em;
}

#permission-dialog button {
    border-radius: .5em;
    padding: .5em 1em;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

#permission-dialog #permission-retry {
    background-color: var(--md-primary);
    color: white;
}

#permission-dialog #permission-retry:hover {
    background-color: var(--md-primary-dark);
}

#permission-dialog #permission-cancel {
    background-color: #ccc;
    color: #333;
}

#permission-dialog #permission-cancel:hover {
    background-color: #bbb;
}

/* Background image controls */
.bg-preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 8px 0;
}

.bg-preset-item {
    position: relative;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 16/9;
    transition: border-color 0.2s, transform 0.2s;
    background-color: #f0f0f0;
}

.bg-preset-item:hover {
    border-color: var(--md-on-surface-variant, #666);
    transform: scale(1.02);
}

.bg-preset-item.selected {
    border-color: var(--md-primary, #4CAF50);
    box-shadow: 0 0 8px var(--md-primary-alpha, rgba(76, 175, 80, 0.5));
}

.bg-preset-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#custom-bg-label {
    font-size: 0.9em;
    margin-top: 8px;
    color: var(--md-on-surface-variant, #666);
}

.btn-link {
    background: none;
    border: none;
    color: var(--md-on-surface-variant, #999);
    cursor: pointer;
    padding: 0 4px;
}

.btn-link:hover {
    color: var(--md-error, #f44336);
}

#upload-bg-button {
    width: 100%;
    margin-top: 8px;
}
