/* PWA Styles */

/* Install Button */
.pwa-install-button {
    display: none; /* Hidden by default, shown when install is available */
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background-color: #343a40;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-install-button:hover {
    background-color: #23272b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.pwa-install-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.pwa-install-button i {
    font-size: 18px;
}

/* RTL Support */
html[lang="ar"] .pwa-install-button {
    right: auto;
    left: 20px;
}

/* Offline Indicator */
.offline-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #dc3545;
    color: white;
    text-align: center;
    padding: 5px 10px;
    font-size: 14px;
    z-index: 2000;
}

.offline-indicator.visible {
    display: block;
}

/* Push Notification Toggle */
.push-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.push-toggle input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.push-toggle .toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: all 0.3s;
}

.push-toggle .toggle-switch:after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 1px;
    left: 1px;
    transition: all 0.3s;
}

.push-toggle input:checked + .toggle-switch {
    background-color: #28a745;
}

.push-toggle input:checked + .toggle-switch:after {
    left: calc(100% - 19px);
}

.push-toggle input:focus + .toggle-switch {
    box-shadow: 0 0 1px #28a745;
}

.push-toggle input:disabled + .toggle-switch {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Reading List Button */
.pwa-reading-list-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary-color, #005bac);
    color: #fff;
    border: none;
    border-radius: var(--border-radius, 0.375rem);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition, all 0.3s ease);
    box-shadow: var(--shadow-soft, 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.08));
    margin: 0.75rem 0;
    text-decoration: none;
    line-height: 1.5;
}

.pwa-reading-list-button:hover:not(:disabled) {
    background-color: var(--primary-hover, #0073e6);
    box-shadow: var(--box-shadow-hover, 0 8px 15px rgba(0, 0, 0, 0.06), 0 3px 6px rgba(0, 0, 0, 0.1));
    transform: translateY(-1px);
    color: #fff;
}

.pwa-reading-list-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-soft, 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.08));
}

.pwa-reading-list-button:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb, 0 91 172) / 0.25);
}

.pwa-reading-list-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.pwa-reading-list-button i {
    font-size: 0.875rem;
}

/* Success state */
.pwa-reading-list-button.saved {
    background-color: var(--success-color, #28a745);
}

.pwa-reading-list-button.saved:hover:not(:disabled) {
    background-color: #218838;
}

/* Error state */
.pwa-reading-list-button.error {
    background-color: var(--danger-color, #dc3545);
}

.pwa-reading-list-button.error:hover:not(:disabled) {
    background-color: #c82333;
}

/* Loading state */
.pwa-reading-list-button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.pwa-reading-list-button.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Dark mode support */
.dark-mode .pwa-reading-list-button {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dark-mode .pwa-reading-list-button:hover:not(:disabled) {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* RTL Support */
html[dir="rtl"] .pwa-reading-list-button,
html[lang="ar"] .pwa-reading-list-button {
    flex-direction: row-reverse;
}

/* Media queries for responsive design */
@media (max-width: 768px) {
    .pwa-install-button {
        bottom: 15px;
        right: 15px;
        padding: 8px 16px;
        font-size: 14px;
    }

    html[lang="ar"] .pwa-install-button {
        right: auto;
        left: 15px;
    }

    .pwa-reading-list-button {
        padding: 8px 14px;
        font-size: 13px;
    }
}