/**
 * Estilos do Carrinho de Compras
 * Sistema de Cardápio Online Padaria
 */

/* Container principal do carrinho */
.cart-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.cart-header {
    text-align: center;
    margin-bottom: 2rem;
}

.cart-title {
    color: #8B4513;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.cart-subtitle {
    color: #666;
    font-size: 1rem;
}

/* Estados do carrinho */
.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.cart-empty-icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.cart-empty-message {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.cart-loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Lista de itens do carrinho */
.cart-items {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
}



.cart-item {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    align-items: start;
    padding: 1.5rem;
    border-bottom: 1px solid #ddd;
    gap: 1.5rem;
    transition: background-color 0.2s ease;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item:hover {
    background-color: #f8f9fa;
}

/* Imagem do produto */
.cart-item-image {
    width: 120px;
    height: 120px;
    border-radius: 0.5rem;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

/* Detalhes do produto */
.cart-item-details {
    min-width: 0;
}

.cart-item-name {
    font-size: 1.125rem;
    font-weight: 400;
    color: #0066c0;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    cursor: pointer;
}

.cart-item-name:hover {
    color: #c7511f;
    text-decoration: underline;
}

.cart-item-meta {
    margin-bottom: 1rem;
}

.cart-item-unit-price {
    font-size: 0.875rem;
    color: #565959;
}

/* Ações do item */
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f2f2;
}

.cart-action-link {
    background: none;
    border: none;
    color: #0066c0;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    padding: 0.25rem 0;
}

.cart-action-link:hover {
    color: #c7511f;
    text-decoration: underline;
}

.quantity-btn {
    background: #e7e9ec;
    border: none;
    width: 29px;
    height: 29px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: normal;
    color: #0f1111;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: #d5d9d9;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f7f8f8;
}

.quantity-input {
    border: none;
    width: 40px;
    height: 29px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: normal;
    background: white;
    color: #0f1111;
}

.quantity-input:focus {
    outline: 2px solid #e77600;
    outline-offset: -2px;
}

/* Coluna de preço */
.cart-item-price-column {
    text-align: right;
    justify-self: end;
}

.cart-item-total {
    font-size: 1.125rem;
    font-weight: 700;
    color: #b12704;
    min-width: 80px;
}

.cart-item-remove:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* Resumo do carrinho */
.cart-summary {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.cart-summary-content {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.cart-summary-header {
    text-align: right;
}

.cart-summary-title {
    font-size: 1.125rem;
    font-weight: 400;
    color: #0f1111;
    margin: 0;
    line-height: 1.4;
}

.cart-total-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #b12704;
}

/* Ações do carrinho */
.cart-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.cart-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
    height: 48px;
    flex-shrink: 0;
}

.cart-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-clear {
    background: #6c757d;
    color: white;
}

.btn-clear:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-checkout {
    background: #28a745;
    color: white;
}

.btn-checkout:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.btn-continue {
    background: #8B4513;
    color: white;
}

.btn-continue:hover:not(:disabled) {
    background: #6B3410;
    transform: translateY(-1px);
}

/* Animações */
.cart-item-enter {
    animation: slideInUp 0.3s ease;
}

.cart-item-exit {
    animation: slideOutDown 0.3s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Loading states */
.cart-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.quantity-loading {
    position: relative;
}

.quantity-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #ddd;
    border-top-color: #8B4513;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsividade Completa */
@media (max-width: 360px) {
    .cart-container {
        padding: 0.5rem 0.25rem;
    }
    
    .cart-title {
        font-size: 1.25rem;
    }
    
    .cart-subtitle {
        font-size: 0.875rem;
    }
    
    .cart-item {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.75rem;
        padding: 0.75rem;
        align-items: start;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
        grid-row: 1 / 3;
        grid-column: 1;
    }
    
    .cart-item-details {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }
    
    .cart-item-name {
        font-size: 0.9rem;
        line-height: 1.3;
        margin-bottom: 0.25rem;
    }
    
    .cart-item-unit-price {
        font-size: 0.75rem;
    }
    
    .cart-item-actions {
        grid-column: 1 / 3;
        grid-row: 3;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .quantity-selector {
        transform: scale(0.85);
        order: 1;
    }
    
    .cart-item-price-column {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
        justify-self: start;
        margin-top: 0.25rem;
    }
    
    .cart-item-total {
        font-size: 1rem;
        font-weight: 600;
    }
    
    .cart-action-link {
        font-size: 0.75rem;
        order: 2;
    }
    
    .cart-summary {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .cart-summary-content {
        padding: 1rem;
    }
    
    .cart-summary-title {
        font-size: 1rem;
    }
    
    .cart-total-price {
        font-size: 1.125rem;
    }
    
    .cart-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .cart-action-btn {
        width: 100%;
        min-width: auto;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

@media (min-width: 361px) and (max-width: 480px) {
    .cart-container {
        padding: 0.5rem;
    }
    
    .cart-title {
        font-size: 1.5rem;
    }
    
    .cart-item {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto;
        gap: 1rem;
        padding: 0.75rem;
    }
    
    .cart-item-image {
        width: 80px;
        height: 80px;
        grid-row: 1 / 3;
        grid-column: 1;
    }
    
    .cart-item-details {
        grid-column: 2;
        grid-row: 1;
    }
    
    .cart-item-actions {
        grid-column: 2;
        grid-row: 2;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .cart-item-price-column {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
        justify-self: end;
        align-self: end;
    }
    
    .cart-summary {
        padding: 1rem;
    }
    
    .quantity-selector {
        transform: scale(0.9);
    }
    
    .cart-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cart-action-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    .cart-container {
        padding: 1rem 0.75rem;
    }
    
    .cart-item {
        grid-template-columns: 100px 1fr auto;
        gap: 1rem;
        padding: 1rem;
        align-items: center;
    }
    
    .cart-item-image {
        width: 100px;
        height: 100px;
    }
    
    .cart-item-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .cart-summary {
        padding: 1.5rem;
    }
    
    .cart-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
        align-items: center;
    }
    
    .cart-action-btn {
        flex: 1;
        min-width: 140px;
        height: 48px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .cart-container {
        padding: 1.5rem 1rem;
    }
    
    .cart-item {
        grid-template-columns: 120px 1fr auto;
        gap: 1.5rem;
        padding: 1.25rem;
    }
    
    .cart-item-image {
        width: 120px;
        height: 120px;
    }
    
    .cart-actions {
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
    }
    
    .cart-action-btn {
        min-width: 160px;
    }
}

@media (min-width: 1024px) {
    .cart-container {
        padding: 2rem 1rem;
    }
    
    .cart-actions {
        flex-direction: row;
        justify-content: center;
        gap: 1.5rem;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .cart-container {
        padding: 0.5rem;
    }
    
    .cart-header {
        margin-bottom: 1rem;
    }
    
    .cart-title {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    
    .cart-subtitle {
        font-size: 0.875rem;
    }
    
    .cart-item {
        padding: 0.75rem;
        gap: 1rem;
    }
    
    .cart-item-image {
        width: 80px;
        height: 80px;
    }
    
    .cart-summary {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .cart-actions {
        flex-direction: row;
        gap: 0.75rem;
    }
    
    .cart-action-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .cart-item:hover {
        background-color: transparent;
    }
    
    .cart-item:active {
        background-color: #f8f9fa;
    }
    
    .quantity-btn:hover {
        background: #e7e9ec;
    }
    
    .quantity-btn:active {
        background: #d5d9d9;
        transform: scale(0.95);
    }
    
    .cart-action-btn:hover {
        transform: none;
    }
    
    .cart-action-btn:active {
        transform: scale(0.98);
    }
    
    .cart-action-link:hover {
        text-decoration: none;
    }
    
    .cart-action-link:active {
        color: #c7511f;
        text-decoration: underline;
    }
    
    /* Increase touch targets */
    .quantity-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .cart-action-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.5rem 0;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .cart-item {
        border: 2px solid #000;
    }
    
    .quantity-selector {
        border: 2px solid #000;
    }
    
    .cart-action-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .cart-item-enter,
    .cart-item-exit,
    .cart-updated {
        animation: none;
    }
    
    .cart-action-btn:hover,
    .cart-action-btn:active {
        transform: none;
    }
    
    .quantity-loading::after {
        animation: none;
    }
}

/* Estados especiais */
.cart-item.removing {
    animation: slideOutDown 0.3s ease forwards;
}

.cart-updated {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Acessibilidade */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states para acessibilidade */
.quantity-btn:focus,
.cart-item-remove:focus,
.cart-action-btn:focus {
    outline: 2px solid #8B4513;
    outline-offset: 2px;
}

.quantity-input:focus {
    outline: 2px solid #8B4513;
    outline-offset: 1px;
}/* Err
or state styles */
.cart-error {
    text-align: center;
    padding: 3rem 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.cart-error p {
    font-size: 1.125rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.cart-error .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #8B4513;
    color: white;
}

.cart-error .btn:hover {
    background: #6B3410;
    transform: translateY(-1px);
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8B4513;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}/* 
===== MODAL DE CONFIRMAÇÃO ===== */
.confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirmation-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.confirmation-modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-icon {
    width: 60px;
    height: 60px;
    background: #fee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.modal-message {
    color: #666;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-cancel {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.modal-btn-cancel:hover {
    background: #e9ecef;
    color: #333;
}

.modal-btn-confirm {
    background: #dc3545;
    color: white;
}

.modal-btn-confirm:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Animação de entrada do modal */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== CORREÇÕES DE LAYOUT RESPONSIVO ===== */
@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto;
        gap: 1rem;
        padding: 1rem;
    }
    
    .cart-item-image {
        width: 80px;
        height: 80px;
        grid-row: 1 / 3;
        grid-column: 1;
    }
    
    .cart-item-details {
        grid-column: 2;
        grid-row: 1;
    }
    
    .cart-item-name {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .cart-item-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .cart-item-price-column {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
        justify-self: start;
        margin-top: 0.5rem;
    }
    
    .cart-item-total {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}