/* Global Theme Colors */
:root {
    --bg: #111;
    --card: #1a1a1a;
    --text: #eee;
    --text-muted: #bbb;
    --border: #333;
    --button: #4a6cff;
    --button-hover: #3a57d9;
}

body.light {
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #333;
    --text-muted: #555;
    --border: #ddd;
}

/* Base Layout */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s, color 0.3s;
}

/* ---------------- TOP BAR ---------------- */
#topBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;

    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 0 20px;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

/* Left side: logo + text */
#topBarContent {
    display: flex;
    align-items: center;
    gap: 10px;
}

#logo {
    height: 40px;
    width: 40px;
    object-fit: contain;
    image-rendering: pixelated;
}

#brandText {
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(90deg, #ffee36, #fc971c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Right side: theme toggle */
#topBarRight {
    display: flex;
    align-items: center;
    padding: 35px;
}

#themeToggle {
    font-size: 26px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    transition: transform 0.2s ease;
}

#themeToggle:hover {
    transform: scale(1.15);
}

/* ---------------- PAGE CONTENT ---------------- */
h1 {
    margin-top: 120px;
    /* pushes below top bar */
    margin-bottom: 25px;
    text-align: center;
}

#loginBox,
#controlPanel {
    background: var(--card);
    padding: 25px;
    border-radius: 25px;
    width: 350px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Inputs */
input[type="text"] {
    width: 95%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    margin-bottom: 10px;
}

/* Buttons */
button {
    background: var(--button);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.15s;
}

button:hover {
    background: var(--button-hover);
}

/* Command box */
#cmdBox {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Gear icon */
#gear {
    cursor: pointer;
    font-size: 22px;
    margin-left: 10px;
    transition: 0.2s;
}

#gear:hover {
    transform: rotate(20deg);
}

/* Settings panel */
#settingsPanel {
    display: none;
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    background: var(--bg);
    margin-top: 15px;
}

select {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
}

/* Video */
#videoContainer {
    margin-top: 30px;
}

video {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* Error message */
#errorMsg {
    color: #ff6b6b;
    margin-top: 10px;
}

/* ---------------- LOADING OVERLAY ---------------- */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#loadingOverlay {
    display: flex;
    /* always flex */
    opacity: 0;
    /* hidden by default */
    pointer-events: none;
    /* prevents blocking clicks when hidden */
}

#loadingOverlay.show {
    opacity: 1;
    pointer-events: all;
}

#loadingOverlay {
    position: fixed;
    /* already there */
    z-index: 9999;
    /* already there */
    opacity: 0;
    transition: opacity 0.5s ease;
}

#loadingBox {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #444;
    border-top-color: #ffcc33;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loadingText {
    font-size: 20px;
    margin-top: 10px;
}

/* ---------------- PAGE FADE ---------------- */
body.fade-in {
    opacity: 1;
}

body.fade-out {
    opacity: 0;
}

/* ---------------- LOGOUT BUTTON ---------------- */
#logoutBtn {
    position: fixed;
    top: 15px;
    right: 120px;
    background: #ff4d4d;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: white;
}

#logoutBtn:hover {
    background: #d93636;
}

/* Row containing Share + Settings */
#shareRow {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    width: 100%;
}

/* Share button takes full width */
#shareBtn {
    flex: 1;
    background: var(--button);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

#shareBtn:hover {
    background: var(--button-hover);
}

/* Settings button stays small */
#settingsBtn {
    width: 55px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
}

#settingsBtn:hover {
    background: var(--border);
}

/* Popup panel */
#settingsPopup {
    display: none;
    position: absolute;
    right: 22.5%;
    top: 10%;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 10px;
    width: 300px;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#settingsPopup h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

#settingsPopup label {
    display: block;
    margin-bottom: 12px;
    color: var(--text);
}

#closeSettings {
    margin-top: 10px;
    width: 100%;
    background: #ff4d4d;
}

#closeSettings:hover {
    background: #d93636;
}

/* Help bubble next to Login button */
#loginActions {
    display: flex;
    align-items: center;
    gap: 76%;
}

#helpBubble {
    display: inline-flex;
    justify-content: center;
    align-items: center;

    width: 22px;
    height: 22px;

    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-muted);

    font-size: 14px;
    text-decoration: none;
    cursor: pointer;

    transition: 0.2s ease;
}

#helpBubble:hover {
    background: var(--button);
    color: white;
    border-color: var(--button);
    transform: scale(1.15);
}

.tutorialImg {
    width: 100%;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid var(--border);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.btnBack {
    display: inline-block;
    margin-top: 10px;
    padding: 10px;
    background: var(--button);
    color: rgb(0, 0, 0);
    /* border-radius: 6px; */
    text-decoration: none;
}

.btnBack:hover {
    background: var(--button-hover);
}