/* StreamTeamTree — dark control-room theme, built for a Twitch team hub */

:root {
    --bg: #161616;
    --panel: #17171d;
    --panel-raised: #1f1f28;
    --line: #2a2a35;
    --text: #e9e9f0;
    --text-dim: #9a9aab;
    --accent: #9146ff;      /* Twitch purple */
   /* --accent-soft: #b98bff; */
    --accent-soft: color-mix(in srgb, var(--accent), white 20%);
    --live: #ff4d67;
    --ok: #3ddc97;
    --radius: 10px;
    --font-display: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: color-mix(in srgb, var(--bg), var(--accent) 2%);
    color: var(--text);
    font-family: var(--font-display);
    line-height: 1.5;
}

a { color: var(--accent-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 2px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.site-header .brand {
    display: inline-flex;
    align-items: center;
    min-width: 32px;
    min-height: 32px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.site-header nav {
    display: flex;
    align-items: center;
}

.site-header nav a {
    margin-left: 20px;
    color: var(--text-dim);
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
}

.site-header nav a i {
    font-size: 1.2rem;
    line-height: 1;
}

.site-header nav a:hover {
    color: var(--text);
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    min-height: 70vh;
}

.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.displayname {
    color: var(--accent);
}

.subtitle {
    color: var(--text-dim);
    margin-top: 0;
    margin-bottom: 28px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 18px;
}

.grid { display: grid; gap: 16px; }

.grid.cols-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Schedule list */
.schedule-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.schedule-item:last-child {
    border-bottom: none;
}

.schedule-item .when {
    font-family: var(--font-mono);
    color: var(--accent-soft);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 70px;
}

.schedule-item .when--full {
    min-width: 108px;
}

.schedule-item .sched-title {
    flex: 1 1 200px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.who {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* WHO block becomes identity cluster */
.schedule-item .who {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    color: var(--text-dim);
    font-size: 0.85rem;
    flex: 1 1 200px;
    min-width: 0;
}

/* User link + avatar grouping */
.schedule-item .user-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    min-width: 0;
    flex-shrink: 0;
}

/* Avatar (circular identity marker) */
.schedule-item .avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--line);
    background: var(--panel-raised);
}

/* Game category thumbnail - same footprint as the avatar, square instead of circular */
.category-thumb {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--line);
    background: var(--panel-raised);
}

.schedule-item .category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    color: var(--text-dim);
    font-size: 0.82rem;
}

/* Optional emphasis on name */
.schedule-item .name {
    color: var(--text);
}

/* Subtle hover identity feedback */
.schedule-item .user-link:hover .avatar {
    border-color: var(--accent-soft);
}

/* Badge system */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--panel-raised);
    color: var(--text-dim);
    margin-left: 8px;
}

.badge.recurring {
    color: var(--ok);
}

/* Link tree */
.linktree {
    max-width: 480px;
    margin: 40px auto;
    text-align: center;
}

.linktree .avatar-ring {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--live));
    margin: 0 auto 16px;
}

.link-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--panel-raised);
    background-image: linear-gradient(135deg, var(--btn-color1, transparent), var(--btn-color2, var(--btn-color1, transparent))), var(--btn-bg-image, none);
    background-size: auto, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    box-shadow: inset 0 0 0 var(--btn-border-w, 1px) var(--btn-border-c, var(--line));
    border: none;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 12px;
    color: var(--text);
    font-weight: 600;
    transition: box-shadow 0.15s, transform 0.1s;
}

.link-btn:hover {
    box-shadow: inset 0 0 0 max(2px, var(--btn-border-w, 1px)) var(--btn-border-c, var(--accent));
    transform: translateY(-1px);
    text-decoration: none;
}

.link-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    object-fit: contain;
    font-size: 1.1rem;
    text-align: center;
}

.link-btn-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-banner {
    width: 100%;
    max-height: 280px;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.team-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ------------------------------------------------------------
 * Toast notifications (AJAX form save/delete feedback)
 * ------------------------------------------------------------ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
}

.toast {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    animation: toast-in 0.15s ease-out;
}

.toast.success { border-color: #2e7d32; }
.toast.error { border-color: #c62828; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.omni-search {
    position: relative;
    flex: 1;
    max-width: 320px;
    margin: 0 16px;
}

.omni-search input {
    width: 100%;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--text);
    font-size: 0.9rem;
}

.omni-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    max-height: 420px;
    overflow-y: auto;
    z-index: 50;
}

.omni-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text);
    border-bottom: 1px solid var(--line);
}

.omni-search-result:last-child { border-bottom: none; }
.omni-search-result:hover, .omni-search-result:focus { background: var(--panel-raised); text-decoration: none; }

.omni-search-result img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.omni-search-result .omni-result-text { display: flex; flex-direction: column; min-width: 0; }
.omni-search-result .omni-result-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omni-search-result .omni-result-sub { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.omni-search-empty {
    padding: 12px 14px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* (mobile hiding replaced by the pop-out rules at the end of this file) */
.drag-handle {
    cursor: grab;
    color: var(--text-dim);
    padding: 0 4px;
    touch-action: none;
    user-select: none;
}

.drag-handle:active { cursor: grabbing; }

.sortable-ghost {
    opacity: 0.4;
}

[data-sortable] > * {
    display: flex;
    align-items: center;
}

.sortable-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.sortable-row > .link-btn,
.sortable-row > .panel-block {
    flex: 1;
    margin-bottom: 0;
}

.sortable-item-wrap {
    margin-bottom: 12px;
}

/* ------------------------------------------------------------
 * RGBA color pickers
 * ------------------------------------------------------------ */
.rgba-picker input[type="color"] {
    width: 40px;
    height: 32px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-raised);
    cursor: pointer;
}

.rgba-picker input[type="range"] {
    flex: 1;
}

/* ------------------------------------------------------------
 * Intro panel WYSIWYG editor
 * ------------------------------------------------------------ */
.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.wysiwyg-toolbar button {
    margin: 0;
    padding: 6px 10px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 0.85rem;
}

.wysiwyg-toolbar button:hover {
    background: var(--line);
}

.wysiwyg-editor {
    min-height: 280px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 18px;
    color: var(--text);
    resize: vertical;
    overflow: auto;
}

.wysiwyg-sep {
    display: inline-block;
    width: 1px;
    align-self: stretch;
    background: var(--line);
    margin: 2px 4px;
}

.wysiwyg-editor img.is-selected-image {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Floats are independent of whatever text-align the surrounding paragraph has -
   a floated image stays pinned to its edge and the text wraps around it,
   regardless of whether that text is itself left/center/right aligned. The
   !important here is a deliberate guard against a wrapping alignment div
   ever accidentally winning out over the float. */
.wysiwyg-editor img.floated-left,
.intro-content img.floated-left {
    float: left !important;
    margin: 4px 16px 12px 0;
    max-width: 45%;
}

.wysiwyg-editor img.floated-right,
.intro-content img.floated-right {
    float: right !important;
    margin: 4px 0 12px 16px;
    max-width: 45%;
}

.wysiwyg-editor:focus {
    outline: 2px solid var(--accent-soft);
    outline-offset: 2px;
}

.wysiwyg-editor img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}

.intro-content {
    text-align: left;
}

.intro-content::after {
    content: "";
    display: table;
    clear: both;
}

.intro-content img {
    max-width: 100%;
    border-radius: 10px;
    margin: 10px 0;
}

/* ------------------------------------------------------------
 * Public-page panels (intro / links / schedule, user-orderable)
 * ------------------------------------------------------------ */
.panel-block {
    margin-bottom: 24px;
}

/* ------------------------------------------------------------
 * Dashboard message banner
 * ------------------------------------------------------------ */
.dashboard-banner {
    background: color-mix(in srgb, var(--accent), transparent 82%);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 18px;
    margin-bottom: 20px;
    color: var(--text);
}

.dashboard-banner a { color: var(--accent-soft); text-decoration: underline; }

/* Forms */
label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 14px 0 6px;
}

input[type=text],
input[type=password],
input[type=url],
input[type=number],
select,
textarea {
    width: 100%;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}

input[type=checkbox] {
    width: auto;
    accent-color: var(--accent);
}

input[type=file] {
    color: var(--text-dim);
    font-size: 0.85rem;
}

button,
.btn {
    display: inline-block;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    margin-top: 16px;
}

button:hover,
.btn:hover {
    background: #a463ff;
    text-decoration: none;
}

button.secondary,
.btn.secondary {
    background: var(--panel-raised);
    border: 1px solid var(--line);
    color: var(--text);
}

button.danger,
.btn.danger {
    background: transparent;
    border: 1px solid var(--live);
    color: var(--live);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}

th {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.flash.success {
    background: rgba(61, 220, 151, 0.12);
    color: var(--ok);
    border: 1px solid rgba(61, 220, 151, 0.3);
}

.flash.error {
    background: rgba(255, 77, 103, 0.12);
    color: var(--live);
    border: 1px solid rgba(255, 77, 103, 0.3);
}

.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live);
    margin-right: 6px;
    box-shadow: 0 0 0 0 rgba(255,77,103,0.5);
}


.profile-avatar{
    width:120px;
    margin:0 auto 16px;
    text-align:center;
    position: relative;
}

.profile-avatar img{
    width:120px;
    height:120px;
    border-radius:50%;
    object-fit:cover;
    border:4px solid var(--line);
    display:block;
    margin:0 auto;
}

.profile-avatar.live img{
    border-color: var(--live);
}

.live-badge{
    display:inline-block;
    margin-top:8px;
    background:#e91916;
    color:#fff;
    font-size:.75rem;
    font-weight:700;
    letter-spacing:.08em;
    padding:4px 12px;
    border-radius:4px;
}

 .live-badge h1 {
    font-weight: 700;
    font-size: 1rem;
    margin:0px;
}
/* ------------------------------------------------------------
 * Live Now cards (homepage)
 * ------------------------------------------------------------ */
.live-cards {
    margin-top: 14px;
}

.live-card {
    position: relative;
    display: block;
    min-height: 170px;
    border-radius: var(--radius);
    overflow: hidden;
    background-color: var(--panel-raised);
    background-image: var(--live-bg, none);
    background-size: cover;
    background-position: center;
    color: #fff;
    outline: 2px solid var(--user-color, var(--line));
    outline-offset: -2px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.6);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.live-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 14px 28px rgba(0,0,0,0.75);
    z-index: 2;
}

.live-card:hover {
    text-decoration: none;
}

.live-card-overlay {
    position: relative;
    z-index: 1;
    height: 100%;
    min-height: 170px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgb(93 93 93 / 49%) 0%, rgb(0 0 0 / 65%) 45%, rgba(5, 5, 8, 0.88) 100%);
}

.live-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-card-top .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--user-color, rgba(255,255,255,0.8));
}

.live-card-name {
    font-weight: 700;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    text-shadow: 0 1px 6px rgb(0 0 0 / 91%), 0 0 6px rgb(0 0 0);
}

.live-card-viewers {
    flex-shrink: 0;
    font-size: 0.75rem;
    background: rgba(0,0,0,0.6);
    padding: 3px 9px;
    border-radius: 999px;
    text-shadow: none;
}

.live-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #fff;
    text-shadow: 0 1px 6px rgb(0 0 0 / 91%), 0 0 6px rgb(0 0 0);
}

.live-card-game {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #fff;
    text-shadow: 0 1px 6px rgb(0 0 0 / 91%), 0 0 6px rgb(0 0 0);
}

.live-card-game .category-thumb {
    border-color: rgba(255,255,255,0.4);
}

/* ------------------------------------------------------------
 * WYSIWYG image resize handle
 * ------------------------------------------------------------ */
.wysiwyg-editor img {
    cursor: grab;
}

.wysiwyg-editor img:active {
    cursor: grabbing;
}

.wysiwyg-resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--accent);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    cursor: nwse-resize;
    z-index: 5;
}

/* ------------------------------------------------------------
 * Partner badge + profile stats
 * ------------------------------------------------------------ */
.partner-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dim);
    vertical-align: middle;
    margin-left: 8px;
}

.partner-badge-svg {
    flex-shrink: 0;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 10px 0 4px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.profile-stat strong {
    color: var(--text);
    font-size: 1.05rem;
}

/* ------------------------------------------------------------
 * Offline members sort toggle
 * ------------------------------------------------------------ */
.offline-sort {
    display: flex;
    gap: 8px;
    margin: 4px 0 14px;
}

.offline-sort-btn {
    margin: 0;
    padding: 6px 14px;
    font-size: 0.85rem;
}

.offline-sort-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ------------------------------------------------------------
 * Uniform schedule rows (profile, schedule page, up next)
 * Layout: [ when | channel .... category / title ] + full-width notes,
 * with the frequency tag hanging half-off the bottom-right corner.
 * ------------------------------------------------------------ */
.sched-row {
    position: relative;
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 6px 14px;
    padding: 12px 4px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 14px;
    background: var(--panel-raised);
}

.sched-when {
    display: flex;
    flex-direction: column;
    justify-content: center;   /* vertically centered in its section */
    align-items: flex-start;   /* left aligned */
    padding-left: 12px;
    border-right: 1px solid var(--line);
}

.sched-date {
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.sched-time {
    font-family: var(--font-mono);
    color: var(--accent-soft);
    font-size: 0.95rem;
    white-space: nowrap;
}

.sched-main {
    min-width: 0;
    padding-right: 12px;
}

.sched-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sched-channel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    min-width: 0;
}

.sched-channel .avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--line);
}

.sched-channel span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sched-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    font-size: 0.82rem;
    flex-shrink: 0;
    text-align: right;
}

.sched-stream-title {
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.sched-notes {
    grid-column: 1 / -1;
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 6px 12px 0;
    border-top: 1px solid var(--line);
    margin-top: 4px;
}

.sched-notes p { margin: 4px 0; }
.sched-notes ul, .sched-notes ol { margin: 4px 0 4px 20px; }

.sched-frequency {
    position: absolute;
    right: 14px;
    bottom: -10px;   /* halfway off the border, like a popup close button */
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--ok);
    color: var(--ok);
}

/* ------------------------------------------------------------
 * Mobile search pop-out
 * ------------------------------------------------------------ */
.omni-search-toggle {
    display: none;
    margin: 0 0 0 12px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
}

.omni-search-toggle:hover { color: var(--text); }

@media (max-width: 720px) {
    .omni-search-toggle { display: inline-flex; }

    /* Replaces the old display:none - hidden until toggled, then slides
       down as a full-width bar under the header. */
    .omni-search {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-width: none;
        margin: 0;
        padding: 10px 16px;
        background: var(--panel);
        border-bottom: 1px solid var(--line);
        z-index: 40;
    }

    .omni-search.open { display: block; }

    .site-header { position: relative; }
}
