/**
 * Sync Status Indicator Styles
 * PWA Phase 2 - Sync Status UI Component
 */

/* Sync Status Button (Fixed Position) */
#sync-status-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e91e63;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.3s ease;
}

#sync-status-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(233, 30, 99, 0.6);
}

#sync-status-button.syncing {
    background: #2196f3;
    animation: pulse-sync 1.5s infinite;
}

#sync-status-button.has-pending {
    background: #ff9800;
}

#sync-status-button.offline {
    background: #9e9e9e;
}

#sync-status-button .material-icons {
    font-size: 28px;
}

#sync-status-button.syncing .material-icons {
    animation: rotate 1s linear infinite;
}

/* Sync Text Styles */
#sync-status-button .sync-text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Remove rotation for text (keep pulsing only) */
#sync-status-button.syncing .sync-text {
    animation: none;
}

/* Sync Status Panel */
#sync-status-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

#sync-status-panel.show {
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Panel Header */
.sync-panel-header {
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sync-panel-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.sync-panel-header .close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
}

/* Panel Body */
.sync-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
}

.sync-status-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.sync-status-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sync-status-icon.success {
    background: #4caf50;
    color: white;
}

.sync-status-icon.pending {
    background: #ff9800;
    color: white;
}

.sync-status-icon.error {
    background: #f44336;
    color: white;
}

.sync-status-icon .material-icons {
    font-size: 20px;
}

.sync-status-content {
    flex: 1;
}

.sync-status-content .title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.sync-status-content .button-hint {
    font-size: 11px;
    color: #888;
    font-style: italic;
    margin-top: 2px;
    margin-bottom: 2px;
}

.sync-status-content .time {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* Panel Footer */
.sync-panel-footer {
    flex-shrink: 0;
    padding: 12px 15px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
}

.sync-panel-footer button {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sync-btn-primary {
    background: #e91e63;
    color: white;
}

.sync-btn-primary:hover {
    background: #c2185b;
}

.sync-btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.sync-btn-secondary:hover {
    background: #e0e0e0;
}

.sync-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Sync Animations */
@keyframes pulse-sync {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(33, 150, 243, 0.6);
    }
}

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

/* Empty State */
.sync-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.sync-empty-state .material-icons {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.sync-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Badge Counter */
#sync-pending-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Last Sync Time */
.last-sync-time {
    flex-shrink: 0;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: #666;
    background: #f9f9f9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #sync-status-button {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }

    #sync-status-button .material-icons {
        font-size: 24px;
    }

    #sync-status-panel {
        bottom: 75px;
        right: 15px;
        left: 15px;
        width: auto;
    }

    #sync-pending-count {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
}

/* Changed Fields Summary */
.changed-fields-list {
    margin-top: 4px;
    margin-bottom: 2px;
    line-height: 1.5;
}

.changed-field {
    display: inline-block;
    background: #f0f4ff;
    padding: 1px 6px;
    border-radius: 3px;
    margin: 2px 3px 2px 0;
    font-size: 10px;
    color: #555;
    border: 1px solid #e0e6f0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading Spinner */
.sync-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #e91e63;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

