/* Indicador de carregamento e modal custom — compartilhado entre público e admin. */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid #dddddd;
    border-top-color: #007f00;
    animation: ui-spin 0.7s linear infinite;
}

@keyframes ui-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal custom (conteúdo rico, ex.: detalhes do resgate) */
.ui-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.ui-modal {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.ui-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eeeeee;
}

.ui-modal-header h2 {
    margin: 0;
    font-size: 16px;
}

.ui-modal-close {
    background: #f6f8f5;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #666666;
}

.ui-modal-body {
    padding: 20px;
}

/* ==========================================================================
   PWA Install Banner & Custom Prompts
   ========================================================================== */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    width: calc(100% - 32px);
    max-width: 480px;
    background: #ffffff;
    border: 1px solid rgba(0, 127, 0, 0.2);
    border-radius: 16px;
    box-shadow: 0 16px 36px -4px rgba(0, 30, 10, 0.18), 0 6px 16px -2px rgba(0, 0, 0, 0.08);
    z-index: 100000;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    opacity: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Plus Jakarta Sans', 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
    box-sizing: border-box;
}

.pwa-install-banner.pwa-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

[data-theme="dark"] .pwa-install-banner {
    background: #0d281c;
    border-color: #1b4d36;
    color: #f8fafc;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.5);
}

.pwa-install-content {
    padding: 16px 18px;
}

.pwa-install-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-install-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 127, 0, 0.2);
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: inherit;
}

.pwa-install-text span {
    display: block;
    font-size: 12.5px;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.35;
}

[data-theme="dark"] .pwa-install-text span {
    color: #94a3b8;
}

.pwa-install-close {
    background: transparent;
    border: none;
    font-size: 22px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
    transition: color 0.15s;
}

.pwa-install-close:hover {
    color: #1e293b;
}

[data-theme="dark"] .pwa-install-close:hover {
    color: #f8fafc;
}

.pwa-install-instructions {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
}

[data-theme="dark"] .pwa-install-instructions {
    background: #051c12;
    color: #e2e8f0;
}

.pwa-step {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.pwa-step:last-child {
    margin-bottom: 0;
}

.pwa-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #007f00;
    color: #ffffff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.pwa-icon-share, .pwa-icon-add {
    vertical-align: -2px;
    stroke: #007f00;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.pwa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.pwa-btn-secondary {
    background: transparent;
    color: #64748b;
}

.pwa-btn-secondary:hover {
    background: #f1f5f9;
    color: #1e293b;
}

[data-theme="dark"] .pwa-btn-secondary {
    color: #94a3b8;
}

[data-theme="dark"] .pwa-btn-secondary:hover {
    background: #0d281c;
    color: #f8fafc;
}

.pwa-btn-primary {
    background: #007f00;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 127, 0, 0.35);
}

.pwa-btn-primary:hover {
    background: #006e00;
}

/* Botão permanente na Sidebar / Header */
.pwa-install-trigger {
    display: none;
}

@media (max-width: 540px) {
    .pwa-install-banner {
        bottom: 12px;
        width: calc(100% - 20px);
    }
}

@media print {
    .print-only {
        display: block !important;
    }
    .no-print,
    .ui-modal-close,
    .spark-order-modal-actions {
        display: none !important;
    }
    body.modal-open > *:not(.ui-modal-overlay),
    body.printing-modal > *:not(.ui-modal-overlay),
    body:has(.ui-modal-overlay) > *:not(.ui-modal-overlay) {
        display: none !important;
    }
    .ui-modal-overlay {
        position: static !important;
        inset: auto !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }
    .ui-modal {
        position: static !important;
        max-width: 100% !important;
        max-height: none !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .ui-modal-header {
        display: none !important;
    }
    .ui-modal-body {
        padding: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

