/* Modal Overlay Background */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none; /* Hidden by default */
    align-items: flex-end; /* Align to bottom for mobile feel */
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Content Box */
.modal-content {
    width: 100%;
    max-width: 428px; /* Match app container */
    background-color: var(--bg-main);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    max-height: 90vh;
    animation: slideUp 0.3s ease-out forwards;
    position: relative;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 15px;
    left: 15px; /* DD style usually has X on top left */
    background-color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    font-size: 16px;
    color: var(--text-main);
}

/* Modal Header Image */
.modal-img-wrapper {
    width: 100%;
    height: 200px;
    background-color: #f5f5f5;
}

.modal-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modal Body */
.modal-body {
    padding: 24px;
    padding-bottom: 140px; /* Space for the tall DoorDash checkout footer */
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.modal-desc {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Options Sections */
.modal-section {
    margin-bottom: 24px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.section-header-row h3 {
    font-size: 18px;
    font-weight: 700;
}

.required-badge {
    color: #4CAF50; /* Green for required */
    background-color: rgba(76, 175, 80, 0.1);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
}

.optional-text {
    font-size: 13px;
    color: var(--text-sub);
}

/* Radio Button Rows */
.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #EEEEEE;
    cursor: pointer;
}

.option-row:last-child {
    border-bottom: none;
}

.option-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
}

.option-row input[type="radio"] {
    width: 22px;
    height: 22px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* Fixed Footer */
.modal-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 428px;
    background-color: white;
    padding: 16px 24px;
    border-top: 1px solid #EEEEEE;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
}

/* Quantity Control */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: #F8F8F8;
    padding: 8px 12px;
    border-radius: 20px;
}

.qty-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.qty-num {
    font-size: 16px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

/* Add to Cart Button */
.add-to-cart-btn {
    background-color: #EB1700; /* DoorDash Red perfectly matching the screenshot */
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 700;
    flex: 1;
    margin-left: 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.add-to-cart-btn:hover {
    background-color: #D31500;
}

.modal-cta-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-cta-note {
    font-size: 11px;
    color: var(--text-sub);
    text-align: center;
    font-weight: 500;
}
