/* Styles for the insight notification bar and its contents */
.insight-notification-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* or width: 100%; */
    background-color: black;
    color: white;
    padding: 16px;
    z-index: 1050;
    /* Ensure it's above typical navbars and the main container */
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
    box-sizing: border-box;
    opacity: 0;
    /* For animation */
    transform: translateY(-100%);
    /* For animation */
    animation: insightSlideDown 0.5s ease-out forwards;
}

.insight-content-text {
    flex-grow: 1;
    margin-right: 16px;
    font-size: 16px;
    line-height: 1.4;
}

.insight-actions-container {
    display: flex;
    gap: 12px;
    /* Spacing between buttons */
}

.insight-add-btn,
.insight-cancel-btn {
    padding: 8px 16px;
    border: 1px solid #555;
    border-radius: 4px;
    background-color: #333;
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s, border-color 0.2s;
}

.insight-add-btn:hover {
    background-color: #4CAF50;
    /* Greenish for add */
    border-color: #4CAF50;
}

.insight-cancel-btn:hover {
    background-color: #f44336;
    /* Reddish for cancel */
    border-color: #f44336;
}

/* Renamed animations to avoid potential conflicts if other 'slideDown/Up' exist */
@keyframes insightSlideDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes insightSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* Subscription notification styles */
.subscription-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 1060;
    /* Use visibility and opacity for smooth transitions */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-100%);
    transition: all 0.5s ease-out;
    min-height: 50px;
    box-sizing: border-box;
    cursor: pointer;
    display: flex; /* Keep display property consistent */
}

.subscription-notification.visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.subscription-notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.subscription-notification-message {
    flex-grow: 1;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    margin-right: 16px;
}

.subscription-notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.subscription-notification-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.subscription-notification:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Animation for subscription notification */
@keyframes subscriptionSlideDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes subscriptionSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* PWA Update Banner styles */
.pwa-update-banner {
    position: fixed;
    top: 0;
    left: 50%;
    /* Start off-screen */
    transform: translateX(-50%) translateY(-100%);
    background: #000000;
    color: white;
    z-index: 10000;
    width: 100%;
    font-size: 16px;
    padding: 10px 0;
    animation: slideDown 0.5s ease-out forwards;
    /* Safe area support for iPhone notch/Dynamic Island */
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

.pwa-update-banner.success {
    background: #10251A;
    color: #d1fae5;
    border: none;
}

.pwa-update-banner.error {
    background: #4a2222;
    color: #fee2e2;
}

.pwa-update-banner.hiding {
    animation: slideUpToHide 0.5s ease-in forwards;
}

.pwa-update-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 0 20px;
    /* Safe area support for iPhone notch/Dynamic Island */
    padding-left: calc(20px + env(safe-area-inset-left, 0px));
    padding-right: calc(20px + env(safe-area-inset-right, 0px));
}

.pwa-update-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.4;
}

.pwa-update-main {
    font-weight: 600;
    font-size: 16px;
}

.pwa-update-countdown {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

.pwa-update-btn {
    background: white;
    color: #000000;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    width: 82.5px; /* Fixed width */
    height: 33px;   /* Fixed height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-update-btn.loading {
    /* Remove text space to ensure spinner is perfectly centered */
    font-size: 0;
    color: transparent; 
}

.pwa-update-btn.loading::after {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    /* Create a half-white, half-black border */
    border: 3px solid;
    border-color: #ffffff #000000 transparent transparent;
    animation: spin 1s linear infinite;
}

.pwa-update-btn:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-update-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.pwa-update-dismiss {
    background: transparent;
    color: white;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pwa-update-dismiss:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-120px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideUpToHide {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    to {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
}

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