:root {
    --background: #0E1937;
    --background-2: #162447;
    --background-3: #1a2a53;
    --background-4: #1e305e;
    
    --border: #043457;
    --border-2: #053f68;

    --button: rgb(82, 253, 82);
    --button-red: rgb(253, 82, 82);
    --button-red-dark: rgb(179, 56, 56);
    --button-blue: rgb(82, 176, 253);
    --button-yellow: rgb(227, 253, 82);
    --button-gray: rgb(0 8 45 / 50%);
    --button-hover: rgb(37, 179, 37);
    --button-red-hover: rgb(179, 37, 37);
    --button-red-dark-hover: rgb(131, 26, 26);
    --button-blue-hover: rgb(37, 110, 179);
    --button-yellow-hover: rgb(179, 177, 37);
    --button-gray-hover: rgba(29, 29, 29, 0.473);
}

body {
    background: var(--background);
    color: #fff;
    margin: 0;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 20px;
}

body:has(.popup.active) {
    overflow: hidden !important;
}

.main {
    background: var(--background-2);
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 1000px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.resource-usage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    height: 100px;
}
.resource-usage > * {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    padding-top: 13px;
    background: var(--background);
    border: 1px solid var(--background-3);
    border-radius: 5px;
    font-weight: 600;
}

.resource-usage > *:nth-child(3), .resource-usage > *:nth-child(4) {
    justify-content: start;
    padding-top: 10px;
}

h1, h2, h3 {
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    box-shadow: none !important;
}

button {
    background: var(--button);
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    transition: background 150ms ease, transform 150ms ease;
}

button:hover { background: var(--button-hover); }
button.btn-red { background: var(--button-red); }
button.btn-red:hover { background: var(--button-red-hover); }
button.btn-red-dark { background: var(--button-red-dark); }
button.btn-red-dark:hover { background: var(--button-red-dark-hover); }
button.btn-blue { background: var(--button-blue); }
button.btn-blue:hover { background: var(--button-blue-hover); }
button.btn-yellow { background: var(--button-yellow); }
button.btn-yellow:hover { background: var(--button-yellow-hover); }
button.btn-gray { background: var(--button-gray); color: #c7c7c7; }
button.btn-gray:hover { background: var(--button-gray-hover); color: #c7c7c7; }
button:not([disabled]):active { transform: scale(0.95); }
button svg { pointer-events: none; }

button.text-area-upload {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 10px;
    font-size: 12px;
}

.running, .paused {
    width: fit-content;
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-family: sans-serif;
    user-select: none;
}

.running {
    background: rgba(130, 255, 130, 0.15);
    color: #c4e9c4;
}

.running::before {
    content: "✓";
    background: rgba(130, 255, 130, 0.4);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #c4e9c4;
    font-size: 14px;
}

.paused {
    background: rgba(255, 253, 130, 0.15);
    color: #ffd4b8;
}

.paused::before {
    content: "⏸";
    background: rgba(255, 247, 130, 0.4);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ffd4b8;
    font-size: 14px;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

table button {
    padding: 8px 15px;
    border-radius: 5px;
    height: fit-content;
    display: flex;
    width: fit-content;
    justify-content: center;
    align-items: center;
}

.popup {
    position: fixed;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    top: 0;
    left: 0;
    z-index: 1000;
    backdrop-filter: blur(10px) brightness(0.8);
}

.popup.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-content {
    padding: 20px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 10px;
    transform: translateY(50px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup.active .popup-content {
    transform: translateY(0);
    opacity: 1;
}
input, textarea, select {
    border: 2px solid var(--border);
    background: var(--background-3); 
    padding: 12px; 
    border-radius: 8px;
    color: #e0e0e0; 
    outline: none;
    transition: all 200ms ease; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); 
}

input:not(.custom-range):focus {
    border-color: var(--border-2); 
    box-shadow: 0 0 8px #70707079; 
    background: var(--background-4); 
}

textarea {
    border-width: 1px;
    resize: none;
    position: relative;
}

textarea::after {
    content: "Upload";
    background: #181818;
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px;
    border-radius: 5px;
}

[disabled] {
    cursor: not-allowed;
    opacity: 0.3 !important;
}

[disabled] * {
    pointer-events: none;
}

.custom-range {
    -webkit-appearance: none;
    width: 100%;
    background: var(--background-3);
    border-radius: 16px;
    outline: none;
    padding: 1px;
    margin: 0;
    border: 1px solid var(--border);
    height: 20px;
    transition: background 450ms ease-in;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.custom-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

div#chatter-list {
    max-height: 150px;
    overflow-y: auto; 
    padding: 5px;

    
    -webkit-appearance: none;
    width: 100%;
    background: var(--background-3);
    border-radius: 8px;
    outline: none;
    margin: 0;
    border: 1px solid var(--border);
    transition: background 450ms ease-in;
}

input[type="checkbox"] {
    margin: 0;
    width: 32px;
    height: 32px;
    position: relative;
    top: 2px;
    cursor: pointer;
    border: 2px solid var(--border) !important;
    background: var(--background) !important;
    appearance: none;
    -webkit-appearance: none;
    color: white;
    box-shadow: none !important;
}

input[type="checkbox"]:checked {
    background: var(--button) !important;
    border-color: var(--button-hover) !important;
}

input#create-instance-channel {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    width: calc(100% - 28px);
}

#search-results {
    background: var(--background-3);
    border: 3px solid var(--border);
    border-radius: 5px;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    height: 192px;
}

.search-results-loading {
    display: flex;
    justify-content: center;
    padding: 30px 10px;
    animation: fadeUpAnimation 0.5s ease;
}

.no-results {
    padding: 5px;
    color: #888;
}

.result {
    cursor: pointer;
    padding: 10px;
    display: flex;
    flex-direction: row;
    justify-content: start;
    gap: 5px;
    align-items: center;
    opacity: 0;
    transition: background 0.25s ease;
    animation: fadeUpAnimation 0.5s ease forwards;
}

.result:hover { background: var(--background-4); }
.result svg { width: 16px; height: 16px; margin-bottom: -2px; }

@keyframes fadeUpAnimation {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.hoverHint {
    position: fixed;
    transform: translateX(-50%) translateY(0);
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 16px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 17px 3px rgb(0 0 0 / 41%);
}

.hoverHint.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

.grid-container {
    width: 1000px;
    margin-top: 10px;
    display: grid;
    gap: 10px;
    grid-template-columns: 2fr 1fr;
}

.livestream-preview {
    background: var(--background-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.livestream-title {
    position: absolute;
    left: 10px;
    top: 10px;
    margin: 0;
    background: black;
    box-shadow: 0 0 9px 4px black;
}

.livestream-info {
    position: absolute;
    right: 10px;
    top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: end;
    font-weight: 600;
}

.livestream-info .category, .livestream-info .viewers {
    background: black;
    box-shadow: 0 0 9px 4px black;
}

.livestream-info .category { color: rgb(83, 252, 24); }
.livestream-info .viewers .highlight { color: rgb(83, 252, 24); }

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.not-live {
    opacity: 0.2;
    filter: blur(1px);
    user-select: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.chat-placeholder {
    background: var(--background-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chat-placeholder span {
    opacity: 0.2;
    filter: blur(1px);
    user-select: none;
}

.tab-container {
    width: 970px;
    margin-top: 10px;
    background: var(--background-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-content { display: none; width: 100%; }
.tab-content.active { display: block; }

.controls-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 44px;
}

.control-input {
    width: 70px;
    border: 1px solid #303030;
    border-radius: 8px;
    color: var(--button);
}

.submit-container {
    margin-top: 20px;
    text-align: right;
}

.fade-up {
    opacity: 0;
    animation: fadeUpAnimation 0.5s ease forwards;
}

.fade-up:nth-child(1) { animation-delay: 0.1s; }
.fade-up:nth-child(2) { animation-delay: 0.2s; }
.fade-up:nth-child(3) { animation-delay: 0.5s; }
.fade-up:nth-child(4) { animation-delay: 0.65s; }
.fade-up:nth-child(5) { animation-delay: 0.7s; }
.fade-up:nth-child(6) { animation-delay: 0.75s; }
.fade-up:nth-child(7) { animation-delay: 0.8s; }
.fade-up:nth-child(8) { animation-delay: 0.85s; }

#logs { 
	font-family: monospace; 
	max-height: 500px; 
	overflow-y: auto;
    background: #181818;
    padding: 10px;
}

#logs br {
    display: none;
}