:root {
    font-family: system-ui, Arial, sans-serif;
    color: #eaf2ff;
    background: #0b1220;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

header {
    min-height: 56px;
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 0 24px;
    background: #111b30;
    border-bottom: 1px solid #24324d;
    flex-wrap: wrap;
}

header a {
    color: #9fd0ff;
    margin-left: auto;
}

.grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    padding: 18px;
}

.card {
    background: #111b30;
    border: 1px solid #24324d;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.video-card {
    grid-row: span 2;
}

.admin-card {
    border-color: #315a8a;
}

.stream-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #263551;
    margin-top: 12px;
}

.stream-box video {
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.pill {
    background: #0b1220;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #263551;
}

.wide {
    grid-column: 1 / -1;
}

form {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

input,
select,
button {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #30415f;
    background: #0b1220;
    color: #eaf2ff;
}

button {
    cursor: pointer;
    background: #1e88e5;
    border-color: #1e88e5;
    font-weight: 700;
    margin-top: 6px;
}

button.danger {
    background: #b3261e;
    border-color: #b3261e;
}

.item {
    padding: 8px 0;
    border-bottom: 1px solid #263551;
}

.item a {
    color: #9fd0ff;
}

.assign-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 8px;
}

.assign-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #111b30;
    border: 1px solid #24324d;
    border-radius: 14px;
    padding: 24px;
}

.error {
    background: #5c1f1f;
    padding: 10px;
    border-radius: 8px;
}

.success {
    background: #1f5c2d;
    padding: 10px;
    border-radius: 8px;
}

code {
    background: #0b1220;
    border: 1px solid #263551;
    border-radius: 6px;
    padding: 2px 6px;
}

@media (max-width: 1000px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .video-card {
        grid-row: auto;
    }

    header a {
        margin-left: 0;
    }
}


.overview-page {
    padding: 18px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stream-tile {
    background: #0b1220;
    border: 1px solid #263551;
    border-radius: 12px;
    overflow: hidden;
}

.stream-tile-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.stream-tile-video video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.stream-tile-info {
    display: grid;
    gap: 4px;
    padding: 10px;
}

.video-error {
    padding: 20px;
    color: #fff;
}


.overview-card {
    min-height: calc(100vh - 92px);
}

.overview-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.view-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.view-controls button {
    margin-top: 0;
    padding: 8px 12px;
}

.overview-grid.tiles-small {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.overview-grid.tiles-medium {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.overview-grid.tiles-large {
    grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
}

.stream-tile {
    position: relative;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.stream-tile:hover {
    transform: translateY(-2px);
    border-color: #3f7fbd;
    box-shadow: 0 12px 34px rgba(0,0,0,.35);
}

.stream-tile-video {
    position: relative;
}

.live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #b3261e;
    color: white;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,.25);
}

.stream-tile-info {
    grid-template-columns: 1fr;
}

.tile-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.tile-actions button,
.tile-actions a {
    display: inline-block;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #30415f;
    background: #0b1220;
    color: #eaf2ff;
    font-size: 14px;
}

.tile-actions button {
    margin-top: 0;
}

.stream-tile details {
    margin-top: 8px;
}

.stream-tile details small {
    display: block;
    overflow-wrap: anywhere;
    margin-top: 4px;
}

@media (max-width: 700px) {
    .overview-head {
        display: grid;
    }

    .overview-grid.tiles-large,
    .overview-grid.tiles-medium,
    .overview-grid.tiles-small {
        grid-template-columns: 1fr;
    }
}


.chat-page {
    padding: 18px;
}

.chat-card {
    min-height: calc(100vh - 100px);
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 12px;
}

.chat-messages {
    background: #0b1220;
    border: 1px solid #263551;
    border-radius: 10px;
    padding: 12px;
    max-height: 420px;
    overflow-y: auto;
    display: grid;
    gap: 10px;
}

.fullscreen-chat {
    max-height: none;
    min-height: 70vh;
}

.chat-message {
    background: #111b30;
    border: 1px solid #24324d;
    border-radius: 10px;
    padding: 10px;
}

.chat-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 14px;
}

.chat-head small {
    opacity: .7;
}

.chat-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.chat-form button {
    margin-top: 0;
}


.dashboard-chat-card {
    min-height: 420px;
}

.chat-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.chat-title-row a {
    color: #9fd0ff;
}

.dashboard-chat-messages {
    height: 280px;
    max-height: 280px;
}



/* v8 layout: Dashboard video left, chat right */
.video-side-chat {
    grid-row: span 2;
    min-height: 520px;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.video-side-chat .dashboard-chat-messages {
    height: auto;
    max-height: none;
    min-height: 360px;
}

/* Let the stream card and chat align in the first row */
.video-card {
    grid-row: span 2;
}

/* Chat at bottom of overview */
.overview-chat-card {
    margin-top: 18px;
}

.overview-chat-messages {
    min-height: 260px;
    max-height: 360px;
}

@media (min-width: 1001px) {
    .grid {
        grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
        align-items: start;
    }

    .video-card {
        grid-column: 1;
        grid-row: span 2;
    }

    .video-side-chat {
        grid-column: 2;
        grid-row: span 2;
    }
}

@media (max-width: 1000px) {
    .video-side-chat {
        grid-row: auto;
        min-height: auto;
    }

    .video-side-chat .dashboard-chat-messages {
        min-height: 260px;
        max-height: 320px;
    }
}


/* v10: Video und Chat wirklich direkt nebeneinander */
.dashboard-top-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
    gap: 18px;
    align-items: stretch;
}

.dashboard-top-row .video-card,
.dashboard-top-row .video-side-chat {
    grid-column: auto !important;
    grid-row: auto !important;
    height: 100%;
}

.dashboard-top-row .video-card {
    display: grid;
    grid-template-rows: auto auto auto;
}

.dashboard-top-row .video-side-chat {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100%;
}

.dashboard-top-row .dashboard-chat-messages {
    height: auto;
    max-height: none;
    min-height: 0;
}

@media (max-width: 1000px) {
    .dashboard-top-row {
        grid-template-columns: 1fr;
    }

    .dashboard-top-row .video-side-chat {
        min-height: auto;
    }

    .dashboard-top-row .dashboard-chat-messages {
        min-height: 260px;
        max-height: 320px;
    }
}


.chat-head span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chat-delete-btn {
    margin: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: #b3261e;
    border-color: #b3261e;
    line-height: 1.2;
    font-size: 14px;
}

.clear-chat-btn {
    width: max-content;
    margin: 0 0 8px 0;
    padding: 8px 10px;
}
