/* Base Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #0f172a;
    width: 95%;
    max-width: 950px;
    max-height: 90vh;
    padding: 2rem;
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

/* Input Groups & Form Fields */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #cbd5e1;
}

.input-group input,
.input-group textarea {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    color: #fff;
    transition: all 0.2s;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.8);
}

/* Modal Body Layouts */
.modal-body-split {
    display: flex;
    gap: 2rem;
}

.modal-art-preview {
    width: 380px;
    min-width: 380px;
    height: 520px;
    background: rgba(30, 41, 59, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.modal-art-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center;
    padding: 1rem;
}

/* Shared Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.char-input-overlay,
.char-sheet-overlay,
.char-selector-overlay,
.char-input-body,
.char-sheet-display {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.2);
}

/* Archive & Stat Display Utility */
.stat-display-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

/* ===================== Green Room Pre-flight ===================== */
.green-room-content {
    max-width: 780px !important;
    width: 95% !important;
    align-items: stretch;
    text-align: center;
}

/* Two-column layout: video on left, controls+VBG on right */
.green-room-body {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.green-room-video-container {
    flex: 1 1 55%;
    min-width: 0;
    min-height: 200px;
    aspect-ratio: 16 / 9;
    border-radius: 1.25rem;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.15);
    transition: box-shadow 0.1s ease;
}

.green-room-side {
    flex: 0 0 auto;
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

#green-room-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    /* mirror the local feed */
}

/* Collapse to single-column on narrow screens */
@media (max-width: 600px) {
    .green-room-body {
        flex-direction: column;
    }

    .green-room-side {
        width: 100%;
    }

    .green-room-video-container {
        min-height: 160px;
        aspect-ratio: 16 / 9;
    }
}

.green-room-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.green-room-controls .char-action-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.green-room-controls .char-action-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
    transform: scale(1.08);
}

.green-room-controls .char-action-btn.muted {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

.green-room-controls .char-action-btn.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

/* ===================== Virtual Background Picker ===================== */
.vbg-picker {
    width: 100%;
    margin-top: 0.5rem;
}


.vbg-picker-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    text-align: left;
}

.vbg-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.vbg-thumb {
    width: 80px;
    height: 52px;
    border-radius: 0.6rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background-size: cover;
    background-position: center;
    background-color: rgba(30, 41, 59, 0.8);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.vbg-thumb:hover {
    border-color: rgba(139, 92, 246, 0.5);
    transform: scale(1.05);
}

.vbg-thumb.active {
    border-color: #a78bfa;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.vbg-thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: rgba(30, 41, 59, 0.5);
    border-style: dashed;
}

.vbg-upload-icon {
    font-size: 1.2rem;
    color: #a78bfa;
    line-height: 1;
}

.upload-thumb .vbg-thumb-label {
    position: static;
    background: transparent;
    color: #94a3b8;
    font-size: 0.6rem;
}

/* ===================== Profile Modal ===================== */
.profile-modal-content {
    max-width: 400px !important;
    width: 95% !important;
    align-items: center;
    text-align: center;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.profile-avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    transition: border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.profile-avatar-wrapper:hover {
    border-color: #a78bfa;
    box-shadow: 0 0 28px rgba(139, 92, 246, 0.55);
}

#profile-photo-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 20, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #e2e8f0;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.profile-avatar-wrapper:hover .avatar-upload-overlay {
    opacity: 1;
}

/* Upload progress bar */
.avatar-upload-progress {
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    overflow: hidden;
}

.avatar-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 99px;
    transition: width 0.2s ease;
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.profile-modal-content .input-group {
    width: 100%;
    text-align: left;
}