/* =============================================
   Offline QC — Shared offline UI styles
   ============================================= */

/* Offline banner (shown in SecureMainLayout) */
.offline-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    color: #856404;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
}

.offline-banner__icon {
    font-size: 18px;
}

/* No-cache error page */
.offline-no-data {
    text-align: center;
    padding: 48px 24px;
    color: #6c757d;
}

.offline-no-data h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #343a40;
}

.offline-no-data p {
    max-width: 400px;
    margin: 0 auto 24px;
    line-height: 1.5;
}

/* Sync conflict modal */
.qc-conflict-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.qc-conflict-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.qc-conflict-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
}

.qc-conflict-modal__header h4 {
    margin: 0;
    font-size: 17px;
}

.qc-conflict-modal__close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #6c757d;
}

.qc-conflict-modal__body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.qc-conflict-item {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.qc-conflict-item--conflict {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
}

.qc-conflict-item--error {
    background: #fff5f5;
    border-left: 4px solid #dc3545;
}

.qc-conflict-item__title {
    font-size: 14px;
    margin-bottom: 6px;
}

.qc-conflict-item__message {
    font-size: 13px;
    color: #6c757d;
}

.qc-conflict-modal__footer {
    padding: 12px 20px;
    border-top: 1px solid #dee2e6;
    text-align: right;
}

/* Progress bar for SweetAlert download popup */
.offline-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin: 16px 0 8px;
    overflow: hidden;
}

.offline-progress-fill {
    height: 100%;
    width: 0%;
    background: #28a745;
    border-radius: 4px;
    transition: width 0.3s ease;
}

#offline-download-progress {
    text-align: center;
}

/* Offline photo upload button — shown instead of SfUploader when offline */
.qcd-offline-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #f0f4ff;
    border: 1.5px dashed #003e7e;
    border-radius: 6px;
    color: #003e7e;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s ease;
}

.qcd-offline-upload-btn:hover {
    background: #e0eaff;
}

/* Offline download icon — project rows, mobile only */
.offlineDownloadIcon {
    display: none;
}

@media only screen and (max-width: 1023px) {
    .offlineDownloadIcon {
        display: block;
        width: 22px;
        height: 22px;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        cursor: pointer;
        transition: transform 0.15s ease, opacity 0.15s ease;
        margin-top: 20px;
    }

    .offlineDownloadIcon--idle {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='8 17 12 21 16 17'%3E%3C/polyline%3E%3Cline x1='12' y1='12' x2='12' y2='21'%3E%3C/line%3E%3Cpath d='M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29'%3E%3C/path%3E%3C/svg%3E");
        opacity: 0.4;
    }

    .offlineDownloadIcon--idle:active {
        transform: scale(1.2);
    }

    .offlineDownloadIcon--active {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='8 17 12 21 16 17'%3E%3C/polyline%3E%3Cline x1='12' y1='12' x2='12' y2='21'%3E%3C/line%3E%3Cpath d='M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29'%3E%3C/path%3E%3C/svg%3E");
        opacity: 0.7;
        animation: offlinePulse 1.2s ease-in-out infinite;
    }

    .offlineDownloadIcon--done {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2328a745' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'%3E%3C/path%3E%3Cpolyline points='22 4 12 14.01 9 11.01'%3E%3C/polyline%3E%3C/svg%3E");
        opacity: 0.7;
    }

    .offlineDownloadIcon--refreshing {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233B82F6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='23 4 23 10 17 10'%3E%3C/polyline%3E%3Cpolyline points='1 20 1 14 7 14'%3E%3C/polyline%3E%3Cpath d='M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15'%3E%3C/path%3E%3C/svg%3E");
        opacity: 0.7;
        animation: offlineSpin 1.5s linear infinite;
    }

    @keyframes offlinePulse {
        0%, 100% { opacity: 0.35; }
        50% { opacity: 0.9; }
    }

    @keyframes offlineSpin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}
