/* ============================================================
   wacha.net — home / guide page
   Depends on css/theme.css for tokens.
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* --- NAVIGATION --------------------------------------------- */
.wacha-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 64px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(9, 9, 11, 0.72);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid var(--line);
}

.brand-logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-main);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.brand-logo span { color: var(--wacha-orange); }
.brand-logo:hover { color: #fff; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.header-welcome { font-size: 0.8rem; color: var(--text-dim); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--wacha-orange);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.dropdown-toggle:hover .user-avatar { transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.dropdown-toggle::after { display: none; }

.dropdown-menu {
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 6px;
    margin-top: 8px !important;
}
.dropdown-item { color: var(--text-main); border-radius: var(--radius-sm); font-size: 0.875rem; padding: 8px 12px; }
.dropdown-item:hover { background: var(--glass); color: #fff; }

/* --- ALERTS ------------------------------------------------- */
.page-alerts { padding: 12px 2rem 0; display: grid; gap: 8px; }
.alert {
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--text-main);
    font-size: 0.875rem;
    padding: 12px 16px;
}
.alert-danger { border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.alert-danger i { color: var(--danger); }
.alert-success { border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.08); }
.alert-success i { color: var(--live); }

/* --- HERO --------------------------------------------------- */
.hero {
    position: relative;
    isolation: isolate;
    text-align: center;
    padding: 4.5rem 2rem 3.5rem;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
}

/* soft orange glow + faint grid behind the headline */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 60% 55% at 50% 0%, rgba(241, 99, 41, 0.22), transparent 70%),
        radial-gradient(ellipse 40% 40% at 15% 110%, rgba(241, 99, 41, 0.08), transparent 70%),
        linear-gradient(180deg, #0c0c0f 0%, var(--bg) 100%);
}
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, #000 20%, transparent 75%);
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.1rem;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(241, 99, 41, 0.1);
    border: 1px solid rgba(241, 99, 41, 0.3);
    color: #ffb08a;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero h1 {
    font-size: clamp(2.4rem, 5.5vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.02;
    margin-bottom: 0.75rem;
}
.hero h1 span {
    background: linear-gradient(90deg, #ff8a4c, var(--wacha-orange) 60%, #ffb08a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    color: var(--text-dim);
    font-size: 1.05rem;
    margin: 0 auto 1.75rem;
    max-width: 520px;
}

/* single pill: input + button */
.hero-form {
    display: flex;
    align-items: center;
    max-width: 620px;
    margin: 0 auto;
    padding: 6px 6px 6px 18px;
    border-radius: 999px;
    background: rgba(17, 17, 20, 0.85);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.hero-form:focus-within {
    border-color: rgba(241, 99, 41, 0.6);
    box-shadow: var(--shadow-glow);
}
.hero-form .hero-icon { color: var(--text-faint); margin-right: 10px; }
.hero-form input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text-main);
    font-family: var(--font);
    font-size: 1rem;
    padding: 12px 8px;
}
.hero-form input::placeholder { color: var(--text-faint); }
.hero-form button {
    flex: none;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: var(--wacha-orange);
    border: 0;
    border-radius: 999px;
    padding: 12px 22px;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.hero-form button:hover { background: var(--wacha-orange-hover); transform: translateY(-1px); }

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1.1rem;
    flex-wrap: wrap;
}

.hero-error {
    color: #fca5a5;
    font-size: 0.85rem;
    margin-top: 0.85rem;
}

/* --- GUIDE -------------------------------------------------- */
.guide-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 2rem 12px;
}
.guide-label h2 {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.guide-label h2 i { color: var(--wacha-orange); font-size: 0.9rem; }
.guide-label .guide-hint { font-size: 0.78rem; color: var(--text-faint); }

.guide-wrapper {
    position: relative;
    background: var(--bg);
    border-top: 1px solid var(--line);
}

/* --- Timeline header --- */
.guide-header {
    display: flex;
    position: sticky;
    top: 64px;
    z-index: 900;
    background: rgba(17, 17, 20, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.channel-info-header {
    width: 176px;
    min-width: 176px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
    border-right: 1px solid var(--line);
}

.time-slots { display: flex; flex: 1; }
.slot {
    flex: 1;
    padding: 13px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
    border-left: 1px solid var(--line);
}
.slot:first-child { border-left: 0; }

/* --- Live marker (the red line) --- */
.live-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--wacha-orange), rgba(241, 99, 41, 0.15));
    box-shadow: 0 0 14px rgba(241, 99, 41, 0.5);
    z-index: 950;
    pointer-events: none;
    transform: translateX(-1px);
}
.live-marker::before {
    content: attr(data-time);
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--wacha-orange);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(241, 99, 41, 0.45);
}

/* --- Channel rows --- */
.section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.section-label::before {
    content: '';
    width: 10px;
    height: 2px;
    border-radius: 2px;
    background: var(--wacha-orange);
}

.channel-row {
    display: flex;
    height: 132px;
    border-bottom: 1px solid var(--line);
    transition: background var(--dur) var(--ease);
}
.channel-row:hover { background: rgba(255, 255, 255, 0.018); }

.channel-identity {
    position: relative;
    width: 176px;
    min-width: 176px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}
.channel-identity > a {
    display: block;
    width: 100%;
    line-height: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-3);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 6px 16px rgba(0, 0, 0, 0.35);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.channel-identity > a:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.channel-identity img {
    width: 100%;
    aspect-ratio: 160 / 85;
    object-fit: cover;
    display: block;
}
.channel-identity .channel-name {
    width: 100%;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* no channel art: room name becomes the tile */
.channel-identity.no-logo > a {
    aspect-ratio: 160 / 85;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    padding: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--wacha-orange);
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
}
.channel-identity.no-logo .channel-name { display: none; }

.channel-flags {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 2;
}
.channel-flags .chip { padding: 4px 6px; backdrop-filter: blur(6px); }

.user-owned .channel-identity { box-shadow: inset 3px 0 0 var(--wacha-orange); }

/* --- Program blocks --- */
.program-track {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.program-block {
    position: absolute;
    top: 6px;
    height: calc(100% - 12px);
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 0 0 2px var(--bg);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    container-type: inline-size;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
                border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.program-block:hover {
    background: var(--surface-3);
    border-color: rgba(241, 99, 41, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 0 0 2px var(--bg), var(--shadow-glow);
    color: inherit;
    z-index: 200;
}

.prog-thumb {
    flex: none;
    width: 112px;
    aspect-ratio: 16 / 9;
    align-self: center;
    border-radius: var(--radius-sm);
    background: var(--surface-3) center / cover no-repeat;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.prog-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.prog-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.prog-time {
    font-size: 0.7rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prog-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prog-meta {
    font-size: 0.72rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}
.prog-remaining {
    color: #4ade80;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* elapsed-time bar along the bottom of the live block */
.prog-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
}
.prog-progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--wacha-orange-deep), var(--wacha-orange));
    transition: width 1s linear;
}

/* now playing */
.block-current {
    background: linear-gradient(135deg, #1b1b20 0%, #141417 100%);
    border-color: rgba(241, 99, 41, 0.28);
    z-index: 100;
}

/* past / future */
.block-past, .block-future { opacity: 0.55; }
.block-past:hover, .block-future:hover { opacity: 1; }
.block-past .prog-thumb, .block-future .prog-thumb { filter: saturate(0.6); }
.block-empty { opacity: 0.35; border-style: dashed; }
.block-empty:hover { opacity: 0.7; }
.block-empty .prog-title { color: var(--text-dim); font-weight: 500; }

/* narrow blocks: drop the thumbnail, then the time */
@container (max-width: 260px) {
    .prog-thumb { display: none; }
}
@container (max-width: 150px) {
    .prog-time { display: none; }
    .prog-meta { display: none; }
}
@container (max-width: 70px) {
    .prog-top { display: none; }
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}

/* --- MODALS ------------------------------------------------- */
.modal-content {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal-backdrop.show { opacity: 0.7; backdrop-filter: blur(4px); }
.modal-header { border-color: var(--line); }
.modal-footer { border-color: var(--line); }
.btn-close-white { filter: invert(1) grayscale(100%) brightness(200%); }

.modal .form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }
.modal .form-control {
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    color: #fff;
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.modal .form-control:focus {
    background: var(--surface-3);
    border-color: var(--wacha-orange);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(241, 99, 41, 0.2);
}
.modal .form-control::placeholder { color: var(--text-faint); }

.modal .btn-primary {
    background: var(--wacha-orange);
    border-color: var(--wacha-orange);
    border-radius: var(--radius);
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 18px rgba(241, 99, 41, 0.25);
    transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.modal .btn-primary:hover {
    background: var(--wacha-orange-hover);
    border-color: var(--wacha-orange-hover);
    transform: translateY(-1px);
}
.modal .btn-secondary {
    background: var(--glass);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--text-dim);
}
.modal .btn-secondary:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }

.form-check-input { background-color: var(--surface-3); border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--wacha-orange); border-color: var(--wacha-orange); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(241, 99, 41, 0.2); border-color: var(--wacha-orange); }

/* Avatar selection */
.avatar-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}
.avatar-option {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    cursor: pointer;
    border: 3px solid transparent;
    background: var(--surface-2);
    transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
    object-fit: cover;
}
.avatar-option:hover { transform: scale(1.05); border-color: var(--line-strong); }
.avatar-option.selected { border-color: var(--wacha-orange); transform: scale(1.05); }

/* One-time credentials panel */
.credential-box {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    word-break: break-all;
    user-select: all;
    -webkit-user-select: all;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--line-strong);
    color: #fff;
}
.password-container { position: relative; }
.copy-button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--wacha-orange);
    cursor: pointer;
}

/* --- FOOTER ------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 3rem;
    padding: 1.75rem 2rem 2.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-faint);
}
.site-footer a { color: var(--text-dim); text-decoration: none; transition: color var(--dur) var(--ease); }
.site-footer a:hover { color: var(--wacha-orange); }

/* --- RESPONSIVE --------------------------------------------- */
@media (max-width: 900px) {
    .channel-identity, .channel-info-header { width: 140px; min-width: 140px; }
    .prog-thumb { width: 96px; }
}

@media (max-width: 768px) {
    .wacha-navbar { padding: 0 1rem; }
    .brand-logo { font-size: 1.15rem; }
    .header-welcome { display: none; }
    .hero { padding: 3rem 1.25rem 2.5rem; }
    .hero p { font-size: 0.95rem; }
    .hero-form { flex-direction: column; border-radius: var(--radius-lg); padding: 8px; gap: 6px; }
    .hero-form .hero-icon { display: none; }
    .hero-form input { width: 100%; padding: 12px 10px; text-align: center; }
    .hero-form button { width: 100%; border-radius: var(--radius); }
    .guide-label { padding: 16px 1rem 10px; }
    .section-label { padding: 10px 1rem; }
    .site-footer { gap: 0.9rem; padding: 1.5rem 1rem 2rem; }
}

/* Phones: the horizontal grid becomes a stack of cards driven by the same markup. */
@media (max-width: 640px) {
    .guide-header, .live-marker { display: none; }
    .guide-wrapper { overflow: visible; }

    .channel-row {
        flex-direction: column;
        height: auto;
        padding: 12px 1rem 14px;
        gap: 10px;
    }
    .channel-identity {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 0;
        background: transparent;
        border-right: 0;
    }
    .channel-identity > a { width: 96px; flex: none; }
    .channel-identity .channel-name {
        flex: 1;
        text-align: left;
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--text-main);
        white-space: normal;
    }
    .channel-identity.no-logo > a { width: 96px; }
    .channel-identity.no-logo .channel-name { display: block; }
    .channel-flags { position: static; margin-left: auto; }
    .user-owned .channel-identity { box-shadow: none; }
    .user-owned { box-shadow: inset 3px 0 0 var(--wacha-orange); }

    .program-track {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: visible;
    }
    .program-block {
        position: relative !important;
        left: auto !important;
        width: auto !important;
        height: auto;
        top: auto;
        margin: 0;
        padding: 10px;
        opacity: 1;
    }
    .program-block:hover { transform: none; }
    .block-current { order: 0; }
    .block-future { order: 1; }
    .block-past { order: 2; }
    .block-empty { display: none; }
    .block-past, .block-future { opacity: 0.7; }
    .prog-thumb { width: 96px; }
    .program-block { box-shadow: none; }
}

/* room-name tile shown only when channel art is missing */
.channel-identity .tile-name { display: none; }
.channel-identity.no-logo .tile-name { display: block; }
@media (max-width: 640px) {
    .channel-identity.no-logo > a { display: none; }
}
