/* ========================================
   מילנר TV — add-on features: shared pieces
   (snackbar, confirm dialog, popup menu, home sections, panels, buttons)
   Tokens come from css/styles.css.
   ======================================== */

/* ----- Buttons ----- */
.fx-btn {
    height: 42px;
    padding: 0 20px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--dur-fast), transform var(--dur-fast);
}

.fx-btn:hover { background: var(--bg-card-hover); }
.fx-btn:active { transform: scale(0.97); }

.fx-btn--primary {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.fx-btn--primary:hover { background: var(--gradient-brand); }

.fx-btn--small {
    height: 32px;
    padding: 0 14px;
    font-size: 12px;
}

/* ----- Snackbar ----- */
.fx-snack {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 20px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 260;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(520px, calc(100vw - 32px));
    padding: 10px 14px 10px 18px;
    background: rgba(26, 10, 14, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-size: 14px;
    transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
}

.fx-snack--hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(12px);
}

body.mini-player-active .fx-snack { bottom: calc(var(--safe-bottom) + 88px); }

.fx-snack-text {
    min-width: 0;
    line-height: 1.4;
}

.fx-snack-action {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    color: var(--primary-light);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.fx-snack-action:hover { background: var(--error-subtle); }

/* ----- Confirm dialog ----- */
.fx-dialog {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fx-dialog--hidden { display: none; }

.fx-dialog-card {
    width: min(400px, 100%);
    padding: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    text-align: start;
}

.fx-dialog-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}

.fx-dialog-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.fx-dialog-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ----- Popup menu (extends .subtitle-menu) ----- */
.fx-menu {
    /* Opens under the gear, which sits at the inline end of the player header */
    inset-inline-start: auto;
    inset-inline-end: 12px;
    min-width: 240px;
    max-width: min(320px, calc(100vw - 32px));
    max-height: min(70vh, 460px);
    overflow-y: auto;
}

.fx-menu-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fx-menu-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: -4px 0 -4px;
    margin-inline-start: -6px;
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
}

.fx-menu-back:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.subtitle-menu-item.fx-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.fx-menu-item:disabled {
    color: var(--text-muted);
    cursor: default;
}

.fx-menu-item:disabled:hover { background: none; }

.fx-menu-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fx-menu-hint {
    flex-shrink: 0;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ----- Home sections (recent channels, reminders…) ----- */
.fx-home-section {
    width: min(560px, 100%);
    margin: 0 auto 18px;
}

.fx-home-section[hidden] { display: none; }

.fx-home-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* ----- Side panels ----- */
.fx-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 8px calc(var(--safe-bottom) + 16px);
}

/* ----- Control bar additions ----- */
.ctrl-btn.fx-ctrl-labelled {
    width: auto;
    gap: 6px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* ----- Keyboard / remote focus ring (body.kbd-nav is set by remote.js) ----- */
body.kbd-nav :focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

body.kbd-nav .channel-item:focus,
body.kbd-nav .country-item:focus,
body.kbd-nav .subtitle-menu-item:focus,
body.kbd-nav .home-search-item:focus {
    outline-offset: -2px;
    background: var(--bg-card-hover);
}

@media (prefers-reduced-motion: reduce) {
    .fx-snack { transition: none; }
}
