/**
 * FGC Trens - Offline UI Styles
 * Styles for network status, cached data banners, and offline indicators
 */

/* ============================================================================
   NETWORK STATUS INDICATOR
   ============================================================================ */

.network-status {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.network-status.online {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.95) 0%, rgba(56, 142, 60, 0.95) 100%);
    color: white;
}

.network-status.offline {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.95) 0%, rgba(211, 47, 47, 0.95) 100%);
    color: white;
}

.network-icon {
    font-size: 16px;
    animation: pulse 2s ease-in-out infinite;
}

.network-text {
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.3px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* ============================================================================
   CACHED DATA BANNER
   ============================================================================ */

.cached-data-banner {
    background: linear-gradient(135deg, #FFF3CD 0%, #FFE69C 100%);
    color: #856404;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid #FFE69C;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.cached-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.cached-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.cached-text {
    font-size: 14px;
    line-height: 1.5;
    font-family: 'Montserrat', sans-serif;
}

.cached-text strong {
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================================
   SYNC PENDING INDICATOR
   ============================================================================ */

.sync-pending-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.95) 0%, rgba(25, 118, 210, 0.95) 100%);
    color: white;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.3);
    animation: slideInLeft 0.3s ease-out;
    backdrop-filter: blur(10px);
}

.sync-icon {
    font-size: 18px;
    animation: rotate 2s linear infinite;
}

.sync-text {
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.3px;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* ============================================================================
   CACHED INDICATOR BADGE
   ============================================================================ */

.cached-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 193, 7, 0.15);
    color: #F57C00;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 193, 7, 0.3);
    font-family: 'Montserrat', sans-serif;
}

.cached-indicator::before {
    content: '📦';
    font-size: 12px;
}

/* ============================================================================
   OFFLINE MODE OVERLAY
   ============================================================================ */

.offline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.offline-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease-out;
}

.offline-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.offline-title {
    font-size: 24px;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 12px;
    font-family: 'Montserrat', sans-serif;
}

.offline-message {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 24px;
    font-family: 'Montserrat', sans-serif;
}

.offline-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, #88BB0B 0%, #6A9308 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.offline-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(136, 187, 11, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================================
   STORAGE USAGE INDICATOR
   ============================================================================ */

.storage-usage-container {
    padding: 20px;
    background: linear-gradient(135deg, #F5F7FA 0%, #E8ECF1 100%);
    border-radius: 12px;
    margin: 20px 0;
}

.storage-usage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.storage-usage-title {
    font-size: 14px;
    font-weight: 700;
    color: #1A1A1A;
    font-family: 'Montserrat', sans-serif;
}

.storage-usage-value {
    font-size: 13px;
    color: #666;
    font-family: 'Roboto Mono', monospace;
}

.storage-usage-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.storage-usage-fill {
    height: 100%;
    background: linear-gradient(90deg, #88BB0B 0%, #6A9308 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.storage-usage-fill.warning {
    background: linear-gradient(90deg, #FF9800 0%, #F57C00 100%);
}

.storage-usage-fill.critical {
    background: linear-gradient(90deg, #F44336 0%, #D32F2F 100%);
}

.storage-clear-btn {
    margin-top: 12px;
    padding: 8px 16px;
    background: white;
    color: #F44336;
    border: 1px solid #F44336;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    width: 100%;
}

.storage-clear-btn:hover {
    background: #F44336;
    color: white;
}

/* ============================================================================
   OFFLINE CACHE BUTTON
   ============================================================================ */

.cache-station-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(136, 187, 11, 0.1) 0%, rgba(106, 147, 8, 0.1) 100%);
    color: #6A9308;
    border: 2px solid rgba(136, 187, 11, 0.3);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.cache-station-btn:hover {
    background: linear-gradient(135deg, rgba(136, 187, 11, 0.2) 0%, rgba(106, 147, 8, 0.2) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(136, 187, 11, 0.2);
}

.cache-station-btn.cached {
    background: linear-gradient(135deg, #88BB0B 0%, #6A9308 100%);
    color: white;
    border-color: #88BB0B;
}

.cache-station-btn .icon {
    font-size: 16px;
}

/* ============================================================================
   LAST SYNC TIMESTAMP
   ============================================================================ */

.last-sync-timestamp {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(136, 187, 11, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: #6A9308;
    font-family: 'Montserrat', sans-serif;
    margin-top: 8px;
}

.last-sync-timestamp::before {
    content: '🕐';
    font-size: 14px;
}

/* ============================================================================
   DARK MODE SUPPORT
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .cached-data-banner {
        background: linear-gradient(135deg, #5A4B2C 0%, #4A3B1C 100%);
        color: #FFE69C;
        border-bottom-color: #4A3B1C;
    }

    .storage-usage-container {
        background: linear-gradient(135deg, #2A2D35 0%, #1F2228 100%);
    }

    .storage-usage-title {
        color: #E0E0E0;
    }

    .storage-usage-value {
        color: #B0B0B0;
    }

    .storage-clear-btn {
        background: #2A2D35;
        color: #F44336;
    }

    .storage-clear-btn:hover {
        background: #F44336;
        color: white;
    }

    .offline-content {
        background: #1E1E1E;
    }

    .offline-title {
        color: #E0E0E0;
    }

    .offline-message {
        color: #B0B0B0;
    }
}

/* Body dark mode class */
body.dark-mode .cached-data-banner {
    background: linear-gradient(135deg, #5A4B2C 0%, #4A3B1C 100%);
    color: #FFE69C;
    border-bottom-color: #4A3B1C;
}

body.dark-mode .storage-usage-container {
    background: linear-gradient(135deg, #2A2D35 0%, #1F2228 100%);
}

body.dark-mode .storage-usage-title {
    color: #E0E0E0;
}

body.dark-mode .storage-usage-value {
    color: #B0B0B0;
}

body.dark-mode .storage-clear-btn {
    background: #2A2D35;
    color: #F44336;
}

body.dark-mode .storage-clear-btn:hover {
    background: #F44336;
    color: white;
}

body.dark-mode .offline-content {
    background: #1E1E1E;
}

body.dark-mode .offline-title {
    color: #E0E0E0;
}

body.dark-mode .offline-message {
    color: #B0B0B0;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .network-status {
        top: 60px;
        right: 10px;
        padding: 10px 16px;
        font-size: 12px;
    }

    .cached-data-banner {
        padding: 12px 16px;
    }

    .cached-text {
        font-size: 12px;
    }

    .sync-pending-indicator {
        bottom: 10px;
        left: 10px;
        padding: 10px 16px;
        font-size: 12px;
    }

    .offline-content {
        padding: 30px 20px;
        margin: 20px;
    }

    .offline-icon {
        font-size: 48px;
    }

    .offline-title {
        font-size: 20px;
    }

    .offline-message {
        font-size: 14px;
    }
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .network-status,
    .cached-data-banner,
    .sync-pending-indicator,
    .offline-overlay,
    .offline-content {
        animation: none;
    }

    .sync-icon {
        animation: none;
    }

    .network-icon {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .network-status,
    .cached-data-banner,
    .sync-pending-indicator {
        border: 2px solid currentColor;
    }

    .cached-indicator {
        border-width: 2px;
    }
}
