/* Offline Mode Styles for Dunamis Growth */

/* Connection Status Indicator */
#connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1000;
    transition: all 0.3s ease;
}

#connection-status.online {
    background-color: #10B981;
    color: white;
}

#connection-status.offline {
    background-color: #EF4444;
    color: white;
    animation: pulse 2s infinite;
}

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

/* Offline Mode Body Styling */
body.offline-mode {
    filter: grayscale(20%);
}

body.offline-mode::before {
    content: "Offline Mode";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #EF4444, #F59E0B);
    color: white;
    text-align: center;
    padding: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 999;
}

/* Offline Notifications */
.offline-notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    max-width: 350px;
}

.offline-notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    animation: slideIn 0.3s ease;
}

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

.offline-notification.success {
    border-left: 4px solid #10B981;
}

.offline-notification.warning {
    border-left: 4px solid #F59E0B;
}

.offline-notification.error {
    border-left: 4px solid #EF4444;
}

.offline-notification.info {
    border-left: 4px solid #3B82F6;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    margin-bottom: 4px;
    color: #1F2937;
}

.notification-content p {
    margin: 0;
    color: #6B7280;
    font-size: 14px;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
}

.notification-close:hover {
    color: #374151;
}

/* Offline Form Indicators */
form[data-offline-save] {
    position: relative;
}

body.offline-mode form[data-offline-save]::after {
    content: "Will sync when online";
    position: absolute;
    top: -25px;
    right: 0;
    background: #F59E0B;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

/* Offline Status Panel */
.offline-status-panel {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.offline-status-panel h3 {
    margin: 0 0 12px 0;
    color: #1F2937;
    font-size: 16px;
}

.offline-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #E5E7EB;
}

.offline-status-item:last-child {
    border-bottom: none;
}

.offline-status-label {
    color: #6B7280;
    font-size: 14px;
}

.offline-status-value {
    color: #1F2937;
    font-weight: 500;
}

.offline-status-value.pending {
    color: #F59E0B;
}

.offline-status-value.synced {
    color: #10B981;
}

/* Sync Button */
.sync-button {
    background: linear-gradient(135deg, #6B46C1, #10B981);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sync-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.3);
}

.sync-button:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sync-button.syncing {
    background: #6B7280;
    position: relative;
}

.sync-button.syncing::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Offline Data Indicators */
.data-cached {
    position: relative;
}

.data-cached::before {
    content: "📱";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
    background: #10B981;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.data-pending-sync {
    position: relative;
}

.data-pending-sync::before {
    content: "⏳";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
    background: #F59E0B;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .offline-notifications {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    #connection-status {
        top: 5px;
        right: 5px;
        font-size: 11px;
        padding: 6px 12px;
    }
    
    body.offline-mode::before {
        font-size: 11px;
        padding: 3px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .offline-notification {
        background: #1F2937;
        color: white;
    }
    
    .notification-content strong {
        color: white;
    }
    
    .notification-content p {
        color: #D1D5DB;
    }
    
    .offline-status-panel {
        background: #1F2937;
        border-color: #374151;
    }
    
    .offline-status-panel h3 {
        color: white;
    }
    
    .offline-status-label {
        color: #D1D5DB;
    }
    
    .offline-status-value {
        color: white;
    }
}
