/**
 * Cart Page Styles
 * Additional styles for the custom cart template (page-cart.php)
 * Based on Grabit Tailwind UI
 *
 * @package Grabit
 * @version 1.0
 */

/* ==========================================================================
   Cart Page Layout
   ========================================================================== */

.gi-cart-page {
    min-height: 400px;
}

/* Empty Cart State */
.gi-cart-empty {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 60px 20px;
    text-align: center;
}

.gi-cart-empty-icon {
    margin-bottom: 20px;
}

/* ==========================================================================
   Cart Table Enhancements
   ========================================================================== */

.cart-table-content table {
    width: 100%;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
    overflow: hidden;
}

/* Quantity Input Styling */
.quantity {
    position: relative;
    display: inline-block;
}

.quantity input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    border: 1px solid #eee;
    border-radius: 5px;
    height: 35px;
    width: 84px;
    text-align: center;
    color: #4b5966;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    padding: 0;
}

.quantity input[type="number"]:focus {
    border-color: #5caf90;
}

/* Remove spinner buttons from number input */
.quantity input[type="number"]::-webkit-outer-spin-button,
.quantity input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ==========================================================================
   Cart Summary Sidebar
   ========================================================================== */

.gi-cart-summary {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
}

.gi-cart-summary-total {
    padding: 0;
}

/* Coupon Form - Both spellings for compatibility */
.gi-cart-coupon-content,
.gi-cart-coupan-content {
    transition: all 0.3s ease;
}

.gi-cart-coupon-content.hidden,
.gi-cart-coupan-content.hidden {
    display: none;
}

.gi-cart-coupon-form,
.gi-cart-coupan-form {
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #eee;
    padding: 5px;
    border-radius: 5px;
}

.gi-cart-coupon-form input[type="text"],
.gi-cart-coupan-form input[type="text"] {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0 10px;
    font-size: 14px;
    color: #777;
    outline: none;
}

.gi-cart-coupon-form button,
.gi-cart-coupan-form button {
    flex-shrink: 0;
}

/* Shipping Calculator */
.gi-cart-form {
    margin-top: 15px;
}

.gi-cart-wrap {
    display: block;
    width: 100%;
    margin-bottom: 15px;
}

.gi-cart-wrap label {
    display: block;
    margin-bottom: 9px;
    color: #4b5966;
    font-size: 14px;
    font-weight: 500;
}

.gi-cart-wrap input[type="text"],
.gi-cart-wrap input[type="number"] {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 15px;
    background: transparent;
    border: 1px solid #eee;
    border-radius: 5px;
    color: #4b5966;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.gi-cart-wrap input[type="text"]:focus,
.gi-cart-wrap input[type="number"]:focus {
    border-color: #5caf90;
}

.gi-cart-select-inner {
    position: relative;
    display: flex;
    width: 100%;
    height: 50px;
    border: 1px solid #eee;
    border-radius: 5px;
    overflow: hidden;
}

.gi-cart-select {
    width: 100%;
    height: 100%;
    padding: 0 15px;
    background: transparent;
    border: 0;
    outline: none;
    color: #4b5966;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5966' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.gi-cart-select:focus {
    border-color: #5caf90;
}

.gi-ship-title {
    font-size: 17px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 0;
    color: #777;
}

/* Sidebar Responsive Toggle */
.gi-sidebar-res {
    display: none;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

@media (max-width: 991px) {
    .gi-sidebar-res {
        display: block;
    }
    
    .gi-sidebar-dropdown {
        display: none;
    }
    
    .gi-sidebar-block.active .gi-sidebar-dropdown {
        display: block;
    }
    
    .gi-sidebar-res i {
        transition: transform 0.3s;
    }
    
    .gi-sidebar-block.active .gi-sidebar-res i {
        transform: rotate(180deg);
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Mobile devices (max-width: 767px) */
@media (max-width: 767px) {
    /* Hide table headers on mobile */
    .cart-table-content thead {
        border: 0;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }
    
    /* Stack table rows */
    .cart-table-content tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #eee;
        border-radius: 5px;
    }
    
    .cart-table-content tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 10px;
        border-bottom: 1px solid #eee;
        font-size: 14px;
    }
    
    .cart-table-content tbody td:last-child {
        border-bottom: 0;
    }
    
    /* Show data labels on mobile */
    .cart-table-content tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #4b5966;
    }
    
    /* Product name styling on mobile */
    .gi-cart-pro-name {
        width: 100%;
    }
    
    .gi-cart-pro-name a,
    .gi-cart-pro-name span {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    /* Quantity input on mobile */
    .cart-qty-wrapper {
        justify-content: flex-start !important;
        margin: 0 !important;
    }
    
    /* Cart actions on mobile */
    .gi-cart-update-bottom {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    
    .gi-cart-update-bottom a,
    .gi-cart-update-bottom button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Tablet devices (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .gi-cart-leftside,
    .gi-cart-rightside {
        width: 100%;
    }
    
    .gi-cart-rightside {
        margin-top: 30px;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.woocommerce-cart-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.woocommerce-cart-form.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #eee;
    border-top-color: #5caf90;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==========================================================================
   Button Hover Effects
   ========================================================================== */

.gi-btn-2 {
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.gi-btn-2::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.gi-btn-2:hover::before {
    width: 300px;
    height: 300px;
}

/* ==========================================================================
   WooCommerce Notices
   ========================================================================== */

.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    border-left: 4px solid;
    background: #f8f8fb;
}

.woocommerce-message {
    border-left-color: #5caf90;
    color: #4b5966;
}

.woocommerce-error {
    border-left-color: #ff7070;
    color: #4b5966;
}

.woocommerce-info {
    border-left-color: #3b82f6;
    color: #4b5966;
}

.woocommerce-message a,
.woocommerce-error a,
.woocommerce-info a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.woocommerce-message a:hover,
.woocommerce-error a:hover,
.woocommerce-info a:hover {
    color: #5caf90;
}

/* ==========================================================================
   Product Variations Display
   ========================================================================== */

.variation {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.variation dt,
.variation dd {
    display: inline;
    margin: 0;
}

.variation dt {
    font-weight: 600;
    color: #777;
}

.variation dd::after {
    content: '';
    display: block;
}

.variation p {
    margin: 2px 0;
}

/* ==========================================================================
   Applied Coupons Display
   ========================================================================== */

.woocommerce-remove-coupon {
    color: #ff7070;
    text-decoration: none;
    font-weight: 600;
    margin-left: 10px;
}

.woocommerce-remove-coupon:hover {
    color: #ff3333;
}

/* ==========================================================================
   Cart Page Utilities
   ========================================================================== */

/* Hide default WooCommerce elements if needed */
.woocommerce-cart .return-to-shop {
    display: none;
}

/* Ensure proper spacing */
.gi-cart-page .flex.flex-wrap {
    margin-bottom: -24px;
}

.gi-cart-page .flex.flex-wrap > * {
    margin-bottom: 24px;
}

