/* BenTV「我的设备」页面：使用 AeroCore 主题变量，随主题自动适配浅色/深色模式。 */

.bentv-devices-page {
    --bentv-accent: var(--theme-color, #2563eb);
    --bentv-link: var(--color-link, var(--theme-color, #2563eb));
    --bentv-link-hover: var(--color-link-hover, var(--theme-color, #1d4ed8));
    --bentv-success: var(--color-success, #15803d);
    --bentv-danger: var(--color-danger, #b42318);
    --bentv-radius: var(--border-radius, 8px);
    color: var(--text-primary, #1e293b);
    font-size: 16px;
    line-height: 1.6;
}

.bentv-devices-page,
.bentv-devices-page * {
    box-sizing: border-box;
}

.bentv-devices-page__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.bentv-devices-page__sources-link {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 13px;
    font-size: 13px;
}

.bentv-devices-page__eyebrow,
.bentv-devices-card__kicker {
    margin: 0 0 6px;
    color: var(--bentv-link);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.4;
    text-transform: uppercase;
}

.bentv-devices-page__title {
    margin: 0;
    color: var(--caption-color, var(--text-primary, #1e293b));
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.bentv-devices-page__description {
    max-width: 680px;
    margin: 10px 0 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
}

.bentv-devices-page__secure {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-primary, #e5e7eb);
    border-radius: 999px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 600;
}

.bentv-devices-page__secure svg,
.bentv-devices-card__icon svg,
.bentv-button svg,
.bentv-devices-empty svg,
.bentv-device-list__icon svg,
.aerocore-child-devices-tab svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.bentv-devices-page__secure svg {
    width: 18px;
    height: 18px;
    color: var(--bentv-success);
}

.bentv-devices-card {
    margin: 0 0 18px;
    padding: clamp(20px, 4vw, 32px);
    border: 1px solid var(--border-primary, #e5e7eb);
    border-radius: calc(var(--bentv-radius) + 6px);
    background: var(--bg-card, #fff);
    box-shadow: var(--shadow-sm, 0 4px 16px rgba(15, 23, 42, .05));
}

.bentv-devices-card__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.bentv-devices-card h2 {
    margin: 0;
    color: var(--caption-color, var(--text-primary, #1e293b));
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 700;
    line-height: 1.35;
}

.bentv-devices-card__intro {
    max-width: 760px;
    margin: 0 0 22px;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.7;
}

.bentv-devices-card__step,
.bentv-devices-card__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 38px;
    min-height: 32px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-tertiary, #64748b);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
}

.bentv-devices-card__count {
    min-width: 34px;
    font-size: 14px;
    letter-spacing: 0;
}

.bentv-devices-card--login {
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.bentv-devices-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--bentv-link);
}

.bentv-devices-card__body {
    min-width: 0;
}

.bentv-devices-card__body h2 {
    margin-bottom: 8px;
}

.bentv-devices-card__body p {
    margin: 0 0 18px;
    color: var(--text-secondary, #475569);
}

.bentv-pair-result {
    display: grid;
    justify-items: center;
    gap: 6px;
    margin: 22px 0 16px;
    padding: 22px 18px;
    border: 1px solid var(--border-primary, #e5e7eb);
    border-radius: var(--bentv-radius);
    background: var(--bg-secondary, #f8fafc);
    text-align: center;
}

.bentv-pair-result__label {
    color: var(--text-tertiary, #64748b);
    font-size: 13px;
    font-weight: 600;
}

.bentv-pair-result__code {
    color: var(--caption-color, var(--text-primary, #1e293b));
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: clamp(34px, 8vw, 52px);
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    letter-spacing: .18em;
    line-height: 1.1;
    padding-left: .18em;
}

.bentv-pair-result__code.is-expired {
    color: var(--text-muted, #94a3b8);
}

.bentv-confirm-code {
    width: fit-content;
    min-width: 220px;
    margin: 16px 0 22px;
    padding: 14px 22px;
    border: 1px solid var(--border-primary, #e5e7eb);
    border-radius: calc(var(--bentv-radius) + 6px);
    background: var(--bg-secondary, #f8fafc);
    color: var(--caption-color, var(--text-primary, #1e293b));
    font: 800 clamp(28px, 7vw, 38px)/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: .16em;
    text-align: center;
}

.bentv-button.is-success {
    background: var(--color-success, #15803d);
    color: #fff;
}

.bentv-device-list__revoke:disabled {
    cursor: wait;
    opacity: .65;
}

.bentv-pair-result__timer {
    color: var(--bentv-link);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.bentv-pair-result__hint {
    max-width: 520px;
    color: var(--text-secondary, #475569);
    font-size: 13px;
}

.bentv-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
    min-height: 46px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--bentv-radius);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    touch-action: manipulation;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease, opacity .2s ease, transform .2s ease;
}

.bentv-button:hover {
    transform: translateY(-1px);
}

.bentv-button:active {
    transform: translateY(0);
}

.bentv-button:focus-visible,
.bentv-tv-code-form input:focus-visible,
.bentv-device-list__revoke:focus-visible,
#app-user-center .uc-sidebar .aerocore-child-devices-tab:focus-visible {
    outline: 3px solid var(--color-link, var(--theme-color, #2563eb));
    outline-offset: 3px;
}

.bentv-button--primary {
    background: var(--bentv-accent);
    color: #fff;
}

.bentv-button--primary:hover {
    background: var(--bentv-link-hover);
    color: #fff;
}

.bentv-button--primary:disabled {
    cursor: wait;
    opacity: .65;
    transform: none;
}

.bentv-button--secondary {
    border-color: var(--border-input, #e2e8f0);
    background: var(--bg-card, #fff);
    color: var(--bentv-link);
}

.bentv-button--secondary:hover {
    border-color: var(--border-hover, #cbd5e1);
    background: var(--bg-hover, #f1f5f9);
    color: var(--bentv-link-hover);
}

.bentv-devices-card__note,
.bentv-devices-card__footer-note,
.bentv-form-help {
    margin: 12px 0 0;
    color: var(--text-tertiary, #64748b);
    font-size: 13px;
    line-height: 1.6;
}

.bentv-devices-message {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid var(--color-danger-border, #f0b8b5);
    border-radius: var(--border-radius-sm, 6px);
    background: var(--color-danger-bg, #fff1f0);
    color: var(--bentv-danger);
    font-size: 14px;
    line-height: 1.55;
}

.bentv-devices-message:not([hidden]) {
    display: block;
}

.bentv-tv-code-form > label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary, #1e293b);
    font-size: 14px;
    font-weight: 700;
}

.bentv-tv-code-form__row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.bentv-tv-code-form input {
    width: min(100%, 300px);
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--border-input, #e2e8f0);
    border-radius: var(--bentv-radius);
    background: var(--bg-card, #fff);
    color: var(--text-primary, #1e293b);
    font: 700 20px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: .12em;
    text-align: center;
}

.bentv-tv-code-form input::placeholder {
    color: var(--text-muted, #94a3b8);
    font-size: 15px;
    letter-spacing: 0;
}

.bentv-devices-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 34px 18px;
    border: 1px dashed var(--border-primary, #e5e7eb);
    border-radius: var(--bentv-radius);
    background: var(--bg-secondary, #f8fafc);
    text-align: center;
}

.bentv-devices-empty svg {
    width: 34px;
    height: 34px;
    margin-bottom: 4px;
    color: var(--text-tertiary, #64748b);
}

.bentv-devices-empty p {
    margin: 0;
    color: var(--text-primary, #1e293b);
    font-weight: 700;
}

.bentv-devices-empty span {
    color: var(--text-secondary, #475569);
    font-size: 14px;
}

.bentv-device-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bentv-device-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-secondary, #f1f5f9);
    border-radius: var(--bentv-radius);
    background: var(--bg-secondary, #f8fafc);
}

.bentv-device-list__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bg-card, #fff);
    color: var(--bentv-link);
}

.bentv-device-list__info {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    gap: 3px;
}

.bentv-device-list__info strong {
    overflow-wrap: anywhere;
    color: var(--text-primary, #1e293b);
    font-size: 15px;
}

.bentv-device-list__info code {
    overflow-wrap: anywhere;
    color: var(--text-tertiary, #64748b);
    font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.bentv-device-list__info small {
    color: var(--text-tertiary, #64748b);
    font-size: 12px;
}

.bentv-device-list__revoke {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: var(--border-radius-sm, 6px);
    color: var(--bentv-danger);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.bentv-device-list__revoke:hover {
    background: var(--color-danger-bg, #fff1f0);
    color: var(--bentv-danger);
}

/* 个人中心入口使用真实链接，沿用 AeroCore 侧栏的文字与悬停色。 */
#app-user-center .uc-sidebar .aerocore-child-devices-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    border-left: 3px solid transparent;
    cursor: pointer;
    color: var(--color-text-secondary, var(--text-secondary, #475569));
    font-size: 14px;
    text-decoration: none;
    touch-action: manipulation;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

#app-user-center .uc-sidebar .aerocore-child-devices-tab:hover {
    border-left-color: var(--theme-color, var(--bentv-link));
    background: color-mix(in srgb, var(--theme-color, var(--bentv-link)) 6%, transparent);
    color: var(--theme-color, var(--bentv-link));
}

#app-user-center .uc-sidebar .aerocore-child-devices-tab:focus-visible {
    outline: 3px solid var(--bentv-link);
    outline-offset: -3px;
}

#app-user-center .uc-sidebar .aerocore-child-devices-tab svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.aerocore-child-devices-fallback {
    width: max-content;
    margin: 16px auto;
    border-color: var(--border-primary, #e5e7eb);
    background: var(--bg-secondary, #f8fafc);
}

@media (max-width: 640px) {
    .bentv-devices-page__header {
        display: block;
    }

    .bentv-devices-page__sources-link,
    .bentv-devices-page__secure {
        margin-top: 16px;
    }

    .bentv-devices-card--login {
        display: block;
    }

    .bentv-devices-card__icon {
        margin-bottom: 14px;
    }

    .bentv-tv-code-form__row {
        display: grid;
    }

    .bentv-tv-code-form input {
        width: 100%;
    }

    .bentv-button {
        width: 100%;
    }

    .bentv-device-list__item {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .bentv-device-list__info {
        width: calc(100% - 56px);
    }

    .bentv-device-list__revoke {
        width: 100%;
        border-top: 1px solid var(--border-primary, #e5e7eb);
        border-radius: 0;
        padding: 12px 8px 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bentv-button,
    #app-user-center .uc-sidebar .aerocore-child-devices-tab {
        transition: none;
    }

    .bentv-button:hover {
        transform: none;
    }
}
