/*
 * MegaDoor Cart CSS — Sistema de Carrinho de Reservas
 * Arquivo dedicado: assets/css/cart.css
 * Carregado exclusivamente na página portfolio.html
 */

/* ── Keyframes ─────────────────────────────────────────────────────────── */
@keyframes mdCartPulse {
    0%   { box-shadow: 0 6px 20px rgba(255,230,0,.45), 0 0 0 0 rgba(255,230,0,.6); }
    70%  { box-shadow: 0 6px 20px rgba(255,230,0,.45), 0 0 0 18px rgba(255,230,0,0); }
    100% { box-shadow: 0 6px 20px rgba(255,230,0,.45), 0 0 0 0 rgba(255,230,0,0); }
}
@keyframes mdCartBounce {
    0%,100% { transform: scale(1); }
    30%     { transform: scale(1.25) translateY(-4px); }
    60%     { transform: scale(0.9) translateY(2px); }
    80%     { transform: scale(1.1) translateY(-2px); }
}
@keyframes mdBadgePop {
    0%   { transform: scale(0.2); }
    70%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}
@keyframes mdToastIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes mdToastOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}
@keyframes mdItemIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   BOTÃO FLUTUANTE DO CARRINHO
   Posição: canto inferior direito, acima do WhatsApp
═══════════════════════════════════════════════════════ */
#cart-float-btn {
    position: fixed;
    right: 22px;
    bottom: 92px;
    left: auto;
    top: auto;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #ffe600;
    background: linear-gradient(145deg, #ffe600, #f0d000);
    border: 3px solid rgba(255,255,255,0.9);
    cursor: pointer;
    display: none; /* JS mostra com display:flex */
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(255,230,0,0.45), 0 2px 8px rgba(0,0,0,0.18);
    z-index: 9800;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1),
                box-shadow 0.25s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
#cart-float-btn:hover {
    transform: scale(1.12) translateY(-3px);
    box-shadow: 0 10px 30px rgba(255,230,0,0.55), 0 4px 12px rgba(0,0,0,0.2);
}
#cart-float-btn:active {
    transform: scale(0.94);
}
#cart-float-btn.cart-anim {
    animation: mdCartBounce 0.55s ease forwards,
               mdCartPulse  0.9s ease forwards;
}
#cart-float-btn svg {
    width: 26px;
    height: 26px;
    fill: #1a2a4a;
    display: block;
    pointer-events: none;
}

/* Badge de quantidade */
#cart-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    background: #1a2a4a;
    color: #ffe600;
    font-size: 0.63rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2.5px solid #fff;
    line-height: 1;
    pointer-events: none;
    font-family: inherit;
    letter-spacing: -0.3px;
    z-index: 1;
}
#cart-badge.badge-pop {
    animation: mdBadgePop 0.38s cubic-bezier(0.34,1.56,0.64,1);
}

/* ═══════════════════════════════════════════════════════
   OVERLAY (fundo escurecido ao abrir o drawer)
═══════════════════════════════════════════════════════ */
#cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 16, 38, 0.62);
    z-index: 9900;
    display: none;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
#cart-overlay.open {
    display: block;
}

/* ═══════════════════════════════════════════════════════
   DRAWER LATERAL (painel do carrinho)
═══════════════════════════════════════════════════════ */
#cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 400px;
    max-width: 94vw;
    height: 100%;
    background: #ffffff;
    z-index: 9950;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 60px rgba(0,0,0,0.2), -2px 0 14px rgba(0,0,0,0.08);
    border-radius: 20px 0 0 20px;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
#cart-drawer.open {
    transform: translateX(0);
}

/* Header do drawer */
#cart-drawer .cart-drawer-header {
    background: linear-gradient(135deg, #1a2a4a 0%, #0d1e38 100%);
    color: #fff;
    padding: 1.3rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}
#cart-drawer .cart-drawer-header::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -15px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,230,0,0.1);
    pointer-events: none;
}
#cart-drawer .cart-drawer-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    letter-spacing: 0.02em;
    position: relative;
}
#cart-drawer .cart-drawer-header h3 svg {
    fill: #ffe600;
    flex-shrink: 0;
}

/* Botão fechar */
#cart-close-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, transform 0.25s;
    flex-shrink: 0;
    line-height: 1;
}
#cart-close-btn:hover {
    background: rgba(255,255,255,0.24);
    transform: rotate(90deg);
}

/* Corpo do drawer */
#cart-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.3rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.12) transparent;
}
#cart-items-list::-webkit-scrollbar { width: 4px; }
#cart-items-list::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 4px;
}

/* Mensagem vazio */
.cart-empty-msg {
    text-align: center;
    padding: 2.5rem 1rem;
    font-size: 0.9rem;
    line-height: 1.8;
    color: #94a3b8;
}
.cart-empty-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.35;
}

/* Item individual no carrinho */
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    background: #f7f9ff;
    border: 1px solid rgba(26,42,74,0.08);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: box-shadow 0.18s, border-color 0.18s;
    animation: mdItemIn 0.25s ease;
}
.cart-item:hover {
    box-shadow: 0 3px 14px rgba(26,42,74,0.1);
    border-color: rgba(26,42,74,0.16);
}
.cart-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffe600, #f0d000);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 800;
    color: #1a2a4a;
    letter-spacing: -0.5px;
    font-family: inherit;
}
.cart-item-label {
    font-size: 0.9rem;
    color: #1a2a4a;
    font-weight: 600;
    flex: 1;
    line-height: 1.3;
}
.cart-item-remove {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
    transition: all 0.18s;
    flex-shrink: 0;
    font-family: inherit;
    font-weight: 500;
    -webkit-appearance: none;
    appearance: none;
}
.cart-item-remove:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
}

/* Footer do drawer */
#cart-drawer .cart-drawer-footer {
    padding: 1rem 1.3rem 1.4rem;
    border-top: 1px solid rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex-shrink: 0;
    background: #f8faff;
}
.cart-footer-info {
    font-size: 0.76rem;
    color: #94a3b8;
    text-align: center;
    font-weight: 500;
    margin: 0;
    padding-bottom: 2px;
}

/* Botão Limpar Carrinho */
#cart-clear-btn {
    background: transparent;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 0.58rem 1rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: #94a3b8;
    width: 100%;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    -webkit-appearance: none;
    appearance: none;
}
#cart-clear-btn:hover {
    border-color: #ef4444;
    color: #dc2626;
    background: #fee2e2;
}

/* Botão Solicitar Reserva via WhatsApp */
#cart-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: linear-gradient(135deg, #25d366 0%, #1db954 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.82rem 1.2rem;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    width: 100%;
    transition: all 0.22s;
    font-family: inherit;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 18px rgba(37,211,102,0.3);
    -webkit-appearance: none;
    appearance: none;
}
#cart-whatsapp-btn:hover {
    background: linear-gradient(135deg, #1db954 0%, #158a3e 100%);
    transform: translateY(-2px);
    box-shadow: 0 7px 24px rgba(37,211,102,0.42);
}
#cart-whatsapp-btn:active {
    transform: translateY(0) scale(0.97);
}
#cart-whatsapp-btn svg {
    fill: currentColor;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* ═══════════════════════════════════════════════════════
   TOAST (notificação ao adicionar)
   Posição: canto inferior direito
═══════════════════════════════════════════════════════ */
#cart-toast {
    position: fixed;
    bottom: 28px;
    right: 24px;
    left: auto;
    top: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    background: #1a2a4a;
    color: #fff;
    padding: 0.72rem 1.2rem 0.72rem 0.9rem;
    border-radius: 14px;
    font-size: 0.83rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 6px 26px rgba(0,0,0,0.22);
    max-width: 300px;
    border-left: 3px solid #ffe600;
    font-family: inherit;
    transform: translateX(120%);
    transition: none;
}
#cart-toast.show {
    opacity: 1;
    animation: mdToastIn 0.38s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
#cart-toast.hide {
    animation: mdToastOut 0.3s ease forwards;
}
#cart-toast.cart-toast-warn {
    border-left-color: #f59e0b;
}
.cart-toast-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffe600;
    color: #1a2a4a;
    font-size: 0.65rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cart-toast-warn .cart-toast-dot {
    background: #f59e0b;
}
.cart-toast-text {
    flex: 1;
}

/* ═══════════════════════════════════════════════════════
   BOTÕES DOS CARDS DE PLACAS
═══════════════════════════════════════════════════════ */
.cart-btns-wrap {
    margin-top: 14px;
}

/* Botão único — "Adicionar ao Carrinho" */
button.btn-cart-single {
    width: 100%;
    background: #ffe600;
    background: linear-gradient(135deg, #ffe600 0%, #f0d000 100%);
    color: #1a2a4a;
    border: none;
    border-radius: 10px;
    padding: 0.66rem 1rem;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
                box-shadow 0.22s ease;
    box-shadow: 0 4px 14px rgba(255,230,0,0.3);
    font-family: inherit;
    letter-spacing: 0.01em;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
}
button.btn-cart-single:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255,230,0,0.48);
}
button.btn-cart-single:active {
    transform: translateY(0) scale(0.96);
}

/* Linha de botões individuais lado a lado */
.cart-btns-individual {
    display: flex;
    gap: 6px;
    margin-bottom: 7px;
}

/* Botões individuais — "Adicionar 006", "Adicionar 007"… */
button.btn-cart-ind {
    flex: 1;
    background: transparent;
    color: #1a2a4a;
    border: 2px solid rgba(26,42,74,0.25);
    border-radius: 8px;
    padding: 0.5rem 0.35rem;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
    letter-spacing: 0.01em;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
}
button.btn-cart-ind:hover {
    background: #1a2a4a;
    color: #fff;
    border-color: #1a2a4a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,42,74,0.24);
}
button.btn-cart-ind:active {
    transform: scale(0.95);
}

/* Botão combo — linha inteira amarela */
button.btn-cart-combo {
    width: 100%;
    background: #ffe600;
    background: linear-gradient(135deg, #ffe600 0%, #f0d000 100%);
    color: #1a2a4a;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
    display: block;
    text-align: center;
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
                box-shadow 0.22s;
    box-shadow: 0 4px 14px rgba(255,230,0,0.3);
    font-family: inherit;
    letter-spacing: 0.01em;
    -webkit-appearance: none;
    appearance: none;
}
button.btn-cart-combo:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255,230,0,0.48);
}
button.btn-cart-combo:active {
    transform: scale(0.96);
}

/* Botão combo triplo — azul com borda amarela */
button.btn-cart-triplo {
    width: 100%;
    background: linear-gradient(135deg, #1a2a4a 0%, #0d1e38 100%);
    color: #ffe600;
    border: 2px solid #ffe600;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
    display: block;
    text-align: center;
    transition: all 0.22s;
    font-family: inherit;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(26,42,74,0.2);
    -webkit-appearance: none;
    appearance: none;
}
button.btn-cart-triplo:hover {
    background: #ffe600;
    color: #1a2a4a;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255,230,0,0.42);
}
button.btn-cart-triplo:active {
    transform: scale(0.96);
}

/* Estado: já no carrinho — botão desabilitado */
button.btn-cart-in-cart {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
    transform: none;
}

/* Para 3 códigos: botões mais compactos */
.cart-btns-triple button.btn-cart-ind {
    font-size: 0.68rem;
    padding: 0.43rem 0.2rem;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVO MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    #cart-drawer {
        width: 100%;
        max-width: 100vw;
        border-radius: 0;
    }
    #cart-drawer .cart-drawer-header {
        border-radius: 0;
    }
    #cart-drawer .cart-drawer-footer {
        border-radius: 0;
    }
    #cart-float-btn {
        right: 14px;
        bottom: 80px;
        width: 52px;
        height: 52px;
    }
    #cart-float-btn svg {
        width: 22px;
        height: 22px;
    }
    #cart-toast {
        right: 12px;
        bottom: 18px;
        max-width: calc(100vw - 28px);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE BUG FIX — Cards de Placas invisíveis no mobile
   Causa: IntersectionObserver não dispara no Safari/iOS quando
          html { overflow-x: hidden } cria novo scroll container.
   Solução: forçar visibilidade dos elementos via CSS no mobile,
            ignorando o estado da animação reveal.
   Escopo: somente portfolio.html (este arquivo só é carregado lá)
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Força a seção container dos cards sempre visível */
    .portfolio-grid-section {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important;
    }

    /* Força o grid de cards sempre visível */
    .portfolio-public-grid {
        display: grid !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    /* Garante que cada card de placa é visível */
    .portfolio-public-grid .placa-card {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    /* Garante que seção de bi-semanas também está visível (por precaução) */
    .bi-semana-section.reveal {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
}
