/* ==================================================================
 * KORNINO QUANTITY +/- BUTTONS v5.0 - CLEAN SLATE EDITION
 * Simple, robust quantity buttons that work reliably
 * No complex DOM manipulation - just clean, simple styling
 * ================================================================== */

/* Hide default number input arrows */
.woocommerce-cart .qty::-webkit-outer-spin-button,
.woocommerce-cart .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.woocommerce-cart .qty[type=number] {
    -moz-appearance: textfield;
}

/* Main quantity controls container */
.kornino-qty-controls {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}

/* Quantity display (replaces input) */
.kornino-qty-display {
    display: inline-block;
    width: 50px;
    height: 38px;
    line-height: 38px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: transparent;
    border: none;
    user-select: none;
}

/* Plus and minus buttons */
.kornino-qty-minus,
.kornino-qty-plus {
    background: #f5f5f5;
    border: none;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
}

.kornino-qty-minus:hover,
.kornino-qty-plus:hover {
    background: #92b57d;
    color: #fff;
}

.kornino-qty-minus:active,
.kornino-qty-plus:active {
    transform: scale(0.95);
}

.kornino-qty-minus:disabled,
.kornino-qty-plus:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button separators */
.kornino-qty-minus {
    border-right: 1px solid #ddd;
}

.kornino-qty-plus {
    border-left: 1px solid #ddd;
}

/* Loading state */
.kornino-qty-controls.loading {
    opacity: 0.6;
    pointer-events: none;
}

.kornino-qty-controls.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border: 2px solid #92b57d;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

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

/* Desktop table integration */
.woocommerce-cart table.cart .product-quantity {
    padding: 10px 8px;
}

.woocommerce-cart table.cart .product-quantity .kornino-qty-controls {
    margin: 0 auto;
    display: inline-flex;
}

/* Mobile card integration */
.kornino-cart-card .quantity-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.kornino-cart-card .quantity-section .kornino-qty-controls {
    margin: 0 auto;
}

/* ==================================================================
 * CART NOTICES STYLING - MATCH COUPON STYLE
 * Style cart removal and other notices to match the coupon style
 * ================================================================== */

.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    background: #f8f9fa !important;
    border: 1px solid #e9ecef !important;
    border-left: 4px solid #92b57d !important;
    border-radius: 6px !important;
    padding: 12px 16px !important;
    margin: 16px 0 !important;
    font-size: 14px !important;
    color: #333 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    list-style: none !important;
    position: relative !important;
}

/* Success messages (like item removal) */
.woocommerce-message {
    border-left-color: #92b57d !important;
}

.woocommerce-message::before {
    content: "✓" !important;
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background: #92b57d !important;
    color: #fff !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: bold !important;
}

.woocommerce-message {
    padding-left: 48px !important;
}

/* Error messages */
.woocommerce-error {
    border-left-color: #dc3545 !important;
}

.woocommerce-error::before {
    content: "✕" !important;
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background: #dc3545 !important;
    color: #fff !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: bold !important;
}

.woocommerce-error {
    padding-left: 48px !important;
}

/* Info messages */
.woocommerce-info {
    border-left-color: #17a2b8 !important;
}

.woocommerce-info::before {
    content: "i" !important;
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background: #17a2b8 !important;
    color: #fff !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: bold !important;
    font-style: normal !important;
}

.woocommerce-info {
    padding-left: 48px !important;
}

/* Undo link styling */
.woocommerce-message a.restore-item,
.woocommerce-error a,
.woocommerce-info a {
    color: #92b57d !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    transition: color 0.2s ease !important;
}

.woocommerce-message a.restore-item:hover,
.woocommerce-error a:hover,
.woocommerce-info a:hover {
    color: #7a9a66 !important;
    text-decoration: underline !important;
}

/* Remove the border-top styling from themes */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    border-top: none !important;
}

/* Clean up any icon styling conflicts */
.woocommerce-message li::before,
.woocommerce-error li::before,
.woocommerce-info li::before {
    display: none !important;
}

/* ==================================================================
 * ENHANCED MOBILE CART STYLING - COMPACT & ALIGNED
 * ================================================================== */

@media (max-width: 767px) {
    /* More compact mobile cards */
    .kornino-cart-card {
        margin-bottom: 12px !important;
        padding: 16px !important;
        border-radius: 8px !important;
    }
    
    /* Compact product header */
    .kornino-cart-card h3 {
        font-size: 16px !important;
        line-height: 1.2 !important;
        margin-bottom: 8px !important;
    }
    
    /* Enhanced three-column grid (Cena, Ilość, Kwota) - FIXED ALIGNMENT */
    .kornino-cart-card > div:nth-child(2) {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 8px !important;
        margin: 12px 0 !important;
        padding: 12px 8px !important;
        background: rgba(146, 181, 125, 0.08) !important;
        border-radius: 6px !important;
        border: 1px solid rgba(146, 181, 125, 0.15) !important;
        align-items: center !important;
    }
    
    /* Column styling - labels */
    .kornino-cart-card > div:nth-child(2) > div > div:first-child {
        font-size: 11px !important;
        color: #666 !important;
        margin-bottom: 6px !important;
        font-weight: 500 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Price column (Cena) - BETTER ALIGNMENT & BIGGER TEXT */
    .kornino-cart-card > div:nth-child(2) > div:first-child {
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .kornino-cart-card > div:nth-child(2) > div:first-child > div:last-child {
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #333 !important;
        line-height: 1.2 !important;
        margin-top: 2px !important;
    }
    
    /* Quantity column (Ilość) - PERFECT CENTER ALIGNMENT */
    .kornino-cart-card > div:nth-child(2) > div:nth-child(2) {
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .kornino-cart-card .quantity-section {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-top: 2px !important;
    }
    
    /* Total column (Kwota) - BACK TO BLACK & BETTER ALIGNMENT */
    .kornino-cart-card > div:nth-child(2) > div:last-child {
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .kornino-cart-card > div:nth-child(2) > div:last-child > div:last-child {
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #333 !important;
        line-height: 1.2 !important;
        margin-top: 2px !important;
    }
    
    /* SMALLER quantity buttons for mobile */
    .kornino-qty-minus,
    .kornino-qty-plus {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }
    
    .kornino-qty-display {
        width: 40px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
    }
    
    /* Compact quantity controls container */
    .kornino-cart-card .kornino-qty-controls {
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
        border: 1px solid #ddd !important;
    }
    
    /* FIXED Subscription options styling - REMOVE BOX-IN-BOX & MAKE MORE COMPACT */
    .kornino-cart-card .kfs-cart-options {
        margin: 8px 0 0 0 !important;
        padding: 10px 12px !important;
        background: #f0f8f0 !important;
        border-radius: 6px !important;
        border-left: 3px solid #92b57d !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    /* Header from plugin - style it properly */
    .kornino-cart-card .kfs-cart-options > div:first-child {
        font-size: 12px !important;
        font-weight: 600 !important;
        color: #333 !important;
        margin-bottom: 6px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }
    
    .kornino-cart-card .kfs-cart-options label {
        font-size: 12px !important;
        margin-bottom: 2px !important;
        display: block !important;
        color: #333 !important;
        font-weight: normal !important;
        line-height: 1.3 !important;
    }
    
    .kornino-cart-card .kfs-cart-options input[type="radio"] {
        margin-right: 6px !important;
        transform: scale(0.9) !important;
    }
    
    .kornino-cart-card .kfs-cart-options select {
        font-size: 12px !important;
        padding: 3px 5px !important;
        margin-top: 4px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        background: #fff !important;
        width: auto !important;
        min-width: 120px !important;
    }
    
    /* Clean up any nested styling issues */
    .kornino-cart-card .kfs-cart-options .kfs-cart-options {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border-left: none !important;
    }
    
    /* Clickable product names in mobile cards */
    .kornino-cart-card h3 a {
        color: #333 !important;
        text-decoration: none !important;
        transition: color 0.2s ease !important;
    }
    
    .kornino-cart-card h3 a:hover {
        color: #92b57d !important;
        text-decoration: underline !important;
    }
    
    /* Remove button styling for mobile */
    .kornino-cart-card button[onclick*="removeProduct"] {
        background: none !important;
        border: none !important;
        color: #dc3545 !important;
        font-size: 18px !important;
        font-weight: bold !important;
        cursor: pointer !important;
        padding: 4px !important;
        line-height: 1 !important;
        border-radius: 50% !important;
        width: 28px !important;
        height: 28px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
    }
    
    .kornino-cart-card button[onclick*="removeProduct"]:hover {
        background: #dc3545 !important;
        color: #fff !important;
        transform: scale(1.1) !important;
    }
    
    /* Mobile notices styling */
    .woocommerce-message,
    .woocommerce-error,
    .woocommerce-info {
        margin: 12px 0 !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
    
    .woocommerce-message,
    .woocommerce-error,
    .woocommerce-info {
        padding-left: 40px !important;
    }
    
    .woocommerce-message::before,
    .woocommerce-error::before,
    .woocommerce-info::before {
        left: 12px !important;
        width: 16px !important;
        height: 16px !important;
        font-size: 10px !important;
    }
}

/* Remove button styling */
.woocommerce-cart .product-remove .remove {
    color: #dc3545 !important;
    font-size: 18px !important;
    font-weight: bold !important;
    text-decoration: none !important;
    background: #fff !important;
    border: 1px solid #dc3545 !important;
    border-radius: 50% !important;
    width: 30px !important;
    height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.woocommerce-cart .product-remove .remove:hover {
    background: #dc3545 !important;
    color: #fff !important;
    transform: scale(1.1) !important;
}

/* Ensure proper alignment in both desktop and mobile */
.woocommerce-cart .quantity .kornino-qty-controls,
.kornino-cart-card .quantity-section .kornino-qty-controls {
    display: inline-flex;
    vertical-align: middle;
}

/* Hide original WooCommerce quantity inputs when our custom ones are active */
.woocommerce-cart .qty[style*="display: none"] {
    display: none !important;
} 