/**
 * PWA UI Styles
 * Install prompt, notifications, offline bar
 */

/* Install Banner - Bottom of screen */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-top: 1px solid rgba(255, 45, 117, 0.3);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.pwa-install-banner.visible {
    transform: translateY(0);
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ff2d75 0%, #ff6b9d 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pwa-install-text strong {
    font-size: 15px;
    color: #fff;
}

.pwa-install-text span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-install-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.pwa-install-dismiss:hover {
    color: white;
}

.pwa-install-accept {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.pwa-install-accept i {
    margin-right: 6px;
}

@media (max-width: 480px) {
    .pwa-install-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 16px;
    }
    
    .pwa-install-content {
        justify-content: flex-start;
    }
    
    .pwa-install-actions {
        justify-content: space-between;
    }
    
    .pwa-install-accept {
        flex: 1;
    }
}

/* Install Button */
.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.pwa-install-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.pwa-install-btn:active {
    transform: translateY(0);
}

.pwa-install-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

@media (max-width: 768px) {
    .pwa-install-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Notifications Container */
.pwa-notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

@media (max-width: 480px) {
    .pwa-notifications {
        left: 20px;
        right: 20px;
        top: 10px;
    }
}

/* Notification Item */
.pwa-notification {
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 16px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.pwa-notification.closing {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

@media (max-width: 480px) {
    .pwa-notification {
        min-width: auto;
        max-width: none;
    }
}

.notification-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    color: #e0e0e0;
    line-height: 1.4;
}

.notification-content strong {
    font-size: 15px;
    color: #ffffff;
    font-weight: 600;
}

.notification-content p {
    font-size: 13px;
    color: #b0b0b0;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #808080;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.notification-close:hover {
    color: #e0e0e0;
}

.notification-action {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-action:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.6);
}

/* Offline Status Bar */
.pwa-offline-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #ff6b6b 0%, #ff5252 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-offline-bar svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Dodaj padding-top na body kada je offline bar vidljiv */
body.offline .pwa-offline-bar ~ * {
    margin-top: 44px;
}

/* Light mode */
@media (prefers-color-scheme: light) {
    .pwa-notification {
        background: rgba(255, 255, 255, 0.95);
        border-color: rgba(102, 126, 234, 0.2);
        color: #333333;
    }

    .notification-content {
        color: #555555;
    }

    .notification-content strong {
        color: #000000;
    }

    .notification-content p {
        color: #777777;
    }

    .notification-close {
        color: #aaaaaa;
    }

    .notification-close:hover {
        color: #333333;
    }

    .notification-action {
        background: rgba(102, 126, 234, 0.1);
        color: #667eea;
        border-color: rgba(102, 126, 234, 0.3);
    }

    .notification-action:hover {
        background: rgba(102, 126, 234, 0.15);
        border-color: rgba(102, 126, 234, 0.5);
    }
}

/* Accessibility */
.pwa-install-btn:focus,
.notification-close:focus,
.notification-action:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .pwa-install-btn,
    .pwa-notification,
    .pwa-offline-bar {
        animation: none !important;
        transition: none !important;
    }
}
