/* Offline Indicator Styles */

/* Safe area insets for modern Android devices */
body {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Ensure full viewport height for PWA */
html, body {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow-x: hidden;
}

/* Body classes for offline state */
body.offline .ss-content-highlight,
body.offline .ss-content-article {
    opacity: 0.8;
    position: relative;
}

body.offline .ss-content-highlight::after,
body.offline .ss-content-article::after {
    content: "Cached";
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 107, 107, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-family: Arial, sans-serif;
    z-index: 10;
}

/* Form submission indicators */
body.offline form button[type="submit"] {
    position: relative;
}

body.offline form button[type="submit"]::after {
    content: "Will sync when online";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 107, 107, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

body.offline form button[type="submit"]:hover::after {
    opacity: 1;
}

/* Navigation indicators */
body.offline .navbar-nav > li > a {
    position: relative;
}

body.offline .navbar-nav > li > a[href*="/trails/"]::after,
body.offline .navbar-nav > li > a[href*="/racing/"]::after {
    content: "📴";
    margin-left: 4px;
    font-size: 12px;
}

/* Sync status indicator */
.sync-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 6px;
}

.sync-status.syncing {
    display: flex;
    background: rgba(255, 193, 7, 0.9);
}

.sync-status.success {
    display: flex;
    background: rgba(40, 167, 69, 0.9);
}

.sync-status.error {
    display: flex;
    background: rgba(220, 53, 69, 0.9);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #offline-indicator,
    #online-indicator {
        font-size: 12px;
        padding: 6px;
    }
    
    .sync-status {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
    }
}

/* Offline mode specific styles */
body.offline .requires-online {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

body.offline .requires-online::before {
    content: "Unavailable offline";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
}
