/*
 * PWA UI — minimal styles for elements created dynamically by pwa.js.
 * The PWA install banner and offline page inline their own styles, so this
 * file only covers the controls pwa.js builds inside admin/portal pages:
 *   - Push notification toggle switch
 *   - Reading-list "save for offline" button
 *   - Notification-category toggles
 *
 * Cards, headers, buttons rely on BS5 base classes (.card, .btn, etc.).
 */

/* ---- Push toggle switch ----------------------------------------------- */
.push-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.push-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.push-toggle .toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    background-color: #cbd5e1;
    border-radius: 11px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.push-toggle .toggle-switch::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.push-toggle input[type="checkbox"]:checked + .toggle-switch {
    background-color: #0d6efd;
}

.push-toggle input[type="checkbox"]:checked + .toggle-switch::before {
    transform: translateX(18px);
}

.push-toggle input[type="checkbox"]:focus-visible + .toggle-switch {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

[dir="rtl"] .push-toggle .toggle-switch::before {
    left: auto;
    right: 2px;
}

[dir="rtl"] .push-toggle input[type="checkbox"]:checked + .toggle-switch::before {
    transform: translateX(-18px);
}

/* ---- Notification category list -------------------------------------- */
.notification-categories {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--bs-border-color, #e5e7eb);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg, #ffffff);
}

/* ---- Reading-list save button ---------------------------------------- */
.pwa-reading-list-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid #0d6efd;
    background-color: transparent;
    color: #0d6efd;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.pwa-reading-list-button:hover,
.pwa-reading-list-button:focus {
    background-color: #0d6efd;
    color: #ffffff;
}

.pwa-reading-list-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Dark mode tweaks (uses BS5 [data-bs-theme="dark"]) -------------- */
[data-bs-theme="dark"] .push-toggle .toggle-switch {
    background-color: #475569;
}

[data-bs-theme="dark"] .push-toggle .toggle-switch::before {
    background-color: #f1f5f9;
}

[data-bs-theme="dark"] .pwa-reading-list-button {
    border-color: #60a5fa;
    color: #93c5fd;
}

[data-bs-theme="dark"] .pwa-reading-list-button:hover,
[data-bs-theme="dark"] .pwa-reading-list-button:focus {
    background-color: #60a5fa;
    color: #0b1220;
}
