/* --- CART & STATUS STYLES --- */
.floating-cart-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(244, 123, 32, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s;
}

.floating-cart-btn:active {
    transform: scale(0.9);
}

.floating-cart-btn .count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.pwa-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.pwa-modal.show {
    display: flex;
    opacity: 1;
}

/* Modal Content - Mobile First (Bottom Sheet) */
.pwa-modal-content {
    background: #fff;
    width: 100%;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    /* Top rounded only */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);

    /* Animation for sliding up */
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    position: absolute;
    bottom: 0;
    left: 0;
}

.pwa-modal.show .pwa-modal-content {
    transform: translateY(0);
}

.pwa-modal-content.centered {
    text-align: center;
    padding: 30px;
}

/* Desktop / Tablet Overrides */
@media (min-width: 768px) {
    .pwa-modal {
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .pwa-modal-content {
        width: 100%;
        max-width: 480px;
        position: relative;
        bottom: auto;
        left: auto;
        border-radius: 24px;
        /* Full rounded */
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);

        /* Change animation to scale/fade for desktop */
        transform: scale(0.95);
        opacity: 0;
        transition: all 0.2s ease-out;
    }

    .pwa-modal.show .pwa-modal-content {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.cart-item-info strong {
    display: block;
    color: var(--text-main);
}

.cart-item-info small {
    color: var(--text-muted);
}

.cart-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: var(--primary);
    font-weight: bold;
    cursor: pointer;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px;
    width: 100%;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.secondary-btn {
    background: #f1f5f9;
    color: var(--text-main);
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

#qrcodeDisplay {
    margin: 20px auto;
    padding: 10px;
    background: #fff;
    display: inline-block;
}

#qrcodeDisplay img {
    display: block;
    margin: 0 auto;
}

/* Status Overlay */
.status-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.status-header {
    background: var(--primary);
    padding: 30px 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-header h2 {
    font-size: 1.8rem;
}

.status-body {
    padding: 20px;
    flex: 1;
}

.status-summary .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.status-summary .row.total {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
}

.status-actions {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.status-label {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #64748b;
    margin-left: 8px;
}

.status-label.Pendente {
    background: #fef3c7;
    color: #d97706;
}

.status-label.Pronto {
    background: #dcfce7;
    color: #16a34a;
}

/* The round add button (shared class name for reuse) */
.add-btn-round {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: var(--primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Position can be overridden by context, but defaults to nice float */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.add-btn-round:active {
    transform: scale(0.9);
    background: var(--primary);
    color: #fff;
}

/* Card Quantity Control (Replaces Add Button) */
.card-qty-control {
    background: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 5px;
    box-shadow: 0 4px 10px rgba(244, 123, 32, 0.3);
    animation: fadeIn 0.2s ease;
    z-index: 5;
}

/* Ensure controls overlay correctly in common card contexts */
.card-action-area .card-qty-control,
.destaque-card .card-qty-control {
    /* Usually they are absolute in the card context */
    /* We leave positioning to the parent container */
}


.card-qty-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.card-qty-btn:active {
    background: rgba(255, 255, 255, 0.4);
}

.card-qty-value {
    color: #fff;
    font-weight: 700;
    margin: 0 10px;
    font-size: 0.95rem;
    min-width: 15px;
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.order-section {
    background: #fff;
    margin-bottom: 10px;
}

.section-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.section-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-content {
    padding: 0;
}

.section-footer {
    padding: 15px;
    background: #fff;
}

.empty-state-small {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

.status-badge-small {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 4px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: var(--text-muted);
}

.summary-row.total {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    margin-top: 10px;
}