/* =====================================================
   GREEN CHEF - COMPONENTS CSS
   Bilesen stilleri: Modal, Cart, Checkout, Auth
   ===================================================== */

/* =====================================================
   MODAL BASE
   ===================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active { opacity: 1; visibility: visible; }

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
}

.modal.active .modal-content { transform: translateY(0); }

.modal-body {
    flex: 1;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-close:hover { background: #ff4757; color: #fff; }

/* =====================================================
   OVERLAY
   ===================================================== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
    z-index: 10500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active { opacity: 1; visibility: visible; }

/* =====================================================
   CART SIDEBAR
   ===================================================== */
.cart {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--surface);
    z-index: 10501;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0,0,0,0.15);
}

.cart.active { right: 0; }

.cart-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 { font-size: 1.3rem; font-weight: 800; }

.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover { background: #ff4757; border-color: #ff4757; color: #fff; }

.cart-items { flex: 1; overflow-y: auto; padding: 1rem; background: var(--bg); }

.cart-empty { text-align: center; padding: 3rem 1rem; color: var(--text-light); }
.cart-empty-icon { font-size: 3rem; margin-bottom: 0.75rem; opacity: 0.5; }

.cart-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 14px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}
.cart-item-combo {
    border-left: 3px solid var(--primary);
    background: rgba(76, 175, 80, 0.05);
}
.cart-item-discount {
    border-left: 3px solid var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    overflow: hidden;
}

.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.cart-item-extras { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.cart-item-price { color: var(--primary); font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.cart-item-price .original-price { color: var(--text-muted); text-decoration: line-through; font-size: 0.8rem; font-weight: 400; }

.cart-item-discount {
    font-size: 0.7rem;
    color: #11998e;
    font-weight: 600;
    background: rgba(17, 153, 142, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.2rem;
}

.cart-item.has-discount {
    border-left: 3px solid #11998e;
    background: rgba(17, 153, 142, 0.03);
}

/* Kademeli indirim (nth item discount) */
.cart-item-discount.nth-discount {
    color: #9b59b6;
    background: rgba(155, 89, 182, 0.1);
}

.cart-item.has-nth-discount {
    border-left: 3px solid #9b59b6;
    background: rgba(155, 89, 182, 0.03);
}

/* İndirim satırı (sepet özeti) */
.discount-row {
    color: var(--success);
    font-weight: 600;
}

.discount-row span:last-child {
    color: #11998e;
}

.cart-item-controls { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qty-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.qty-val { font-weight: 600; min-width: 20px; text-align: center; font-size: 0.9rem; }

.remove-btn {
    background: none;
    border: none;
    color: #ff4757;
    cursor: pointer;
    font-size: 1rem;
    margin-left: auto;
    padding: 0.2rem;
}

.cart-footer { padding: 1.25rem; border-top: 1px solid var(--border); background: var(--surface); }

/* Minimum Order Progress */
.min-order-progress {
    display: none;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 10px;
}
.min-order-progress.visible { display: block; }
.min-order-progress.reached { background: rgba(22, 163, 74, 0.1); }
.min-order-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}
.min-order-text span:first-child { color: var(--text-muted); }
.min-order-text strong { color: var(--primary); }
.min-order-progress.reached .min-order-text span:first-child { color: var(--primary); }
.min-order-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.min-order-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #22c55e);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.cart-summary { margin-bottom: 1rem; }
.cart-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.9rem; }
.cart-row.total { font-size: 1.2rem; font-weight: 800; color: var(--primary); border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.75rem; }

.checkout-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 100px;
    background: var(--primary);
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkout-btn:hover { background: var(--primary-dark); }
.checkout-btn:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }

/* Cart Flash Suggestion */
.cart-flash-suggestion {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
    border-radius: 12px;
    animation: cartFlashPulse 2s ease-in-out infinite;
}
.cart-flash-suggestion.visible { display: block; }
@keyframes cartFlashPulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(5, 150, 105, 0.5); }
}
.cart-flash-text {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 0.5rem;
    text-align: center;
}
.cart-flash-product {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}
.cart-flash-product:hover { background: rgba(255,255,255,0.25); }
.cart-flash-product img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}
.cart-flash-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.cart-flash-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-flash-price {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fbbf24;
}
.cart-flash-add {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fbbf24;
    border: none;
    color: #065f46;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.cart-flash-add:hover { transform: scale(1.1); }

/* =====================================================
   CHECKOUT MODAL
   ===================================================== */
.checkout-modal { align-items: center; z-index: 10600; }
.checkout-modal .modal-content {
    border-radius: 24px;
    max-height: 95vh;
    max-width: 450px;
    overflow: hidden;
    position: relative;
}
.checkout-modal .modal-body {
    padding: 1rem 1.25rem;
    padding-top: 2rem;
    overflow-y: auto;
    max-height: calc(95vh - 20px);
}
.checkout-modal h2 { font-size: 1.25rem; margin-bottom: 0.5rem !important; }
.checkout-modal h3 { margin-bottom: 0.5rem !important; }
.checkout-modal .form-group { margin-bottom: 0.6rem; }
.checkout-modal .form-group label { margin-bottom: 0.25rem; font-size: 0.8rem; }
.checkout-modal .form-input { padding: 0.6rem 0.8rem; font-size: 0.9rem; }
.checkout-modal textarea.form-input { min-height: auto; }
.checkout-modal .checkout-steps { margin-bottom: 0.5rem; }
.checkout-modal .checkout-btn { padding: 0.75rem; font-size: 0.9rem; }

.checkout-steps { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 1rem; }
.step { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all 0.3s; }
.step.active { width: 24px; border-radius: 100px; background: var(--primary); }

.payment-options { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.payment-option {
    flex: 1;
    padding: 0.6rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.payment-option:hover { border-color: var(--primary); }
.payment-option.selected { border-color: var(--primary); background: var(--primary-glow); }
.payment-option .icon { font-size: 1.25rem; margin-bottom: 0.2rem; }
.payment-option .label { font-weight: 600; font-size: 0.8rem; }

.order-summary { background: var(--bg); border-radius: 10px; padding: 0.75rem; margin-bottom: 0.75rem; }
.order-summary h4 { margin-bottom: 0.5rem; font-size: 0.85rem; }
.summary-item { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.3rem; }
.summary-item.total { font-weight: 700; font-size: 0.95rem; border-top: 1px solid var(--border); padding-top: 0.4rem; margin-top: 0.4rem; }

/* Coupon Section */
.coupon-section { margin: 0.75rem 0; }
.coupon-input-row { display: flex; gap: 0.5rem; }
.coupon-input-row input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}
.coupon-apply-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.coupon-apply-btn:hover { background: var(--primary-dark); }
.coupon-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.1), rgba(22, 163, 74, 0.05));
    border: 1px solid rgba(22, 163, 74, 0.3);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin-top: 0.5rem;
}
.coupon-success { color: var(--primary); font-weight: 600; font-size: 0.85rem; }
.coupon-remove-btn {
    background: transparent;
    color: #dc2626;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
}
.coupon-error {
    color: #dc2626;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fef2f2;
    border-radius: 6px;
}

/* Loyalty Use Section */
.loyalty-use-section {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.1), rgba(22, 163, 74, 0.05));
    border: 1px solid rgba(22, 163, 74, 0.2);
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    margin: 0.5rem 0;
}
.loyalty-balance {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
}
.loyalty-balance strong { color: var(--primary); font-size: 1rem; }
.loyalty-input { display: flex; gap: 0.4rem; }
.loyalty-input input {
    flex: 1;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}
.loyalty-apply-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.loyalty-apply-btn:hover { background: var(--primary-dark); }
.loyalty-discount { color: var(--primary); font-weight: 600; }

/* Order Success Modal */
.order-success-modal { z-index: 10700; }
.order-success-modal .modal-content {
    border-radius: 24px;
    text-align: center;
    padding: 2rem;
    max-width: 380px;
}
.order-success-modal .success-icon { font-size: 4rem; margin-bottom: 1rem; }
.order-success-modal h2 { margin-bottom: 0.5rem; }
.order-success-modal .order-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* =====================================================
   PAYTR MODAL
   ===================================================== */
.paytr-modal { z-index: 99999 !important; }
.paytr-modal .modal-content.paytr-content {
    width: 95%;
    max-width: 500px;
    height: 85vh;
    max-height: 700px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.paytr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.paytr-header h3 { margin: 0; font-size: 1rem; }
.paytr-header .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}
.paytr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}
.paytr-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}
#paytrIframe {
    flex: 1;
    width: 100%;
    border: none;
    display: none;
}
#paytrIframe.loaded { display: block; }

/* =====================================================
   AUTH MODAL
   ===================================================== */
#authModal {
    align-items: center;
    padding: 1rem;
    z-index: 10000;
}

#authModal .modal-overlay {
    backdrop-filter: blur(8px);
}

#authModal .modal-content {
    max-width: 420px;
    max-height: none;
    border-radius: 24px;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    overflow: visible;
}

#authModal.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

#authModal .modal-body { padding: 0 1.5rem 2rem; }

.auth-tabs { display: flex; }
.auth-tab { flex: 1; padding: 0.75rem; text-align: center; font-weight: 600; cursor: pointer; transition: all 0.2s; color: var(--text-muted); border: none; border-radius: 10px; }
.auth-tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* =====================================================
   INFO MODAL
   ===================================================== */
#infoModal { align-items: center; }
#infoModal .modal-content {
    border-radius: 16px;
    overflow: hidden;
    max-width: 500px;
    max-height: 80vh;
}
.info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.info-modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.info-modal-header .modal-close {
    position: static;
    background: var(--surface-2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.info-modal-header .modal-close:hover { background: var(--border); }
.info-modal-body {
    padding: 1.25rem;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
    color: var(--text-light);
    line-height: 1.8;
    font-size: 0.9rem;
}
.info-modal-body p { margin-bottom: 1rem; }
.info-modal-body p:last-child { margin-bottom: 0; }

/* =====================================================
   PUSH NOTIFICATION MODAL
   ===================================================== */
.push-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.push-modal.active { opacity: 1; visibility: visible; }
.push-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}
.push-modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    max-width: 340px;
    width: 100%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.push-modal.active .push-modal-content { transform: scale(1) translateY(0); }
.push-modal-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-glow) 0%, rgba(22, 163, 74, 0.05) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 2rem;
}
.push-modal-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--text); }
.push-modal-desc { color: var(--text-light); font-size: 0.9rem; line-height: 1.5; margin-bottom: 1.5rem; }
.push-modal-buttons { display: flex; flex-direction: column; gap: 0.75rem; }
.push-btn-allow {
    padding: 0.9rem 1.5rem;
    border-radius: 100px;
    background: var(--primary);
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}
.push-btn-allow:hover { background: var(--primary-dark); transform: translateY(-2px); }
.push-btn-deny {
    padding: 0.7rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
}
.push-btn-deny:hover { color: var(--text); }

/* =====================================================
   STORE CLOSED OVERLAY
   ===================================================== */
.store-closed-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.store-closed-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
    padding-top: env(safe-area-inset-top, 2rem);
    padding-bottom: env(safe-area-inset-bottom, 2rem);
    max-width: 90%;
}
.closed-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 20px rgba(255,255,255,0.2));
}
.store-closed-content h2 { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; }
.closed-status {
    background: var(--danger);
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}
.closed-hours {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-light);
}
.closed-hours-icon { font-size: 1.5rem; }
.closed-message { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

/* =====================================================
   MOBILE RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .cart { max-width: 100%; }
}
