/* ==========================================================================
   APT Store (H209B)
   Its own colorful look: a featured banner that changes daily, a colored icon
   per package, and a banner in the package's color on its page. Lists sit on
   the theme's own surface with a thin border. No glow.
   ========================================================================== */

#store-fullscreen {
    --store-card: var(--surface-color, #0d1117);
    --store-line: color-mix(in srgb, var(--on-surface, #ffffff) 11%, transparent);
    --store-line-strong: color-mix(in srgb, var(--on-surface, #ffffff) 22%, transparent);
    --store-muted: color-mix(in srgb, var(--on-surface, #ffffff) 60%, transparent);
    --store-ink: color-mix(in srgb, var(--on-surface, #ffffff) 22%, #ffffff);
    --store-on-ink: color-mix(in srgb, var(--background, #05080c) 85%, #000000);
}

html.theme-solar-flare #store-fullscreen {
    --store-ink: var(--on-surface);
    --store-on-ink: var(--background);
}

/* ---------- Header ---------- */

#store-fullscreen .store-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#store-fullscreen .store-header--list {
    flex-wrap: wrap;
}

#store-fullscreen .store-search {
    order: 3;
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--store-line-strong);
    color: var(--store-muted);
    cursor: text;
}

#store-fullscreen .store-search:focus-within {
    border-color: color-mix(in srgb, var(--on-surface, #ffffff) 40%, transparent);
}

#store-fullscreen .store-search input {
    flex: 1;
    min-width: 0;
    background: transparent !important;
    border: none !important;
    outline: none;
    box-shadow: none !important;
    color: var(--on-surface);
    font-family: var(--font-main);
    font-size: 16px;
}

#store-fullscreen .store-search input::placeholder {
    color: var(--store-muted);
}

#store-fullscreen .store-round-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--store-line-strong);
    background: transparent;
    color: var(--on-surface);
    cursor: pointer;
}

/* ---------- Body ---------- */

#store-fullscreen .store-body {
    padding: 16px 16px 0 !important;
    overflow-y: auto;
}

#store-fullscreen .store-column {
    max-width: 760px;
    margin: 0 auto;
    padding-bottom: 60px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#store-fullscreen #store-list-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- Category chips ---------- */

#store-fullscreen .store-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 0 16px 2px;
}

#store-fullscreen .store-chips::-webkit-scrollbar {
    display: none;
}

#store-fullscreen .store-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    height: 36px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1px solid var(--store-line-strong);
    background: transparent;
    color: var(--on-surface);
    font-family: var(--font-main);
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

#store-fullscreen .store-chip i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hue);
}

#store-fullscreen .store-chip.is-active {
    border-color: transparent;
    background: var(--hue);
    color: #ffffff;
}

#store-fullscreen .store-chip.is-active i {
    background: #ffffff;
}

#store-fullscreen .store-chip[data-cat="All"].is-active {
    background: var(--store-ink);
    color: var(--store-on-ink);
}

/* ---------- Featured banner ---------- */

#store-fullscreen .store-featured {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border-radius: 26px;
    color: #ffffff;
    cursor: pointer;
    overflow: hidden;
}

#store-fullscreen .store-featured-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}

#store-fullscreen .store-featured-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

#store-fullscreen .store-featured-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

#store-fullscreen .store-featured-icon svg {
    width: 32px;
    height: 32px;
    stroke: #ffffff;
}

#store-fullscreen .store-featured-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

#store-fullscreen .store-featured-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

#store-fullscreen .store-featured-summary {
    font-size: 0.88rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- Sections and rows ---------- */

#store-fullscreen .store-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 4px 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--store-muted);
}

#store-fullscreen .store-count {
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--store-line-strong);
    font-size: 0.7rem;
    letter-spacing: 0;
}

#store-fullscreen .store-list {
    border-radius: 22px;
    border: 1px solid var(--store-line);
    background: var(--store-card);
    overflow: hidden;
}

#store-fullscreen .store-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    cursor: pointer;
}

#store-fullscreen .store-row + .store-row {
    border-top: 1px solid var(--store-line);
}

#store-fullscreen .store-row:active {
    background: color-mix(in srgb, var(--on-surface, #ffffff) 5%, transparent);
}

#store-fullscreen .store-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 15px;
    background: var(--hue);
    color: #ffffff;
}

#store-fullscreen .store-icon svg {
    width: 26px;
    height: 26px;
    stroke: #ffffff;
}

#store-fullscreen .store-row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

#store-fullscreen .store-row-name {
    font-size: 0.98rem;
    font-weight: 650;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#store-fullscreen .store-row-summary {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--store-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#store-fullscreen .store-row-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--store-muted);
}

#store-fullscreen .store-row-meta i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

/* ---------- Buttons ---------- */

#store-fullscreen .store-btn,
.store-confirm .store-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex-shrink: 0;
    height: 36px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: var(--font-main);
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
}

#store-fullscreen .store-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

#store-fullscreen .store-btn.is-busy {
    opacity: 1;
}

#store-fullscreen .store-btn--ink,
.store-confirm .store-btn--ink {
    background: var(--store-ink, #ffffff);
    color: var(--store-on-ink, #05080c);
}

#store-fullscreen .store-btn--outline,
.store-confirm .store-btn--outline {
    background: transparent;
    color: var(--on-surface);
    border-color: var(--store-line-strong, rgba(255, 255, 255, 0.22));
}

#store-fullscreen .store-btn--white {
    height: 42px;
    padding: 0 22px;
    background: #ffffff;
    color: #111318;
}

#store-fullscreen .store-btn--glass {
    height: 42px;
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
}

#store-fullscreen .store-btn--icon {
    width: 42px;
    padding: 0;
}

.store-confirm .store-btn--danger {
    background: var(--error, #e5534b);
    color: #ffffff;
}

#store-fullscreen .store-spin {
    animation: spin 0.9s linear infinite;
}

/* ---------- Package page ---------- */

#store-fullscreen .store-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 20px;
    border-radius: 28px;
    color: #ffffff;
}

#store-fullscreen .store-hero-icon {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    margin-bottom: 10px;
}

#store-fullscreen .store-hero-icon svg {
    width: 38px;
    height: 38px;
}

#store-fullscreen .store-hero-name {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: #ffffff !important;
}

#store-fullscreen .store-hero-sub {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
}

#store-fullscreen .store-hero-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

#store-fullscreen .store-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 20px;
    border: 1px solid var(--store-line);
    background: var(--store-card);
}

#store-fullscreen .store-stats > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 14px 6px;
    text-align: center;
    min-width: 0;
}

#store-fullscreen .store-stats > div + div {
    border-left: 1px solid var(--store-line);
}

#store-fullscreen .store-stats span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--store-muted);
}

#store-fullscreen .store-stats strong {
    font-size: 0.95rem;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

#store-fullscreen .store-panel {
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid var(--store-line);
    background: var(--store-card);
}

#store-fullscreen .store-panel h3 {
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--store-muted);
}

#store-fullscreen .store-panel p {
    margin: 0;
    font-size: 0.93rem;
    line-height: 1.6;
    color: var(--on-surface);
}

#store-fullscreen .store-panel--quiet p {
    color: var(--store-muted);
}

#store-fullscreen .store-commands {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#store-fullscreen .store-commands code {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--store-line-strong);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--on-surface);
}

/* ---------- Empty state ---------- */

#store-fullscreen .store-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 56px 20px;
    text-align: center;
    color: var(--store-muted);
}

#store-fullscreen .store-empty strong {
    font-size: 1.1rem;
    color: var(--on-surface);
}

#store-fullscreen .store-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    border-radius: 18px;
    background: #8b5cf6;
    color: #ffffff;
}

/* ---------- Confirm dialog ---------- */

.store-confirm {
    display: flex !important;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.55) !important;
}

.store-confirm-card {
    --store-line-strong: color-mix(in srgb, var(--on-surface, #ffffff) 22%, transparent);
    --store-ink: color-mix(in srgb, var(--on-surface, #ffffff) 22%, #ffffff);
    --store-on-ink: color-mix(in srgb, var(--background, #05080c) 85%, #000000);
    width: 100%;
    max-width: 420px;
    padding: 22px;
    border-radius: 28px;
    border: 1px solid color-mix(in srgb, var(--on-surface, #ffffff) 11%, transparent);
    background: var(--surface-color, #0d1117);
    color: var(--on-surface);
    font-family: var(--font-main);
    animation: storeSheetUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.store-confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    color: #ffffff;
}

.store-confirm-card h3 {
    margin: 14px 0 6px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--on-surface);
}

.store-confirm-card p {
    margin: 0 0 20px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: color-mix(in srgb, var(--on-surface, #ffffff) 65%, transparent);
}

.store-confirm-actions {
    display: flex;
    gap: 10px;
}

.store-confirm-actions .store-btn {
    flex: 1;
    height: 46px !important;
}

@keyframes storeSheetUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: none; }
}

@media (min-width: 700px) {
    .store-confirm {
        align-items: center;
    }
}

/* ---------- Themes ---------- */

html.theme-amoled #store-fullscreen .store-list,
html.theme-amoled #store-fullscreen .store-panel,
html.theme-amoled #store-fullscreen .store-stats,
html.theme-amoled .store-confirm-card {
    background: #0a0a0a !important;
    border-color: #262626 !important;
}

html.theme-amoled #store-fullscreen .store-hero *,
html.theme-amoled #store-fullscreen .store-featured *,
html.theme-amoled #store-fullscreen .store-icon {
    color: #ffffff !important;
}

html.theme-amoled #store-fullscreen .store-btn--white,
html.theme-amoled #store-fullscreen .store-btn--ink {
    color: #000000 !important;
}
