/**
 * ═══════════════════════════════════════════════════════════════════════
 * TECHVIZIT UNIFIED CART SYSTEM CSS
 * ═══════════════════════════════════════════════════════════════════════
 * 
 * Tek kaynak sepet stilleri - index.html ve products.html için ortak
 * Son güncelleme: 2026-01-14
 */

/* Prevent horizontal scroll when cart is open */
body.cart-open {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
}

html.cart-open {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
}

/* ═══════════════════════════════════════════════════════════════════════
 * CART ICON & BADGE STYLES
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-icon-btn {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 100;
}

.cart-icon-btn:hover {
    background: rgba(0, 210, 129, 0.1);
    border-color: var(--primary);
    transform: scale(1.05);
}

.cart-icon-btn i {
    font-size: 18px;
}

.cart-icon-btn svg,
.cart-icon-svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    pointer-events: none;
}

/* Favorites Icon Button */
.favorites-icon-btn {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 100;
    text-decoration: none;
}

.favorites-icon-btn:hover {
    background: rgba(0, 210, 129, 0.1);
    border-color: var(--primary);
    transform: scale(1.05);
}

.favorites-icon-btn svg,
.favorites-icon-svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    pointer-events: none;
}

/* Favorites Badge - Counter */
.favorites-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: #000000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none !important;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid rgba(0, 0, 0, 0.8);
    transition: all 0.2s ease;
    pointer-events: none;
    line-height: 1;
}

.favorites-badge:empty,
.favorites-badge[data-count="0"] {
    display: none !important;
}

/* Cart Badge - Global counter */
.cart-count-global,
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: #000000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid rgba(0, 0, 0, 0.8);
    transition: all 0.2s ease;
    pointer-events: none;
    line-height: 1;
}

.cart-count-global:empty,
.cart-badge:empty {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════
 * CART DRAWER (OVERLAY & CONTAINER)
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

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

.cart-drawer {
    position: fixed !important;
    top: 0 !important;
    right: -450px !important;
    width: 100% !important;
    max-width: 450px !important;
    height: 100vh !important;
    background: #000000 !important;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5) !important;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 1000 !important;
    display: flex !important;
    flex-direction: column !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
}

.cart-drawer.active {
    right: 0 !important;
}

/* ═══════════════════════════════════════════════════════════════════════
 * CART HEADER
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #000000;
    flex-shrink: 0;
}

.cart-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.cart-title .cart-icon {
    width: 24px;
    height: 24px;
    color: var(--primary, #00d281);
}

.close-btn,
.cart-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary, #999);
    transition: color 0.2s ease;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover,
.cart-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

/* ═══════════════════════════════════════════════════════════════════════
 * CART CONTENT
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-content,
.cart-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 20px 25px 130px 25px !important;
    -webkit-overflow-scrolling: touch !important;
    min-height: 0 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Custom scrollbar for cart content */
.cart-content::-webkit-scrollbar,
.cart-body::-webkit-scrollbar {
    width: 6px;
}

.cart-content::-webkit-scrollbar-track,
.cart-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.cart-content::-webkit-scrollbar-thumb,
.cart-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.cart-content::-webkit-scrollbar-thumb:hover,
.cart-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cart-modal-body {
    padding: 0;
}

/* Empty Cart State */
.empty-cart,
.cart-empty {
    text-align: center;
    padding: 40px 20px;
}

.empty-cart-icon,
.cart-empty i {
    font-size: 48px;
    color: var(--text-secondary, #999);
    margin-bottom: 16px;
    display: block;
}

.empty-cart p,
.cart-empty p {
    color: var(--text-secondary, #999);
    margin-bottom: 8px;
    font-size: 16px;
}

.empty-cart p:last-child,
.cart-empty p:last-child {
    font-size: 14px;
    opacity: 0.8;
}

/* Cart Items Container */
.cart-items,
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0;
    margin: 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════════
 * CART ITEM CARD
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-item {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 12px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
}

.cart-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(0, 210, 129, 0.3) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 210, 129, 0.15) !important;
}

/* Ürün detaylarına tıklanabilirlik - butonlar hariç */
.cart-item-clickable {
    cursor: pointer !important;
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.cart-item-clickable:hover {
    opacity: 0.9;
}

.quantity-controls,
.cart-item-remove {
    position: relative;
    z-index: 10;
    cursor: default;
    flex-shrink: 0;
    pointer-events: auto;
}

.cart-item-image,
.item-image {
    width: 70px !important;
    height: 70px !important;
    border-radius: 8px !important;
    object-fit: cover !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0 !important;
}

.cart-item-details,
.item-details {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-align: left !important;
}

.cart-item-details .cart-item-controls-row {
    margin-top: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    min-height: 24px !important;
}

.cart-item-clickable .cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name,
.cart-item-title,
.item-name {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-primary, #fff) !important;
    margin-bottom: 2px !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    text-align: left !important;
}

.cart-item-code {
    font-size: 11px !important;
    color: #666 !important;
    margin: 0 !important;
    text-align: left !important;
}

.cart-item-price,
.item-price {
    font-size: 13px !important;
    color: var(--primary, #00d281) !important;
    font-weight: 600 !important;
    margin-top: 2px !important;
    text-align: left !important;
}

/* Cart Item Controls (quantity + remove) */
.cart-item-controls {
    display: none; /* Artık cart-item-details içinde */
}

.cart-item-controls-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.quantity-controls {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(0, 210, 129, 0.4) !important;
    border-radius: 6px !important;
    padding: 0 !important;
    width: 80px !important;
    max-width: 80px !important;
    min-width: 80px !important;
}

.quantity-btn {
    background: transparent !important;
    border: none !important;
    color: var(--text-primary, #fff) !important;
    cursor: pointer !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    min-width: 24px !important;
    max-width: 24px !important;
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    z-index: 10 !important;
    pointer-events: auto !important;
    position: relative !important;
}

.quantity-btn:hover {
    background: rgba(0, 210, 129, 0.2);
    color: var(--primary, #00d281);
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-btn svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.5;
}

.cart-item-controls input[type="number"],
.cart-item-quantity {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 24px !important;
    flex: 0 0 32px;
    padding: 0;
    margin: 0;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
    outline: none;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none;
    line-height: 24px !important;
}

/* Force compact numeric input inside cart drawer (override global form styles) */
.cart-drawer input[type="number"].cart-item-quantity {
    display: inline-block !important;
    width: 32px !important;
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 24px !important;
    font-size: 14px !important;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    box-shadow: none !important;
}

.cart-item-controls input[type="number"]::-webkit-outer-spin-button,
.cart-item-controls input[type="number"]::-webkit-inner-spin-button,
.cart-item-quantity::-webkit-outer-spin-button,
.cart-item-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item-controls input[type="number"]:focus,
.cart-item-quantity:focus {
    outline: none;
}

/* Cart Item Total Price */
.cart-item-total {
    display: block !important;
    position: static !important;
    margin-left: auto !important;
    align-self: flex-start !important;
    padding-left: 8px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--primary, #00d281) !important;
    white-space: nowrap !important;
    text-align: right !important;
}

/* ═══════════════════════════════════════════════════════════════════════
 * QUANTITY CONTROLS (Legacy - yeni quantity-controls kullanılıyor)
 * ═══════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════
 * REMOVE BUTTON
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-item-remove,
.remove-btn {
    background: none;
    border: none;
    color: #ff4757;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 16px;
}

.cart-item-remove:hover,
.remove-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #ff6348;
}

/* ═══════════════════════════════════════════════════════════════════════
 * CART FOOTER (SUMMARY & CHECKOUT)
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-footer {
    padding: 20px 25px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: #000000 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3) !important;
    flex-shrink: 0 !important;
    position: static !important;
    z-index: 11 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.cart-footer.empty {
    display: none !important;
}

.cart-summary {
    margin-bottom: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--text-secondary, #999);
    font-size: 14px;
}

.summary-row.subtotal {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.summary-row.total,
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
    margin-top: 10px;
}

.cart-total span {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary, #999);
}

.cart-total strong {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
}

.cart-checkout-btn,
.checkout-btn {
    width: 100%;
    background: var(--primary, #00d281) !important;
    background-color: var(--primary, #00d281) !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    border: 1px solid var(--primary, #00d281);
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 0.95rem !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 210, 129, 0.2);
    line-height: 1.2 !important;
    text-indent: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    white-space: normal !important;
    overflow: visible !important;
    text-shadow: none !important;
    font-family: inherit !important;
}

.cart-checkout-btn .btn-text,
.checkout-btn .btn-text {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: inherit !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    text-align: center !important;
    text-rendering: optimizeLegibility;
}

.cart-checkout-btn:hover,
.checkout-btn:hover {
    background: rgba(0, 210, 129, 0.9);
    color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 210, 129, 0.3);
}

.cart-checkout-btn:active,
.checkout-btn:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════
 * LOADING STATE
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-loading {
    text-align: center;
    padding: 40px 20px;
}

.cart-loading i {
    font-size: 32px;
    color: var(--primary, #00d281);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════
 * RESPONSIVE DESIGN
 * ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .cart-drawer {
        max-width: 100%;
        right: -100%;
    }

    .cart-header {
        padding: 15px 20px;
    }

    .cart-content,
    .cart-body {
        padding: 15px 20px 130px 20px !important;
        display: flex !important;
        flex-direction: column !important;
        flex: 1;
        overflow-y: auto;
    }

    .cart-footer {
        padding: 15px 20px !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        flex-shrink: 0 !important;
        display: none !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        background: #000000 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        width: 100% !important;
        min-height: auto !important;
        z-index: 10000 !important;
        max-width: 100vw !important;
        visibility: hidden !important;
        opacity: 0 !important;
        transition: visibility 0.3s ease, opacity 0.3s ease !important;
    }

    body.cart-open .cart-footer {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .cart-footer.empty {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    .cart-total {
        display: flex !important;
        justify-content: space-between !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        width: 100% !important;
    }

    .cart-checkout-btn,
    .checkout-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-height: 50px !important;
        width: 100% !important;
        padding: 12px 16px !important;
        justify-content: center !important;
        align-items: center !important;
        margin-top: auto !important;
    }

    .cart-checkout-btn .btn-text,
    .checkout-btn .btn-text {
        display: inline-block !important;
        color: #ffffff !important;
        font-weight: 600 !important;
        font-size: 16px !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .cart-item {
        gap: 10px;
        padding: 12px;
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .cart-item-clickable {
        flex: 1;
        min-width: 0;
    }

    .cart-item-details .cart-item-controls-row {
        margin-top: 8px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .cart-item-total {
        font-size: 15px;
        margin-left: 8px;
        align-self: center;
        margin-top: 0;
    }
    
    .quantity-controls {
        width: 80px;
        max-width: 80px;
        min-width: 80px;
        gap: 0;
        padding: 0;
    }
    
    .quantity-btn {
        min-width: 24px;
        max-width: 24px;
        width: 24px;
        height: 24px;
        padding: 2px 4px;
    }
    
    .quantity-btn svg {
        width: 12px;
        height: 12px;
    }
    
    .cart-item-quantity {
        width: 32px;
        min-width: 32px;
        max-width: 32px;
        font-size: 14px;
    }

    .cart-item-image,
    .item-image {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }

    .cart-item-clickable {
        gap: 10px;
        min-width: 0;
    }

    .cart-item-name {
        font-size: 13px;
    }

    .cart-item-price {
        font-size: 13px;
    }

    .cart-title {
        font-size: 1.2rem;
    }

    .cart-item-controls {
        gap: 8px;
        flex-shrink: 0;
    }
    .cart-item-total {
        font-size: 14px;
        margin-left: 4px;
    }

    .checkout-btn,
    .cart-checkout-btn {
        padding: 12px 16px !important;
        font-size: 16px !important;
        border-width: 1px !important;
        line-height: 1.3 !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        text-align: center !important;
        text-indent: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-weight: 600 !important;
        letter-spacing: 0.3px !important;
        height: auto !important;
    }

    .cart-checkout-btn .btn-text,
    .checkout-btn .btn-text {
        display: inline-block !important;
        color: #ffffff !important;
        font-weight: 600 !important;
        font-size: 16px !important;
        visibility: visible !important;
        opacity: 1 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-shadow: none !important;
    }
    
    .checkout-btn .btn-text,
    .cart-checkout-btn .btn-text {
        font-size: 16px !important;
        color: #000000 !important;
        -webkit-text-fill-color: #000000 !important;
    }

    .summary-row.total,
    .cart-total {
        font-size: 0.95rem;
    }
    
    .cart-total span {
        font-size: 0.9rem;
    }
    
    .cart-total strong {
        font-size: 1rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .cart-drawer {
        max-width: 400px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
 * NOTIFICATION STYLES
 * ═══════════════════════════════════════════════════════════════════════ */

.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #00d084 0%, #00b872 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 208, 132, 0.4);
    z-index: 10000;
    font-size: 14px;
    font-weight: 600;
    max-width: 350px;
    animation: notificationSlideIn 0.4s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.cart-notification.fade-out {
    animation: notificationFadeOut 0.3s ease-in forwards;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes notificationFadeOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

