/* Connection Monitor Styles */
.connection-status-banner {
    position: fixed;
    top: 0 !important;
    left: 0;
    right: 0;
    z-index: 10000;
    background-color: #dc2626;
    color: white;
    padding: 8px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease-in-out;
    margin: 0 !important;
    border: none;
    width: 100%;
}

.connection-status-banner.connected {
    background-color: #16a34a;
}

.connection-status-banner.reconnecting {
    background-color: #f59e0b;
}

/* Enhanced Blazor Error UI */
#blazor-error-ui {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    bottom: 0;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 1rem;
    position: fixed;
    right: 0;
    z-index: 1000;
    border-top: 3px solid #dc2626;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 1.2rem;
    color: #991b1b;
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

#blazor-error-ui .dismiss:hover {
    background-color: rgba(185, 28, 28, 0.1);
}

#blazor-error-ui .reload {
    color: #dc2626;
    text-decoration: underline;
    font-weight: 600;
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

#blazor-error-ui .reload:hover {
    background-color: rgba(220, 38, 38, 0.1);
    text-decoration: none;
}

/* Connection status indicator for when offline */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

.offline-indicator.reconnecting {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.offline-indicator.connected {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    animation: slideUp 0.3s ease-out 2s forwards;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

/* Spinner animation for reconnecting state */
.connection-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pulse animation for connection status icon */
.connection-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Adjust main content when connection banner is shown */
body.connection-banner-visible {
    padding-top: 40px;
}

body.connection-banner-visible .fixed.top-0:not(.connection-status-banner) {
    top: 40px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .connection-status-banner {
        padding: 6px 12px;
        font-size: 0.875rem;
    }

    body.connection-banner-visible {
        padding-top: 36px;
    }

    body.connection-banner-visible .fixed.top-0:not(.connection-status-banner) {
        top: 36px;
    }
}

/* Ensure connection banner appears above other fixed elements */
.connection-status-banner {
    z-index: 10000;
}

/* Ensure no gaps at the top of the page */
body.connection-banner-visible {
    margin-top: 0 !important;
}

html, body {
    margin: 0;
    padding: 0;
}

/* Style for retry button */
.connection-retry-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.connection-retry-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.connection-retry-btn:active {
    transform: translateY(1px);
}

/* Loading state for the entire app when offline */
.app-offline {
    pointer-events: none;
    opacity: 0.7;
    filter: grayscale(20%);
    transition: all 0.3s ease;
}

/* Override for connection banner to remain interactive */
.app-offline .connection-status-banner {
    pointer-events: auto;
    opacity: 1;
    filter: none;
}
