/* ===================================================
   CART VOUCHER STYLES - PRODUCT-STYLE DESIGN
   =================================================== */

/* Voucher Section Header */
.voucher-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 0;
}

.voucher-section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voucher-section-header h3 i {
    font-size: 14px;
}

.voucher-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Compact Coupon Section */
.coupon-input-group {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 0;
    padding: 15px 20px;
    background: #fff;
}

.coupon-input {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px 0 0 8px;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.coupon-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.coupon-btn {
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 100px;
}

.coupon-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Vouchers Container - Product Style */
.vouchers-container {
    background: #fff;
    padding: 15px 20px 20px;
    border-radius: 0 0 12px 12px;
    border-top: 1px solid #f0f0f0;
}

.list-voucher {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Mobile: Horizontal scroll like product vouchers */
@media (max-width: 768px) {
    .list-voucher {
        flex-direction: row;
        flex-wrap: nowrap;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 10px;
        gap: 15px;
    }
    
    .voucher-item {
        min-width: 280px;
        flex-shrink: 0;
    }
}

/* Voucher Item - Following Product Design */
.voucher-item {
    display: flex;
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-height: 112px;
    width: 300px;
}

.voucher-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.voucher-item.voucher-active {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.2);
}

/* Voucher Icon Section */
.voucher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    padding: 0px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Voucher Types with Background Images */
.voucher-freeship .voucher-icon {
    background-image: url('/static/img/bg-ship-vouchers.png');
}

.voucher-discount .voucher-icon {
    background-image: url('/static/img/bg-vouchers.png');
}

.voucher-vip .voucher-icon {
    background: linear-gradient(135deg, #6f42c1, #e83e8c);
}

.voucher-icon img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

/* Voucher Content */
.voucher-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.95);
    margin: 8px;
    border-radius: 8px;
    width: calc(100% - 112px);
}

.voucher-freeship .voucher-content,
.voucher-discount .voucher-content {
    margin: 8px;
    padding: 0px;
}

.voucher-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    color: #333;
}

.voucher-subtitle {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.4;
}

/* Progress Bar */
.voucher-progress {
    margin: 0px 0;
}

.progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 4px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #28a745, #20c997);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Voucher Footer */
.voucher-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.voucher-expiry {
    font-size: 10px;
    color: #666;
    line-height: 1.2;
}

.voucher-expiry span:first-child {
    font-weight: 500;
}

.voucher-expiry span:last-child {
    font-weight: 600;
    color: #333;
}

/* Use Button */
.voucher-use-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.voucher-use-btn:hover {
    background: #5a6fd8;
    transform: scale(1.05);
}

.voucher-use-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Active Voucher Styling */
.voucher-item.voucher-active::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    background: #28a745;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    z-index: 2;
}

.voucher-item.voucher-active .voucher-use-btn {
    background: #28a745;
    pointer-events: none;
}

.voucher-item.voucher-active .voucher-use-btn::after {
    content: " ✓";
}

/* Disabled Voucher */
.voucher-item.voucher-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

.voucher-item.voucher-disabled::before {
    content: "🔒";
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc3545;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 2;
}

/* Applied Vouchers Summary */
.applied-vouchers-summary {
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    border: 1px solid #28a745;
    border-radius: 8px;
    margin-top: 15px;
    overflow: hidden;
}

.applied-header {
    background: #28a745;
    color: white;
    padding: 10px 15px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.applied-list {
    padding: 10px 15px;
}

.applied-voucher-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 12px;
}

.applied-voucher-item:last-child {
    margin-bottom: 0;
}

.applied-voucher-code {
    font-weight: 600;
    color: #28a745;
    font-family: 'Courier New', monospace;
}

.applied-voucher-type {
    color: #666;
    font-size: 10px;
    margin-left: 5px;
}

.remove-voucher-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.remove-voucher-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Loading States */
.vouchers-loading,
.vouchers-empty,
.vouchers-error {
    text-align: center;
    padding: 30px 20px;
    color: #666;
    font-style: italic;
    font-size: 14px;
}

.vouchers-loading {
    background: #f8f9fa;
    border-radius: 8px;
}

.vouchers-empty {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    color: #856404;
}

.vouchers-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
}

/* Scrollbar Styling */
.list-voucher::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.list-voucher::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.list-voucher::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.list-voucher::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 480px) {
    .voucher-section-header {
        padding: 12px 15px;
    }
    
    .voucher-section-header h3 {
        font-size: 14px;
    }
    
    .coupon-input-group {
        padding: 12px 15px;
    }
    
    .vouchers-container {
        padding: 12px 15px 15px;
    }
    
    .voucher-item {
        min-width: 250px;
    }
    
    .voucher-icon {
        width: 112px;
    }
    
    .voucher-content {
        width: calc(100% - 120px);
        padding: 10px;
    }
}

/* Animation for voucher items */
.voucher-item {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.voucher-item:nth-child(1) { animation-delay: 0.1s; }
.voucher-item:nth-child(2) { animation-delay: 0.2s; }
.voucher-item:nth-child(3) { animation-delay: 0.3s; }
.voucher-item:nth-child(4) { animation-delay: 0.4s; }
.voucher-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Voucher in Cart Section - Left Column */
.voucher-in-cart-left {
    background: #fff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8ecef;
    border-radius: 12px;
    margin-top: 0;
    overflow: hidden;
}

/* Default fallback images if specific images not found */
.voucher-freeship .voucher-icon {
    background-image: url('/static/img/bg-ship-vouchers.png');
}

.voucher-discount .voucher-icon {
    background-image: url('/static/img/bg-vouchers.png');
}

.voucher-vip .voucher-icon {
    background: linear-gradient(135deg, #6f42c1, #e83e8c);
}

/* Ensure fallback for missing images */
.voucher-icon img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.voucher-icon img[src=""], 
.voucher-icon img:not([src]), 
.voucher-icon img[src="/favicon.ico"] {
   
}

/* When image fails to load, show text fallback */
/* .voucher-freeship .voucher-icon::after {
    content: "🚚";
    position: absolute;
    font-size: 24px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
} */

/* .voucher-discount .voucher-icon::after {
    content: "🎫";
    position: absolute;
    font-size: 24px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
} */

/* .voucher-vip .voucher-icon::after {
    content: "👑";
    position: absolute;
    font-size: 24px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}  */