:root {
    --primary: #ff7f50;
    --primary-light: #ff9f60;
    --text: #333;
    --text-light: #6c757d;
    --bg: #f8f9fa;
    --card-bg: #fff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 0.75rem;
    --transition: all 0.3s ease;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Novas cores para notificações */
    --notification-unread: #fff9f9;
    --notification-read: #f8f9fa;
    --notification-badge: #ff4444;
    --notification-success: #28a745;
}

/* === ESTRUTURA BASE DO MODAL === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 1050;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.modal-overlay.active {
    display: block;
    opacity: 1;
}

.modal-sacola {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    z-index: 1051;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-sacola.active {
    right: 0;
}

.modal-sacola>div {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
}

/* === HEADER === */
.custom-modal-header {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    padding: 1.25rem 1.5rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.btn-close-white {
    background: transparent;
    border: none;
    color: #fff !important;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.9;
    transition: var(--transition);
}

.btn-close-white:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* === BODY E SCROLL === */
.modal-body {
    padding: 1.25rem 1.5rem;
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg);
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 3px;
}

/* === NOTIFICAÇÕES - ESTILO PREMIUM === */
#notifications-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    gap: 1rem;
    transition: var(--transition);
    border-left: 4px solid var(--primary);
    position: relative;
    /* REMOVIDO: overflow: hidden que podia causar problemas */
}

/* ✅ CORREÇÃO: Removido o ::before que bloqueava cliques */
/* .notification-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
  opacity: 0;
  transition: var(--transition);
} */

.notification-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255, 159, 96, 0.03) 100%);
}

/* ✅ CORREÇÃO: Removido hover do pseudo-elemento */
/* .notification-item:hover::before {
  opacity: 1;
} */

.notification-item.nao-lida {
    border-left-color: var(--notification-badge);
    background: var(--notification-unread);
    box-shadow: 0 2px 15px rgba(255, 68, 68, 0.1);
}

.notification-item.lida {
    border-left-color: #28a745;
    background: var(--notification-read);
    opacity: 0.9;
}

/* Imagem da Notificação */
.notification-image {
    width: 60px;
    height: 60px;
    min-width: 60px;
    flex-shrink: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid #f0f0f0;
    transition: var(--transition);
}

.notification-item:hover .notification-image {
    border-color: var(--primary-light);
    transform: scale(1.05);
}

.notification-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Informações da Notificação */
.notification-info {
    flex: 1;
    min-width: 0;
    position: relative;
    /* ✅ Garante que os botões fiquem clicáveis */
    z-index: 1;
    /* ✅ Fica acima de qualquer overlay */
}

.notification-info h6 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.notification-pedido {
    color: var(--primary);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.notification-status {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(255, 127, 80, 0.3);
}

.notification-item.nao-lida .notification-status {
    background: linear-gradient(135deg, #ff6b6b, var(--notification-badge));
}

.notification-mensagem {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
    font-weight: 500;
}

/* Ações e Data */
.notification-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: relative;
    /* ✅ Garante que fique clicável */
    z-index: 2;
    /* ✅ Fica acima de tudo */
}

.notification-data {
    color: var(--text-light);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

/* Botões de Ação */
.btn-marcar-lida {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(255, 127, 80, 0.3);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    position: relative;
    /* ✅ Importante para cliques */
    z-index: 3;
    /* ✅ Fica no topo da hierarquia */
}

.btn-marcar-lida:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 127, 80, 0.4);
    background: linear-gradient(135deg, var(--primary), #ff6b3b);
}

.notification-lida-indicator {
    color: var(--notification-success);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    position: relative;
    /* ✅ Para garantir cliques */
    z-index: 2;
}

/* Indicador de Não Lida */
.notification-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--notification-badge);
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(255, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
    }
}

/* === BADGE DE CONTADOR === */
.notifications-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--notification-badge);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border: 2px solid var(--card-bg);
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
    animation: bounce 0.5s ease;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-3px);
    }

    60% {
        transform: translateY(-2px);
    }
}

/* === BOTÃO MARCAR TODAS === */
.btn-marcar-todas-lidas {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
}

.btn-marcar-todas-lidas:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 127, 80, 0.3);
}

/* === ESTADO VAZIO === */
#notifications-vazio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
}

#notifications-vazio i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--primary-light);
    opacity: 0.6;
}

#notifications-vazio p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    margin: 0;
}

/* === PAGINAÇÃO E LOADING === */
.notifications-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-light);
    gap: 0.75rem;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.notifications-load-more {
    display: flex;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.btn-carregar-mais {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
}

.btn-carregar-mais:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 127, 80, 0.3);
}

.btn-carregar-mais:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === ANIMAÇÕES === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.modal-overlay.active {
    animation: fadeIn 0.3s ease-out;
}

.modal-sacola.active {
    animation: slideIn 0.4s ease-out;
}

/* === RESPONSIVO - MOBILE === */
@media (max-width: 480px) {
    .modal-sacola {
        max-width: 100%;
        border-radius: 0;
    }

    .custom-modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .notification-item {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .notification-image {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }

    .notification-info h6 {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.375rem;
    }

    .notification-mensagem {
        font-size: 0.85rem;
        margin-bottom: 0.625rem;
    }

    .notification-actions {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .notification-data {
        font-size: 0.75rem;
        flex: 1;
    }

    /* Botões mobile otimizados */
    .btn-marcar-lida {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
        margin-left: auto;
    }

    .btn-marcar-lida span {
        display: none;
    }

    .btn-marcar-lida:not(.mobile) {
        display: none;
    }

    .btn-marcar-lida.mobile {
        display: flex;
        padding: 0.45rem;
        border-radius: 50%;
        width: 34px;
        height: 34px;
        justify-content: center;
    }

    .notification-lida-indicator {
        font-size: 0.7rem;
        margin-left: auto;
    }

    .notification-lida-indicator .desktop-text {
        display: none;
    }

    /* Paginação mobile */
    .notifications-load-more {
        padding: 1.25rem 0.75rem;
    }

    .btn-carregar-mais {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }

    /* Estado vazio mobile */
    #notifications-vazio i {
        font-size: 3rem;
    }

    #notifications-vazio p {
        font-size: 1rem;
    }
}

/* === DESKTOP OPTIMIZATIONS === */
@media (min-width: 481px) {
    .btn-marcar-lida.mobile {
        display: none;
    }

    .notification-lida-indicator .desktop-text {
        display: inline;
    }
}