/**
 * MusicFlow - PWA Styles
 * Install banner, offline indicator, notifications
 */

/* PWA Install Banner */
#pwa-install-banner {
    position: fixed;
    bottom: calc(var(--player-height, 72px) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 9998;
    width: calc(100% - 2rem);
    max-width: 500px;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

#pwa-install-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-text strong {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.pwa-banner-text span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pwa-banner-install {
    padding: 0.625rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 100px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.pwa-banner-install:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

.pwa-banner-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pwa-banner-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Offline Banner */
#offline-banner {
    position: fixed;
    top: var(--header-height, 64px);
    left: 0;
    right: 0;
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #ef4444;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

#offline-banner.show {
    transform: translateY(0);
}

#offline-banner i {
    font-size: 1.1rem;
}

/* iOS Install Modal */
.pwa-ios-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pwa-ios-modal.show {
    opacity: 1;
}

.pwa-ios-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 24px 24px 8px 8px;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.pwa-ios-modal.show .pwa-ios-content {
    transform: translateY(0);
}

.pwa-ios-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-ios-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 1.5rem;
}

.pwa-ios-content h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.pwa-ios-content ol {
    text-align: left;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    line-height: 2;
}

.pwa-ios-content ol i {
    color: var(--primary);
    margin: 0 0.25rem;
}

/* PWA Toast */
.pwa-toast {
    position: fixed;
    bottom: calc(var(--player-height, 72px) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: calc(100% - 2rem);
}

.pwa-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.pwa-toast i {
    font-size: 1.25rem;
}

.pwa-toast-success {
    border-left: 4px solid #10b981;
}

.pwa-toast-success i {
    color: #10b981;
}

.pwa-toast-error {
    border-left: 4px solid #ef4444;
}

.pwa-toast-error i {
    color: #ef4444;
}

.pwa-toast-info {
    border-left: 4px solid var(--primary);
}

.pwa-toast-info i {
    color: var(--primary);
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle.dark::before {
    transform: translateX(20px);
    background: var(--primary);
}

.theme-toggle i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    transition: opacity 0.3s ease;
}

.theme-toggle .ri-sun-line {
    left: 6px;
    color: #f59e0b;
}

.theme-toggle .ri-moon-line {
    right: 6px;
    color: var(--primary);
}

/* Notification Toggle */
.notification-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.notification-toggle:hover {
    background: var(--bg-hover);
}

.notification-toggle.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.notification-toggle i {
    font-size: 1.25rem;
}

/* When app is installed, hide install prompts */
body.pwa-installed [data-pwa-install] {
    display: none !important;
}

/* Mobile adjustments */
@media (max-width: 576px) {
    #pwa-install-banner {
        bottom: calc(var(--player-height, 72px) + 0.5rem);
        width: calc(100% - 1rem);
    }
    
    .pwa-banner-content {
        padding: 0.875rem 1rem;
    }
    
    .pwa-banner-text span {
        display: none;
    }
    
    .pwa-toast {
        left: 0.5rem;
        right: 0.5rem;
        transform: translateX(0) translateY(20px);
        max-width: none;
    }
    
    .pwa-toast.show {
        transform: translateX(0) translateY(0);
    }
}
