/* ============================================================
   UX IMPROVEMENTS - Rifas Upp
   Arquivo separado para facilitar rollback e manutenção.
   NÃO editar style.css para estas melhorias.
   ============================================================ */

/* -------------------------------------------------------
   1. TOAST NOTIFICATIONS (substitui alert() nativo)
------------------------------------------------------- */
#upp-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
    width: calc(100vw - 32px);
    pointer-events: none;
}

.upp-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.10);
    border: 1px solid rgba(255,255,255,0.6);
    color: #1a1a1a;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
    pointer-events: all;
    animation: toastIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    will-change: transform, opacity;
}

.upp-toast.hiding {
    animation: toastOut 0.22s ease-in forwards;
}

.upp-toast--icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.upp-toast--body {
    flex: 1;
}

.upp-toast--title {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.upp-toast--close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #999;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    align-self: flex-start;
    transition: color 0.15s;
}
.upp-toast--close:hover { color: #333; }

/* Variantes de tipo */
.upp-toast.success { border-left: 4px solid #22c55e; }
.upp-toast.success .upp-toast--title { color: #16a34a; }

.upp-toast.error { border-left: 4px solid #ef4444; }
.upp-toast.error .upp-toast--title { color: #dc2626; }

.upp-toast.warning { border-left: 4px solid #f59e0b; }
.upp-toast.warning .upp-toast--title { color: #d97706; }

.upp-toast.info { border-left: 4px solid #3b82f6; }
.upp-toast.info .upp-toast--title { color: #2563eb; }

@keyframes toastIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(110%); opacity: 0; }
}

/* -------------------------------------------------------
   2. AVATAR COM INICIAIS
------------------------------------------------------- */
.avatar-iniciais {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--incrivel-primaria, #323232);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    text-transform: uppercase;
    border: 2px solid rgba(255,255,255,0.25);
}

/* -------------------------------------------------------
   3. CHIPS DE NÚMEROS (meus números / confirmação)
------------------------------------------------------- */
.num-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--incrivel-primaria, #323232);
    color: #fff;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 8px;
    margin: 3px;
    min-width: 36px;
    letter-spacing: 0.03em;
}

.num-chip.paid {
    background: #16a34a;
    color: #fff;
}

.num-chip.pending {
    background: #d97706;
    color: #fff;
}

.num-chip.cancelled {
    background: #6b7280;
    color: #fff;
    text-decoration: line-through;
    opacity: 0.7;
}

/* -------------------------------------------------------
   4. HERO DE STATUS DO PEDIDO (view_order)
------------------------------------------------------- */
.order-hero {
    width: 100%;
    padding: 28px 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 0 0 20px 20px;
    margin-bottom: 16px;
}

.order-hero--icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 12px;
    border: 3px solid rgba(255,255,255,0.5);
}

.order-hero--title {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.2;
}

.order-hero--sub {
    font-size: 0.9rem;
    opacity: 0.88;
}

/* Variantes de status */
.order-hero.hero-pending {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}
.order-hero.hero-pending .order-hero--icon {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.order-hero.hero-approved {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
}
.order-hero.hero-approved .order-hero--icon {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.order-hero.hero-cancelled {
    background: linear-gradient(135deg, #6b7280 0%, #374151 100%);
    color: #fff;
}
.order-hero.hero-cancelled .order-hero--icon {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* -------------------------------------------------------
   5. PIX - QR CODE SEMPRE VISÍVEL
------------------------------------------------------- */
.pix-section {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
    overflow: hidden;
    margin-bottom: 12px;
}

.pix-section--header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
    font-size: 0.9rem;
    color: #374151;
}

.pix-section--body {
    padding: 16px;
}

.pix-copy-area {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 12px;
}

.pix-copy-area input {
    flex: 1;
    font-size: 0.78rem;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px 0 0 10px;
    background: #f9fafb;
    color: #374151;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pix-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--incrivel-primaria, #323232);
    color: #fff;
    border: none;
    border-radius: 0 10px 10px 0;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.pix-copy-btn:hover { opacity: 0.85; }
.pix-copy-btn.copied { background: #16a34a; }

.pix-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
}
.pix-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.83rem;
    color: #4b5563;
    padding: 4px 0;
    line-height: 1.45;
}
.pix-steps li .step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--incrivel-primaria, #323232);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pix-qr-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
}

.pix-qr-wrap img {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    border: 3px solid #e5e7eb;
    background: #fff;
}

/* Timer melhorado */
.pix-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #92400e;
}
.pix-timer .timer-count {
    font-size: 1.1rem;
    font-weight: 800;
    color: #d97706;
    min-width: 50px;
    text-align: center;
}
.pix-timer.urgent {
    background: #fef2f2;
    border-color: #fecaca;
    color: #7f1d1d;
}
.pix-timer.urgent .timer-count { color: #dc2626; }

/* Progress bar do timer */
.timer-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}
.timer-progress-bar {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #22c55e, #84cc16);
    transition: width 1s linear, background 1s ease;
}
.timer-progress-bar.urgent {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

/* -------------------------------------------------------
   6. CTAs POS-APROVAÇÃO
------------------------------------------------------- */
.order-next-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 0 8px;
}

.order-next-actions .btn-action-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: var(--incrivel-primaria, #323232);
    color: #fff;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: opacity 0.15s;
}
.order-next-actions .btn-action-primary:hover { opacity: 0.85; color: #fff; }

.order-next-actions .btn-action-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: transparent;
    color: var(--incrivel-primaria, #323232);
    border: 2px solid var(--incrivel-primaria, #323232);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.order-next-actions .btn-action-secondary:hover {
    background: var(--incrivel-primaria, #323232);
    color: #fff;
}

/* -------------------------------------------------------
   7. DETALHES DO PEDIDO - card limpo
------------------------------------------------------- */
.order-details-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
    overflow: hidden;
    margin-bottom: 12px;
}

.order-details-card--header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
    font-size: 0.9rem;
    color: #374151;
}

.order-details-card--body {
    padding: 0;
}

.order-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}
.order-detail-row:last-child { border-bottom: none; }

.order-detail-row .row-label {
    color: #6b7280;
    font-size: 0.8rem;
    min-width: 110px;
    flex-shrink: 0;
}

.order-detail-row .row-value {
    color: #111827;
    font-weight: 600;
    word-break: break-all;
}

.order-numbers-wrap {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* -------------------------------------------------------
   8. PROGRESS BAR DE VENDAS (página da campanha)
------------------------------------------------------- */
.campaign-progress-wrap {
    padding: 8px 0 4px;
}

.campaign-progress-bar-bg {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 4px;
}

.campaign-progress-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--incrivel-primaria, #323232), #555);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.campaign-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: shimmerProgress 2.5s infinite;
}

@keyframes shimmerProgress {
    0%   { left: -100%; }
    100% { left: 200%; }
}

.campaign-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #6b7280;
    font-weight: 500;
}

/* -------------------------------------------------------
   9. PRECO NO CARD DE CAMPANHA
------------------------------------------------------- */
.campaign-price-badge {
    display: inline-flex;
    align-items: center;
    background: var(--incrivel-primaria, #323232);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 4px;
    letter-spacing: 0.01em;
}

/* -------------------------------------------------------
   10. BOTOES DE COMPARTILHAMENTO SOCIAL
------------------------------------------------------- */
.share-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 8px 0;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.12s;
    border: none;
    cursor: pointer;
    color: #fff;
}
.share-btn:hover { opacity: 0.88; transform: translateY(-1px); color: #fff; }
.share-btn:active { transform: translateY(0); }

.share-btn.whatsapp { background: #25d366; }
.share-btn.facebook { background: #1877f2; }
.share-btn.telegram { background: #0088cc; }
.share-btn.copy-link { background: #6b7280; }

/* -------------------------------------------------------
   11. CONSISTENCIA - botao Sair (nao verde)
------------------------------------------------------- */
.btn-sair-menu {
    background: transparent !important;
    border: 2px solid rgba(255,255,255,0.35) !important;
    color: rgba(255,255,255,0.75) !important;
    border-radius: 8px !important;
    padding: 10px 16px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: background 0.15s, color 0.15s !important;
}
.btn-sair-menu:hover {
    background: rgba(255,255,255,0.12) !important;
    color: #fff !important;
}

/* -------------------------------------------------------
   12. LOGIN MODAL - consistencia de cor
------------------------------------------------------- */
#loginModal .btn-wide-in,
#cadastroModal .btn-wide-in {
    background: var(--incrivel-primaria, #323232) !important;
    color: #fff !important;
    border-color: var(--incrivel-primaria, #323232) !important;
}
#loginModal .btn-wide-in:hover,
#cadastroModal .btn-wide-in:hover {
    opacity: 0.85;
}

/* -------------------------------------------------------
   13. LOADING OVERLAY - texto contextual
------------------------------------------------------- */
.loadingpage-text {
    margin-top: 14px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    opacity: 0.9;
    letter-spacing: 0.02em;
}

/* -------------------------------------------------------
   14. VALIDACAO INLINE (cadastro)
------------------------------------------------------- */
.field-error {
    font-size: 0.78rem;
    color: #dc2626;
    margin-top: 4px;
    padding-left: 2px;
    display: none;
}
.field-error.visible { display: block; }

.form-control.is-invalid-upp {
    border-color: #dc2626 !important;
    background-image: none !important;
}
.form-control.is-valid-upp {
    border-color: #22c55e !important;
    background-image: none !important;
}

/* -------------------------------------------------------
   15. CELEBRACAO POS-APROVACAO (confetti container)
------------------------------------------------------- */
#confetti-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9998;
}

/* -------------------------------------------------------
   16. ANIMACAO DO HERO APROVADO
------------------------------------------------------- */
@keyframes checkPop {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1);   opacity: 1; }
}
.order-hero.hero-approved .order-hero--icon {
    animation: checkPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

/* -------------------------------------------------------
   17. MEUS NUMEROS - estado de carregamento
------------------------------------------------------- */
.my-numbers-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
    gap: 12px;
    font-size: 0.9rem;
}

.my-numbers-loading .spinner-border {
    width: 2rem;
    height: 2rem;
    color: var(--incrivel-primaria, #323232);
}

/* -------------------------------------------------------
   18. MAIORES COMPRADORES (ranking redesign)
------------------------------------------------------- */
.section-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e9ecef;
    margin-bottom: 16px;
    overflow: hidden;
}

.section-card--header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    font-size: 0.97rem;
    color: #1a1a1a;
}

.section-card--header i {
    font-size: 1.1rem;
    color: var(--incrivel-primaria, #323232);
}

.ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ranking-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
}

.ranking-list li:last-child {
    border-bottom: none;
}

.ranking-pos {
    font-size: 1.1rem;
    font-weight: 700;
    color: #555;
    min-width: 28px;
    text-align: center;
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: #1a1a1a;
}

.ranking-tickets {
    font-size: 0.78rem;
    color: #888;
}

/* -------------------------------------------------------
   19. PRÊMIOS DO SORTEIO
------------------------------------------------------- */
.prizes-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.prizes-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.9rem;
}

.prizes-list li:last-child {
    border-bottom: none;
}

.prize-pos {
    font-size: 1.1rem;
    min-width: 28px;
    text-align: center;
}

.prize-label {
    color: #888;
    white-space: nowrap;
    font-size: 0.85rem;
}

.prize-name {
    font-weight: 600;
    color: #1a1a1a;
    flex: 1;
}

/* -------------------------------------------------------
   20. RESPONSIVIDADE GERAL
------------------------------------------------------- */
@media (max-width: 480px) {
    #upp-toast-container {
        top: 8px;
        right: 8px;
        max-width: calc(100vw - 16px);
        width: calc(100vw - 16px);
    }
    .order-hero--title { font-size: 1.15rem; }
    .pix-qr-wrap img { width: 150px; height: 150px; }
}
