/* ============================================================
   Action Card Framework — ce-card-* classes
   Reusable show/hide chrome for "what do you want to do" control
   grids (Binder Home today; other screens can adopt the same
   markup later). Visual skin (color, size, icon) for a given
   screen's cards lives in that screen's own page styles; this
   file only owns the customization mechanics: the hide/restore
   corner control, the hidden-state treatment, the undo toast,
   and the "Show Hidden Cards" toggle.
   ============================================================ */

.ce-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.ce-card-toolbar-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* ---- Show Hidden Cards toggle ---- */
.ce-cards-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.ce-cards-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.ce-cards-toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(3, 7, 14, 0.6);
    transition: background 0.18s ease, border-color 0.18s ease;
    flex-shrink: 0;
}

.ce-cards-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    transition: transform 0.18s ease, background 0.18s ease;
}

.ce-cards-toggle input:checked + .ce-cards-toggle-track {
    border-color: rgba(212, 168, 83, 0.5);
    background: rgba(212, 168, 83, 0.28);
}

.ce-cards-toggle input:checked + .ce-cards-toggle-track .ce-cards-toggle-thumb {
    transform: translateX(18px);
    background: #f4cf80;
}

.ce-cards-toggle input:focus-visible + .ce-cards-toggle-track {
    outline: 2px solid rgba(212, 168, 83, 0.5);
    outline-offset: 2px;
}

.ce-cards-toggle-label {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    font-weight: 800;
}

/* ---- Card slot (wraps one launcher card + its hide/restore control) ---- */
.ce-card-slot {
    position: relative;
}

/* Hidden cards stay out of the DOM flow entirely until "Show Hidden Cards" is on */
[data-card-grid][data-show-hidden="false"] .ce-card-slot[data-card-enabled="false"] {
    display: none;
}

.ce-card-slot[data-card-enabled="false"] .ce-card-slot__inner {
    opacity: 0.5;
    border-style: dashed;
}

.ce-card-slot__badge {
    display: none;
    margin: 2px 0 -4px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.66rem;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ce-card-slot[data-card-enabled="false"] .ce-card-slot__badge {
    display: inline-flex;
}

/* ---- Hide (X) / Restore (+) corner control ---- */
.ce-card-slot__hide,
.ce-card-slot__restore {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background: rgba(7, 11, 18, 0.55);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.ce-card-slot:hover .ce-card-slot__hide,
.ce-card-slot:focus-within .ce-card-slot__hide {
    opacity: 1;
}

.ce-card-slot__hide:hover,
.ce-card-slot__hide:focus-visible {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.12);
}

.ce-card-slot__hide svg,
.ce-card-slot__restore svg {
    width: 13px;
    height: 13px;
}

.ce-card-slot[data-card-enabled="false"] .ce-card-slot__hide {
    display: none;
}

.ce-card-slot[data-card-enabled="true"] .ce-card-slot__restore {
    display: none;
}

.ce-card-slot__restore {
    opacity: 1;
    color: #f4cf80;
    border-color: rgba(212, 168, 83, 0.4);
    background: rgba(212, 168, 83, 0.14);
}

.ce-card-slot__restore:hover,
.ce-card-slot__restore:focus-visible {
    background: rgba(212, 168, 83, 0.24);
}

.ce-card-slot__hide:focus-visible,
.ce-card-slot__restore:focus-visible {
    outline: 2px solid rgba(212, 168, 83, 0.5);
    outline-offset: 1px;
}

/* ---- Animations ---- */
.ce-card-slot.is-animating-out {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ce-card-slot.is-animating-in {
    animation: ce-card-slot-in 0.22s ease;
}

@keyframes ce-card-slot-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

/* ---- Undo toast (reuses the widget toast's visual language) ---- */
.ce-card-toast {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(212, 168, 83, 0.2);
    background: rgba(17, 24, 39, 0.85);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.82rem;
    line-height: 1.4;
}

.ce-card-toast__undo {
    border: 1px solid rgba(212, 168, 83, 0.32);
    border-radius: 8px;
    background: transparent;
    color: #f4cf80;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.ce-card-toast__undo:hover {
    background: rgba(212, 168, 83, 0.1);
}

@media (max-width: 720px) {
    .ce-card-slot__hide,
    .ce-card-slot__restore {
        opacity: 1;
        width: 22px;
        height: 22px;
        top: 6px;
        right: 6px;
    }

    .ce-card-slot__hide svg,
    .ce-card-slot__restore svg {
        width: 11px;
        height: 11px;
    }

    .ce-card-toolbar-hint {
        display: none;
    }
}
