/**
 * 69Shop.in - Shared Cart Sidebar CSS
 * 
 * This file contains shared styles for the cart sidebar, checkout panel,
 * and related components. Include this file in any page that needs cart functionality.
 * 
 * Usage: <link rel="stylesheet" href="assets/css/cart-sidebar.css">
 */

/* ===== CART SIDEBAR ===== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-xl);
    z-index: 1003;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

.cart-header {
    padding: 24px;
    border-bottom: 1px solid var(--light-grey);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-fast);
}

.close-cart:hover {
    color: var(--text-dark);
}

.cart-items {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--light-grey);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.cart-item-price {
    color: var(--blue-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    background: var(--light-grey);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-dark);
    transition: var(--transition-fast);
}

.quantity-btn:hover {
    background: var(--blue-primary);
    color: white;
}

.quantity {
    min-width: 30px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.remove-item {
    color: #FF6B6B;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    border-radius: 4px;
}

.remove-item:hover {
    background: #FFE6E6;
}

.cart-footer {
    padding: 24px;
    border-top: 1px solid var(--light-grey);
    background: var(--white);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
}

.checkout-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient-premium, linear-gradient(135deg, #FFD93D 0%, #FF6B6B 100%));
    color: var(--text-dark);
    border: none;
    border-radius: var(--radius-lg, 12px);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 102, 255, 0.3);
}

.checkout-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Cart Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Empty Cart State */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
}

.cart-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.cart-empty p {
    font-size: 1rem;
    margin-bottom: 20px;
}

.cart-empty a {
    color: var(--blue-primary);
    text-decoration: none;
    font-weight: 600;
}

.cart-empty a:hover {
    text-decoration: underline;
}

/* ===== CHECKOUT PANEL ===== */
.checkout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.checkout-overlay.active {
    opacity: 1;
    visibility: visible;
}

.checkout-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(1100px, 100%);
    height: 100vh;
    background: var(--light-grey);
    box-shadow: var(--shadow-xl);
    z-index: 1101;
    transform: translateX(100%);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.checkout-panel.active {
    transform: translateX(0);
}

.checkout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: var(--white);
    border-bottom: 1px solid var(--light-grey);
}

.checkout-pretitle {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.close-checkout {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-fast);
}

.close-checkout:hover {
    color: var(--text-dark);
}

.checkout-content {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.checkout-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.checkout-card {
    background: var(--white);
    border-radius: var(--radius-lg, 12px);
    padding: 20px 24px;
    box-shadow: var(--shadow-md);
}

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* Checkout Items */
.checkout-items {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 8px;
}

.checkout-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--light-grey);
}

.checkout-item:last-child {
    border-bottom: none;
}

.checkout-item-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    flex-shrink: 0;
}

.checkout-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.checkout-item-info {
    flex: 1;
}

.checkout-item-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.checkout-item-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.checkout-item-price {
    margin-left: auto;
    font-weight: 600;
    color: var(--blue-primary);
}

/* Checkout Totals */
.checkout-totals {
    border-top: 1px solid var(--light-grey);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkout-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.checkout-total-row.grand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    padding-top: 8px;
    border-top: 1px dashed var(--light-grey);
    margin-top: 8px;
}

/* ===== COUPON CODE SECTION ===== */
.coupon-section {
    margin: 16px 0;
    padding: 0;
}

.coupon-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.coupon-input-wrapper input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: 2px solid var(--light-grey, #e5e7eb);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    background: var(--white, #fff);
}

.coupon-input-wrapper input:focus {
    outline: none;
    border-color: var(--blue-primary, #0066ff);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.coupon-input-wrapper input::placeholder {
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-light, #9ca3af);
}

.coupon-input-wrapper button {
    flex-shrink: 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0066ff 0%, #00a3ff 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.coupon-input-wrapper button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.coupon-input-wrapper button:active {
    transform: translateY(0);
}

.coupon-applied {
    padding: 12px 14px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 10px;
}

.coupon-tag {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2e7d32;
    font-weight: 600;
}

.coupon-tag i.fa-tag {
    color: #4caf50;
}

.coupon-tag span {
    flex: 1;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coupon-tag button {
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(220, 53, 69, 0.1);
    border: none;
    border-radius: 50%;
    color: #dc3545;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s ease;
}

.coupon-tag button:hover {
    background: #dc3545;
    color: white;
}

.coupon-error {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fff5f5;
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: 8px;
    color: #dc3545;
    font-size: 0.85rem;
}

/* Discount Row */
.checkout-total-row.discount-row {
    color: #2e7d32;
}

.checkout-total-row .discount-amount {
    color: #2e7d32;
    font-weight: 600;
}

/* Delivery Estimate */
.delivery-estimate {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.delivery-note {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Form Styles */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row.two-col {
    flex-direction: row;
}

.form-row.two-col .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-medium);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--light-grey);
    border-radius: var(--radius-md, 8px);
    font-size: 0.95rem;
    transition: var(--transition-fast);
    background: var(--white);
    color: var(--text-dark);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-light);
}

/* Payment Options */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-option {
    border: 1px solid var(--light-grey);
    border-radius: var(--radius-md, 8px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.payment-option:hover {
    border-color: var(--blue-primary);
}

.payment-option input[type="radio"] {
    accent-color: var(--blue-primary);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.payment-option-content {
    flex: 1;
}

.payment-option strong {
    display: block;
    font-size: 0.95rem;
}

.payment-option p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}

.payment-option i {
    margin-left: auto;
    color: var(--blue-primary);
    font-size: 1.2rem;
}

.payment-option.selected {
    border-color: var(--blue-primary);
    background: var(--blue-light, rgba(0, 102, 255, 0.05));
}

.payment-security-note {
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.8rem;
    color: #2e7d32;
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment-security-note i {
    color: #43a047;
}

/* Coming Soon Payment Options */
.payment-coming-soon {
    border: 1px dashed #ddd;
    border-radius: var(--radius-md, 8px);
    padding: 16px;
    background: #fafafa;
}

.coming-soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--medium-grey);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.coming-soon-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coming-soon-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: white;
    border-radius: var(--radius-sm, 6px);
    color: var(--text-light);
    font-size: 0.9rem;
}

.coming-soon-item i {
    color: #ccc;
    width: 20px;
    text-align: center;
}

/* Checkout Messages */
.checkout-message {
    padding: 12px 16px;
    border-radius: var(--radius-md, 8px);
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

.checkout-message.info {
    display: block;
    background: var(--blue-light, rgba(0, 102, 255, 0.1));
    color: var(--blue-primary);
}

.checkout-message.error {
    display: block;
    background: #FFE6E6;
    color: #D64545;
}

.checkout-message.success {
    display: block;
    background: #E4F5E9;
    color: #137333;
}

/* Place Order Button */
.place-order-btn {
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    background: var(--gradient-premium, linear-gradient(135deg, #FFD93D 0%, #FF6B6B 100%));
    border: none;
    border-radius: var(--radius-lg, 12px);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-normal);
}

.place-order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 102, 255, 0.25);
}

.place-order-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.place-order-btn.loading {
    pointer-events: none;
}

/* Checkout Empty State */
.checkout-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.checkout-empty i {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--light-grey);
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 1024px) {
    .cart-sidebar {
        width: min(360px, 100vw);
    }

    .checkout-panel {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .checkout-content {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .checkout-header {
        padding: 16px 20px;
    }

    .form-row.two-col {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .cart-header,
    .cart-footer {
        padding: 16px;
    }

    .cart-items {
        padding: 16px;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-title {
        font-size: 1.25rem;
    }

    .checkout-btn {
        padding: 14px;
        font-size: 1rem;
    }
    
    /* Mobile Coupon Styles */
    .coupon-section {
        margin: 12px 0;
    }
    
    .coupon-input-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .coupon-input-wrapper input {
        width: 100%;
        padding: 14px 16px;
        font-size: 0.95rem;
        border-radius: 12px;
    }
    
    .coupon-input-wrapper button {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
        border-radius: 12px;
    }
    
    .coupon-applied {
        padding: 14px 16px;
    }
    
    .coupon-tag span {
        font-size: 0.85rem;
    }
}
