/* ============================================
   CUSTOM CART STYLES - IMPROVED UI/UX
   ============================================ */

/* Main Cart Container */
.custom-cart {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px 100px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Cart Content Grid */
.cart-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    align-items: start;
}

/* Cart Items Section */
.cart-items-section {
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.cart-section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 25px 0;
    letter-spacing: -0.5px;
}

/* Cart Products Container with Scroll */
.cart-products {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 650px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom Scrollbar */
.cart-products::-webkit-scrollbar {
    width: 6px;
}

.cart-products::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.cart-products::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 10px;
}

.cart-products::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Individual Cart Product */
.cart-product {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    padding: 20px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    transition: all 0.3s ease;
}

.cart-product:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Product Image */
.product-image {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8e8e8;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cart-product:hover .product-image img {
    transform: scale(1.05);
}

/* Product Info */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.product-name-wrapper {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.product-name a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-name a:hover {
    color: #768071;
}

.product-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: #768071;
    margin-top: 5px;
}

/* Remove Button */
.remove-item {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #999;
    transition: all 0.2s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item:hover {
    background: #ffebee;
    color: #e53935;
    transform: rotate(90deg);
}

/* Product Footer */
.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: auto;
}

/* Custom Quantity Control */
.quantity-control {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s ease;
    padding: 0;
}

.qty-btn:hover {
    background: #768071;
    color: #ffffff;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-btn svg {
    pointer-events: none;
}

.qty-input {
    width: 50px;
    height: 36px;
    border: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    background: transparent;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    outline: none;
}

/* Product Subtotal */
.product-subtotal {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.subtotal-label {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subtotal-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
}

/* Order Summary */
.order-summary {
    position: sticky;
    top: 20px;
}

.summary-sticky {
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8e8e8;
}

.summary-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 25px 0;
    letter-spacing: -0.3px;
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.summary-label {
    color: #666;
    font-weight: 500;
}

.summary-value {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 1.05rem;
}

.summary-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
    margin: 10px 0;
}

.summary-row.total {
    padding-top: 10px;
    border-top: 2px solid #e8e8e8;
    margin-top: 5px;
}

.summary-row.total .summary-label {
    font-size: 1.15rem;
    color: #1a1a1a;
    font-weight: 600;
}

.summary-row.total .summary-value {
    font-size: 1.5rem;
    color: #768071;
}

/* Checkout Section */
.checkout-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, #768071 0%, #5d6659 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(118, 128, 113, 0.3);
}

.checkout-button:hover {
    background: linear-gradient(135deg, #5d6659 0%, #4a5147 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 128, 113, 0.4);
}

.checkout-button:active {
    transform: translateY(0);
}

.continue-shopping {
    display: inline-block;
    text-align: center;
    padding: 12px;
    color: #768071;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.continue-shopping:hover {
    color: #5d6659;
    text-decoration: underline;
}

/* Mobile Checkout Bar - Hidden on Desktop */
.mobile-checkout-bar {
    display: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid #e8e8e8;
    border-top-color: #768071;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    font-size: 1rem;
    color: #666;
    font-weight: 600;
}

/* ============================================
   TABLET STYLES (768px - 1024px)
   ============================================ */

@media (max-width: 1024px) {
    .cart-content {
        grid-template-columns: 1fr 350px;
        gap: 30px;
    }

    .cart-products {
        max-height: 600px;
    }
}

/* ============================================
   MOBILE STYLES (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    .custom-cart {
        padding: 20px 15px 140px;
    }

    /* Stack Layout */
    .cart-content {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Hide Desktop Summary */
    .order-summary {
        display: none;
    }

    /* Cart Section */
    .cart-items-section {
        padding: 20px 15px;
        box-shadow: none;
        border-radius: 12px;
    }

    .cart-section-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    /* Cart Products - No Scroll on Mobile */
    .cart-products {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
        gap: 15px;
    }

    /* Cart Product */
    .cart-product {
        grid-template-columns: 90px 1fr;
        gap: 15px;
        padding: 15px;
    }

    /* Product Image */
    .product-image {
        width: 90px;
        height: 90px;
    }

    /* Product Info */
    .product-info {
        gap: 12px;
    }

    .product-name {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .product-price {
        font-size: 1rem;
    }

    /* Product Footer */
    .product-footer {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Quantity Control */
    .quantity-control {
        flex: 1;
        min-width: 120px;
    }

    .qty-btn {
        width: 32px;
        height: 32px;
    }

    .qty-input {
        height: 32px;
        width: 45px;
    }

    /* Product Subtotal */
    .product-subtotal {
        flex: 1;
        min-width: 100px;
    }

    .subtotal-label {
        font-size: 0.7rem;
    }

    .subtotal-value {
        font-size: 1.1rem;
    }

    /* Show Mobile Checkout Bar */
    .mobile-checkout-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        padding: 15px 20px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        border-top: 1px solid #e8e8e8;
    }

    .mobile-total {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .mobile-total-label {
        font-size: 0.75rem;
        color: #999;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .mobile-total-value {
        font-size: 1.4rem;
        font-weight: 700;
        color: #768071;
    }

    .mobile-checkout-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 28px;
        background: linear-gradient(135deg, #768071 0%, #5d6659 100%);
        color: #ffffff;
        border: none;
        border-radius: 25px;
        font-size: 1rem;
        font-weight: 700;
        cursor: pointer;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(118, 128, 113, 0.3);
        white-space: nowrap;
    }

    .mobile-checkout-button:active {
        transform: scale(0.98);
    }
}

/* ============================================
   SMALL MOBILE STYLES (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {
    .cart-section-title {
        font-size: 1.3rem;
    }

    .cart-product {
        grid-template-columns: 80px 1fr;
        gap: 12px;
        padding: 12px;
    }

    .product-image {
        width: 80px;
        height: 80px;
    }

    .product-name {
        font-size: 0.95rem;
    }

    .product-price {
        font-size: 0.95rem;
    }

    .product-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .quantity-control {
        align-self: flex-start;
    }

    .product-subtotal {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-checkout-bar {
        padding: 12px 15px;
    }

    .mobile-total-value {
        font-size: 1.25rem;
    }

    .mobile-checkout-button {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
}

/* ============================================
   CHARACTERISTICS SECTION (Existing Styles)
   ============================================ */

.characteristics-section {
    padding: 60px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F8F8F7;
}

.characteristics-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title {
    font-size: 2.2rem;
    color: #323232;
    text-align: center;
    margin-bottom: 40px;
    font-weight: 700;
}

.product-navigation {
    margin-bottom: 50px;
    position: relative;
}

.product-nav-wrapper {
    overflow: hidden;
    position: relative;
}

.product-nav-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 20px;
    margin-bottom: -20px;
}

.product-nav-scroll::-webkit-scrollbar {
    display: none;
    height: 0;
}

.product-nav-btn {
    padding: 15px 30px;
    background-color: #fefefe;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
    white-space: nowrap;
}

.product-nav-btn.active {
    color: #9C7B98;
    border-color: #9C7B98;
    font-weight: 600;
}

.product-display-area {
    position: relative;
}

.product-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.product-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 40px;
    align-items: stretch;
    margin-bottom: 40px;
}

.characteristics-left,
.characteristics-right {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    height: 100%;
}

.characteristic-box {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.char-title {
    font-size: 1.2rem;
    color: #9C7B98;
    margin-bottom: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.char-text {
    color: #666;
    line-height: 1.6;
    font-size: 0.9rem;
    flex: 1;
    overflow-y: auto;
    word-wrap: break-word;
    hyphens: auto;
    min-height: 0;
}

.product-image-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    align-self: center;
}

.product-main-image {
    width: 100%;
    max-width: 350px;
    height: auto;
    object-fit: contain;
}

.btn-bestseller {
    background-color: #4E1C50;
    color: #fefefe;
    padding: 12px 24px;
    border: none;
    border-radius: 25px 25px 25px 0;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease;
    position: absolute;
    bottom: -10px;
    right: -5px;
}

.product-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-add-cart,
.btn-view-details {
    padding: 15px 35px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-add-cart {
    background-color: #768071;
    color: #fefefe;
    border: 2px solid #768071;
    height: 100%;
}

.btn-add-cart.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-view-details {
    background-color: #fefefe;
    color: #768071;
    border: 2px solid #768071;
}

.btn-add-cart.disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

@media (max-width: 968px) {
    .section-title {
        font-size: 2rem;
    }

    .product-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .characteristics-left,
    .characteristics-right {
        grid-template-rows: auto;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        height: auto;
    }

    .characteristic-box {
        height: auto;
        min-height: 150px;
    }

    .product-image-wrapper {
        order: -1;
    }

    .product-main-image {
        max-width: 280px;
    }

    .product-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn-add-cart,
    .btn-view-details {
        width: 100%;
    }
}

@media (min-width: 968px) {
    .product-nav-scroll {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }

    .product-navigation {
        margin: 0 -20px 40px;
        padding: 0 20px;
    }

    .product-nav-scroll {
        gap: 10px;
    }

    .product-nav-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .characteristics-left,
    .characteristics-right {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .characteristic-box {
        min-height: auto;
    }

    .char-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .characteristics-section {
        padding: 30px 15px;
        padding-bottom: 50px;
    }

    .char-title {
        margin-bottom: 2px;
    }
}