/* Reset & body */
html,
body {
    height: 100%;
    margin: 0;
}

body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    background: #000;
    color: #fff;

    display: flex;
    flex-direction: column;

    min-height: 100vh;
    /* fallback */
    min-height: 100dvh;
    /* ✅ fixes mobile Chrome */


}

/* Top bar: dashboard + logout */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    padding: 0 20px;
    background: #0b0b15;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    font-size: 20px;
    font-weight: bold;
    position: relative;
}

.header-logo {
    height: 100%;
    display: flex;
    align-items: center;
}

.header-logo a {
    display: flex;
    align-items: center;
    height: 100%;
}

.header-logo img {
    height: 100%;        /* lock to header */
    max-height: 45px;    /* safety cap */
    width: auto !important;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Global fix for padding/width issues */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Login page wrapper */
.center {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #0a0a0f;
}

/* Login box */
.login-box {
    background: #111118;
    padding: 40px 35px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
    max-width: 360px;
    width: 100%;
}

/* Title */
.login-box h2 {
    color: #ffffff;
    margin-bottom: 25px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Inputs */
.login-box input {
    width: 100%;
    padding: 12px 14px;
    margin: 8px 0;
    border-radius: 10px;
    border: 1px solid #222;
    background: #0f0f17;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s ease;
}

/* Input focus */
.login-box input:focus {
    outline: none;
    border-color: #2AD4D9;
    box-shadow: 0 0 8px rgb(0, 170, 175, 0.5);
    background: #11111a;
}

/* Button */
.login-box button {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: #00AAAF;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    color: #000;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Button hover */
.login-box button:hover {
    background: #2AD4D9;
    transform: translateY(-1px);
}

/* Error message */
.error {
    color: #ff4d4d;
    margin-top: 12px;
    font-size: 13px;
}

/* Hamburger button */
#hamburger-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

#hamburger-button {
    font-size: 24px;
    background: none;
    border: none;
    color: #00AAAF;
    cursor: pointer;
    transition: color 0.2s;
}

#hamburger-button:hover {
    color: #2AD4D9;
}

/* Dropdown hidden by default */
#hamburger-dropdown.hidden {
    display: none !important;
    /* important ensures it overrides other rules */
}

/* Dropdown visible when not hidden */
#hamburger-dropdown {
    position: absolute;
    top: 70px;
    /* under top bar */
    right: 0;
    background: #111118;
    border: 1px solid #222;
    border-radius: 10px;
    min-width: 150px;
    display: flex;
    /* flex layout when visible */
    flex-direction: column;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

#hamburger-dropdown a {
    padding: 12px 15px;
    font-size: 16px;
    color: #00AAAF;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

#hamburger-dropdown a.logout {
    color: #ff4d4d;
}

#hamburger-dropdown a:hover {
    background: #0d0d1a;
    color: #2AD4D9;
}

/* Modal overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    /* 🔥 glass effect */
}

/* Modal box (styled like login-box) */
.modal-content {
    background: #111118;
    padding: 35px 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 380px;
    margin: auto;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.9);
    text-align: center;
}

/* Title */
.modal-content h2 {
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Close button */
.close {
    position: absolute;
    right: 15px;
    top: 12px;
    font-size: 22px;
    color: #00AAAF;
    cursor: pointer;
    transition: 0.2s;
}

.close:hover {
    color: #2AD4D9;
}

/* Inputs (same as login) */
.modal-content input {
    width: 100%;
    padding: 12px 14px;
    margin: 8px 0;
    border-radius: 10px;
    border: 1px solid #222;
    background: #0f0f17;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal-content label {
    display: block;
    text-align: left;
    margin-top: 5px;
    /* optional spacing */
    font-weight: 500;
    /* optional styling */
}

.modal-content input:focus {
    outline: none;
    border-color: #2AD4D9;
    box-shadow: 0 0 8px rgb(0, 170, 175, 0.5);
    background: #11111a;
}

/* Button (same as login) */
.modal-content button {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: #00AAAF;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    color: #000;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-content button:hover {
    background: #2AD4D9;
    transform: translateY(-1px);
}

/* Game results dropdown */
#game-results {
    max-height: 150px;
    overflow-y: auto;
    margin-top: 5px;
    border-radius: 10px;
    background: #0f0f17;
    border: 1px solid #222;
}

#game-results div {
    padding: 10px;
    cursor: pointer;
    transition: 0.15s;
}

#game-results div:hover {
    background: #1a1a26;
}

/* Selected game */
#selected-game {
    margin-top: 8px;
    font-size: 13px;
    color: #00AAAF;
}

.modal-content {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-60%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Results container */
.results-container {
    display: none;
    /* hidden initially */
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 8px;
    margin-top: 8px;
    background: #111118;
    /* matches modal background */
    text-align: left;
    /* align items to left */
    padding: 4px;
}

.results-container.active {
    display: block;
}

/* Individual result item */
.results-container div {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #222;
    color: #fff;
    transition: background 0.2s;
}

.results-container div:hover {
    background: #333;
    /* highlight on hover */
}

/* Custom scrollbar for Webkit browsers (Chrome, Edge, Safari) */
.results-container::-webkit-scrollbar {
    width: 8px;
}

.results-container::-webkit-scrollbar-track {
    background: #111118;
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb {
    background: #00AAAF;
    /* match your blue accent */
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: #2AD4D9;
    /* hover effect */
}

/* Firefox scrollbar */
.results-container {
    scrollbar-width: thin;
    scrollbar-color: #00AAAF #111118;
}

.settings-container {
    display: flex;
    height: 100vh;
    background: #000;
    color: #fff;
    font-family: 'Inter', Arial, sans-serif;
}

/* Sidebar */
.settings-sidebar {
    width: 220px;
    background: #0b0b15;
    border-right: 1px solid #111;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
}

.settings-sidebar a {
    padding: 14px 20px;
    color: #00AAAF;
    text-decoration: none;
    font-size: 16px;
    transition: background 0.2s;
}

.settings-sidebar a:hover {
    background: #111118;
}

.settings-sidebar a.active {
    background: #111118;
    font-weight: bold;
}

/* Content */
.settings-content {
    flex: 1;
    padding: 0 10px;
    overflow-y: auto;
    max-width: 900px;
}

.account-form label {
    display: block;
    /* 🔥 important */
    margin-top: 12px;
    margin-bottom: 4px;
    text-align: left;
}

.account-form input {
    display: block;
    /* 🔥 important */
    width: 100%;
    /* take full line */
    max-width: 200px;
    /* limit width */
    margin-bottom: 8px;
}

.settings-content h2 {
    font-size: 22px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Inputs */
.settings-content input,
.settings-content select {
    width: 100%;
    padding: 10px 12px;
    margin: 10px 0;
    border-radius: 10px;
    border: 1px solid #222;
    background: #0f0f17;
    color: #fff;
    font-size: 14px;
}

/* Buttons */
button {
    padding: 10px 16px;
    background: #00AAAF;
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #2AD4D9;
}

/* Stream key card styles (improved, full-width) */
.empty-message {
    text-align: center;
    color: #888;
    padding: 20px;
}

.stream-card-container {
    display: flex;
    flex-direction: column;
    /* stack by default */
    gap: 15px;
    margin-top: 15px;
}

/* Individual card */
.stream-card {
    background: #111118;
    border: 1px solid #222;
    border-radius: 12px;
    margin-bottom: 15px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
    width: 100%;
    /* full container width */
    max-width: 100%;
    /* prevent overflow */
}

.stream-card.live input {
    background: #0f0f17;
    color: #fff;
    border: 1px solid #222;
    border-radius: 8px;
    padding-right: 15px;
    width: 100%;
    font-size: 14px;
}

.stream-card.empty {
    justify-content: center;
    font-size: 14px;
    color: #888;
}

.stream-card:hover {
    background: #1a1a26;
}

.stream-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #fff;
    word-break: break-word;
}

.stream-info p {
    margin: 0;
    font-size: 14px;
    color: #aaa;
    word-break: break-word;
}

.stream-actions {
    display: flex;
    flex-direction: row;
    /* toggle + delete side by side */
    gap: 10px;
    align-items: center;
}

.stream-actions.live {
    margin-top: auto;
    margin-bottom: 12px;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #0b0b15;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #00AAAF;
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* Delete button */
.delete-key-btn {
    padding: 6px 10px;
    border-radius: 8px;
    background: red;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}

.delete-key-btn:hover {
    background: #ff4242;
}

/* Add button */
.add-key-btn {
    padding: 10px 16px;
    background: #00AAAF;
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.add-key-btn:hover {
    background: #2AD4D9;
}

#live-key-input {
    cursor: text;
    /* shows I-beam on hover */
}

.dashboard {
    display: flex;
    flex-wrap: wrap;
    /* ✅ allow wrapping */
    margin-top: 10px;
    margin-left: 10px;
    padding: 0 10px;
    gap: 12px;
    flex: 1;
    min-height: 0;
    align-items: flex-start;
    /* 🔥 prevents vertical stretching */
    align-content: flex-start;
    /* 🔥 prevents weird row gaps */
}

.preview-card {
    position: relative;
    background: #111118;
    border: 1px solid #222;
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
    transition: 0.2s;
}


/* Player */
.preview-player {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

#preview,
#offline-img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

/* LIVE pill */
.live-pill {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff1a1a;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
}

.live-pill.offline {
    background-color: #2a2a2a;
    color: #666666;
    box-shadow: none;
}

.live-pill.connecting {
    background-color: #9c7300;
    color: #fdfdfd;
}

/* Bottom overlay */
.preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;

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

    padding: 8px 12px;
    font-size: 13px;

    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.85),
            rgba(0, 0, 0, 0.4),
            transparent);
}

/* Text styles */
.preview-overlay span {
    color: #fff;
    font-weight: 500;
}

.live-pill,
.preview-overlay,
.preview-overlay * {
    cursor: default !important;
}

.restream-container,
.chat-container {
    position: relative;
    background: #111118;
    border: 1px solid #222;
    border-radius: 16px;

    width: 420px;
    /* 🔥 fixed width */
    min-width: 420px;
    /* 🔥 prevents shrinking */
    max-width: 420px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
    transition: 0.2s;
    padding: 10px;
}

.chat-container {
    flex: 1;
    /* grow vertically, NOT shrink width */
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.restream-container {
    min-height: 0;
    flex: 0 0 auto;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 5px;
    margin-bottom: 15px;
    color: #00AAAF;
}

/* Flexbox Row */
.platform-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #2d2e37;
    /* Subtle divider */
}

.platform-row:last-child {
    border-bottom: none;
}

.platform-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.platform-name {
    font-weight: 500;
    font-size: 1rem;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    min-width: 60px;
    text-align: center;
}

.status-badge.live {
    background-color: #00AAAF;
    color: #ffffff;
}

.status-badge.connecting {
    background-color: #9c7300;
    color: #fdfdfd;
}

.status-badge.disabled {
    background-color: #2a2a2a;
    color: #666666;
    box-shadow: none;
}

.status-badge.offline {
    background-color: #2a2a2a;
    color: #666666;
}

.platform-icon {
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    display: inline-block;
    background-color: #333;
    /* Placeholder color */
    border-radius: 4px;
}

.no-destination {
    padding: 20px 0;
    text-align: center;
    color: #666666;
}

.platform-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.platform-actions {
    display: flex;
    align-items: center;
    justify-content: space-between; /* spreads items */
    width: 160px; /* fixed width (adjust as needed) */
}

.no-hover:hover {
    background: #111118;
    transform: none;
    box-shadow: none;
    filter: none;
}

.live-btn {
    color: #fff;
    background: #00AAAF;
}

.live-btn.active {
    background: red;
}

.live-btn.active:hover {
    background: #ff4242;
}

#botrix-chat-overlay {
    flex: 1;
    min-height: 0;
    display: flex;
}

#botrix-chat-overlay iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* =========================
   MOBILE OPTIMIZATION
========================= */
@media (max-width: 768px) {

    /* Top bar */
    #top-bar {
        height: 55px;
        padding: 0 12px;
        font-size: 16px;
        justify-content: center;
    }

    .header-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .header-logo img {
        max-height: 30px;
    }

    #hamburger-button {
        position: absolute;
        left: 0px;
    }

    #hamburger-dropdown {
    position: absolute;
    top: 55px;
    /* under top bar */
    left: 0;
    right: auto;
    min-width: 150px;
}

    #top-bar a {
        font-size: 14px;
    }

    .platform-button {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Login box smaller */
    .login-box {
        padding: 25px 20px;
        max-width: 90%;
    }

    .login-box h2 {
        font-size: 18px;
    }

    .login-box input,
    .login-box button {
        font-size: 13px;
        padding: 10px;
    }

    /* Modal */
    .modal-content {
        width: 90%;
        padding: 25px 20px;
    }

    .modal-content h2 {
        font-size: 18px;
    }

    .modal-content input,
    .modal-content button {
        font-size: 13px;
        padding: 10px;
    }

    /* Results dropdown */
    .results-container {
        max-height: 150px;
    }

    .results-container div {
        padding: 8px;
        font-size: 13px;
    }

    .settings-container {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #111;
    }

    .settings-sidebar a {
        flex: 1;
        text-align: center;
        padding: 12px 0;
        font-size: 12px;
    }

    .stream-card-container {
        gap: 10px;
    }

    .stream-card {
        flex-direction: column;
        /* stack info + actions */
        align-items: flex-start;
    }

    .stream-card.live input {
        padding-right: 0px;
    }

    .stream-actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }

    /* Card layout */
    .preview-card {
        max-width: 100%;
        border-radius: 12px;
        min-height: 0;
    }

    .dashboard {
        margin-top: 5px;
        margin-left: 0;
        gap: 5px;
        flex-direction: column;
    }

    .restream-container,
    .chat-container {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .section-title {
        font-size: 14px;
    }

    /* Player spacing */
    .preview-player {
        aspect-ratio: 16 / 9;
    }

    /* Video / image scaling */
    #preview {
        width: 100%;
        height: 100%;
        object-fit: contain;
        /* prevents face/scene cropping on mobile */
    }

    /* LIVE pill */
    .live-pill {
        font-size: 10px;
        padding: 4px 8px;
        top: 8px;
        left: 8px;
    }

    /* Bottom overlay */
    .preview-overlay {
        font-size: 11px;
        padding: 6px 8px;
    }

    /* Bitrate text */
    .bitrate {
        font-size: 11px;
    }

    .platform-name {
        font-size: 0.7rem;
    }

    .platform-icon {
        width: 18px;
        height: 18px;
    }

    .status-badge {
        padding: 2px 6px;
        font-size: 0.7rem;
        min-width: 45px;
    }
}