/* =========================================================
   Hotflixx — várias lojas (seletor, aviso, pedir loja nova)
========================================================= */

.store-switch { position: relative; min-width: 0; }
.store-switch[hidden] { display: none; }

.store-switch-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; max-width: 240px;
    padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.store-switch-btn:hover { background: var(--surface-3); }
.store-switch-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.store-switch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.store-switch-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--success); }
.store-switch[data-tone="wait"] .store-switch-dot { background: var(--warning); }
.store-switch[data-tone="bad"] .store-switch-dot { background: var(--danger); }

.store-switch-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 300px; max-width: calc(100vw - 32px);
    max-height: min(70vh, 520px); overflow-y: auto; padding: 8px;
    background: var(--surface); border: 1px solid var(--border-strong, var(--border)); border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.store-switch-menu[hidden] { display: none; }
.store-switch-title { margin: 4px 8px 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }

.store-switch-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.store-switch-item:hover, .store-switch-item:focus-visible { background: var(--surface-2); outline: none; }
.store-switch-item.on { background: var(--surface-2); }
.store-switch-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--text-muted); flex: none; }
.store-switch-item.add .store-switch-icon { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.store-switch-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.store-switch-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-switch-text strong em { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-left: 4px; }
.store-switch-text small { font-size: 12px; color: var(--text-muted); }
.store-switch-text small.tone-ok { color: var(--success); }
.store-switch-text small.tone-wait { color: var(--warning); }
.store-switch-text small.tone-bad { color: var(--danger); }
.store-switch-check { color: var(--accent); display: grid; }
.store-switch-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.store-switch-item.link strong { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.store-switch-item.link { padding-left: 50px; }

/* Aviso no topo */
.store-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    margin: 0 0 18px; padding: 14px 16px; border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}
.store-banner[data-tone="bad"] {
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
    background: color-mix(in srgb, var(--danger) 9%, var(--surface));
}
.store-banner-text { flex: 1 1 320px; min-width: 0; }
.store-banner-title { display: block; font-size: 15px; margin-bottom: 2px; }
.store-banner-text p { margin: 0; font-size: 14px; color: var(--text-soft, var(--text)); line-height: 1.5; }
.store-banner-action { flex: none; text-decoration: none; }

/* Pedir nova loja */
.store-dialog {
    position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center;
    padding: 16px; background: rgba(0, 0, 0, .6);
}
.store-dialog.open { display: flex; }
.store-dialog-box {
    width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.store-dialog-box header, .store-dialog-box footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; }
.store-dialog-box header { border-bottom: 1px solid var(--border); }
.store-dialog-box header h3 { margin: 0; font-size: 18px; }
.store-dialog-box footer { border-top: 1px solid var(--border); justify-content: flex-end; }
.store-dialog-close { width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--surface-2); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.store-dialog-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }

.sd-field { display: flex; flex-direction: column; gap: 6px; }
.sd-field > span:first-child, .sd-group legend { font-size: 13px; font-weight: 700; color: var(--text-soft, var(--text-muted)); }
.sd-field small { font-size: 12px; color: var(--text-muted); }
.store-dialog input[type=text], .store-dialog select {
    width: 100%; box-sizing: border-box; min-height: 42px; padding: 9px 12px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-soft, var(--surface-2)); color: var(--text); font: inherit; font-size: 14px;
}
.store-dialog input[type=text]:focus, .store-dialog select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.sd-slug { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-soft, var(--surface-2)); }
.sd-slug em { display: flex; align-items: center; padding: 0 2px 0 12px; font-style: normal; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.sd-slug input[type=text] { border: 0; border-radius: 0; padding-left: 2px; background: transparent; min-width: 0; }
.sd-slug:focus-within { outline: 2px solid var(--accent); }
.sd-slug input:focus { outline: none !important; }

.sd-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sd-group legend { margin-bottom: 8px; padding: 0; }
.sd-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.sd-radio:has(input:checked) { border-color: var(--accent); }
.sd-radio > input { accent-color: var(--accent); margin-top: 3px; flex: none; }
.sd-radio > span { display: flex; flex-direction: column; gap: 6px; font-size: 14px; flex: 1; min-width: 0; }
.sd-radio small { color: var(--text-muted); font-size: 12px; }

.sd-note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--text-soft, var(--text)); }
.sd-note ol { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.sd-msg { margin: 0; font-size: 14px; font-weight: 600; }
.sd-msg:empty { display: none; }
.sd-msg[data-kind="ok"] { color: var(--success); }
.sd-msg[data-kind="error"] { color: var(--danger); }

@media (max-width: 760px) {
    .store-switch-btn { max-width: 150px; height: 36px; padding: 0 10px; font-size: 13px; }
    .store-dialog { padding: 0; align-items: flex-end; }
    .store-dialog-box { max-height: 92vh; border-radius: 18px 18px 0 0; }
}
@media (max-width: 430px) {
    .store-switch-btn { max-width: 118px; }
}

/* Telemóvel: o menu ocupa a largura do ecrã e o título da página dá lugar ao seletor */
@media (max-width: 760px) {
    .store-switch-menu { position: fixed; top: 64px; left: 16px; right: 16px; width: auto; max-width: none; }
    .topbar:has(.store-switch:not([hidden])) .topbar-page { display: none; }
    .store-switch-btn { max-width: 170px; }
}
@media (max-width: 430px) {
    .store-switch-btn { max-width: 140px; }
}
