/* Sandwich Modal Styles */
#sandwich-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

#sandwich-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sandwich-modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 460px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
}

.sandwich-modal-header {
    padding: 18px 20px;
    border-bottom: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.sandwich-modal-header h2 {
    margin: 0;
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.sandwich-modal-close {
    display: none;
}

.sandwich-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.sandwich-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Custom Name Section */
.sandwich-custom-name-section {
    margin-bottom: 2rem;
}

.sandwich-custom-name-section h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
    font-size: 1.2rem;
}

.sandwich-custom-name-section input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s;
}

.sandwich-custom-name-section input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Ingredientes Section */
.sandwich-ingredientes-section {
    margin-bottom: 20px;
}

.sandwich-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.sandwich-section-header h3 {
    margin: 0;
    color: var(--dark-color);
    font-size: 16px;
    font-weight: 700;
}

#sandwich-counter {
    font-size: 12px;
    font-weight: 600;
    padding: 7px 10px;
    background: var(--bg-light);
    border-radius: 20px;
    white-space: nowrap;
}

.ingredientes-group {
    margin-bottom: 18px;
}

.ingredientes-group h4 {
    margin: 0 0 14px;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0;
}

.ingredientes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.sandwich-ingrediente-card {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 54px;
}

.sandwich-ingrediente-card:hover {
    border-color: var(--primary-color);
    background: var(--white);
}

.sandwich-ingrediente-card.selected {
    border-color: var(--primary-color);
    background: rgba(220, 20, 60, 0.1);
}

.sandwich-ingrediente-info {
    flex: 1;
}

.sandwich-ingrediente-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 3px;
    font-size: 13px;
    line-height: 1.25;
}

.sandwich-ingrediente-price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 12px;
}

.sandwich-ingrediente-price.free {
    color: var(--success-color);
}

.sandwich-ingrediente-check {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    background: white;
    transition: all 0.2s;
    flex: 0 0 28px;
}

.sandwich-ingrediente-card.selected .sandwich-ingrediente-check {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Observacao Section */
.sandwich-observacao-section {
    margin-bottom: 2rem;
}

.sandwich-observacao-section h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
    font-size: 1.2rem;
}

.sandwich-observacao-section textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s;
}

.sandwich-observacao-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Modal Footer */
.sandwich-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    background: var(--white);
    border-radius: 0 0 12px 12px;
    box-shadow: none;
    z-index: 2;
}

.sandwich-total {
    display: none;
    flex-direction: column;
}

.sandwich-total-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.3rem;
}

.sandwich-total-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.sandwich-modal-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn-cancel-sandwich,
.btn-add-sandwich {
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel-sandwich {
    flex: 1;
    background: #F8FAFC;
    color: var(--dark-color);
    border: 1px solid var(--border-color);
}

.btn-cancel-sandwich:hover {
    background: #d0d0d0;
}

.btn-add-sandwich {
    flex: 2;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 8px 18px rgba(220, 20, 60, 0.2);
}

.btn-add-sandwich:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(220, 20, 60, 0.26);
}

.btn-add-sandwich:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 768px) {
    #sandwich-modal {
        left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
        padding: 10px;
        overflow-y: auto;
        box-sizing: border-box;
    }
    
    .sandwich-modal-content {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .sandwich-modal-header {
        padding: 10px 16px;
        border-radius: 12px 12px 0 0;
    }
    
    .sandwich-modal-header h2 {
        font-size: 18px;
    }
    
    .sandwich-modal-body {
        padding: 20px;
    }

    .sandwich-section-header {
        align-items: center;
        gap: 10px;
    }

    .sandwich-section-header h3 {
        font-size: 15px;
        line-height: 1.25;
    }

    #sandwich-counter {
        font-size: 12px;
        padding: 7px 10px;
        text-align: center;
        white-space: normal;
        flex: 0 0 102px;
    }
    
    .ingredientes-grid {
        grid-template-columns: 1fr;
    }

    .sandwich-ingrediente-card {
        min-height: 42px;
        padding: 9px 12px;
    }
    
    .sandwich-modal-footer {
        position: sticky;
        bottom: 0;
        flex-direction: row;
        gap: 10px;
        padding: 16px 20px;
        border-radius: 0 0 12px 12px;
    }
    
    .sandwich-modal-actions {
        flex: 1;
        width: 100%;
        flex-direction: row;
        gap: 10px;
        min-width: 0;
    }
    
    .btn-cancel-sandwich,
    .btn-add-sandwich {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        min-height: 44px;
        white-space: nowrap;
    }

    .btn-cancel-sandwich {
        flex: 1;
    }

    .btn-add-sandwich {
        flex: 2;
    }
}

@media (max-width: 480px) {
    .sandwich-modal-header {
        padding: 9px 14px;
    }

    .sandwich-modal-header h2 {
        font-size: 16px;
    }

    .sandwich-modal-body {
        padding: 16px;
    }

    .sandwich-modal-footer {
        padding: 16px;
    }
}
