/* Point Rewards Catalog Styles */

/* User Points Display */
.user-points-display {
    background: #f8f9fa;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 0px;
    text-align: center;
    border: 2px solid #e9ecef;
}

.user-points-display .points-label {
    font-size: 16px;
    color: #666;
    margin-right: 10px;
}

.user-points-display .points-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

/* Rewards Grid */
.rewards-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 30px;
}

.rewards-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.rewards-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.rewards-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive */
@media (max-width: 1024px) {
    .rewards-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .rewards-grid-3,
    .rewards-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    .rewards-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .rewards-grid,
    .rewards-grid-3,
    .rewards-grid-4 {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .rewards-grid-2 {
        justify-items: unset;
    }
}

/* Reward Item Card */
.reward-item {
    background: #fff;
    border: 0px;
    border-radius: 0px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.reward-item.disabled {
    opacity: 0.6;
}

.reward-item.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ===================================
   COUPON CARDS STYLES
   =================================== */

/* Coupon Visual/Icon */
.reward-coupon .coupon-visual {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.reward-coupon-card .coupon-icon {
    top: 50%;
    left: 2.2%;
    transform: translate(-50%, -50%);
    font-size: 64px;
}

.coupon-icon .icon-text {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Coupon Code Display (After Redemption) */
.coupon-code-display {
    background: #f8f9fa;
    padding: 12px;
    margin: 12px 0;
    border-radius: 4px;
    text-align: center;
}

.coupon-code-display strong {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.coupon-code-display code {
    background: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    border: 2px dashed #667eea;
    display: inline-block;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

/* Redeemed Date */
.redeemed-date {
    font-size: 12px;
    color: #999;
    margin: 8px 0;
    text-align: center;
}

/* Redeemed Button */
.redeemed-btn {
    background: #28a745 !important;
    cursor: not-allowed !important;
    opacity: 0.8;
    position: relative;
}

.redeemed-btn:hover {
    background: #28a745 !important;
    opacity: 0.8;
}

.redeemed-btn::before {
    content: "✓ ";
    margin-right: 5px;
}

/* ===================================
   END COUPON CARDS STYLES
   =================================== */

/* Product Image */
.reward-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    overflow: hidden;
    background: #f8f9fa;
}

.reward-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.insufficient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.insufficient-overlay span {
    background: #fff;
    color: #333;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
}

/* Product Info */
.reward-info {
    padding-top: 24px;
    text-align: center;
}

.reward-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0px;
    color: #171717;
    min-height: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reward-points {
    font-size: 24px;
    font-weight: 300;
    min-height: 32px;
    color: #171717;
    margin-bottom: 16px;
}

.reward-description {
    font-size: 13px;
    color: #777;
    margin-bottom: 15px;
    line-height: 1.5;
    min-height: 40px;
}

/* Redeem Button */
.redeem-btn {
    width: 100%;
    padding: 8px 16px;
    background: #616161;
    color: #fff;
    border: none;
    border-radius: 0px;
    font-size: 16px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.5px;
}

.redeem-btn:hover {
    background: #404040;
}

.redeem-btn.disabled,
.redeem-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.redeem-btn.disabled:hover {
    background: #ccc;
}

/* Pagination */
.rewards-pagination {
    text-align: center;
    margin-top: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rewards-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: transparent;
    color: #A3A3A3;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 300;
    cursor: pointer;
}

.rewards-pagination .page-numbers:hover {
    background: #616161;
    color: #fff;
}

.rewards-pagination .page-numbers.current {
    background: #616161;
    color: #fff;
    cursor: default;
}

.rewards-pagination .page-numbers.dots {
    background: transparent;
    cursor: default;
    pointer-events: none;
}

.rewards-pagination .page-numbers.dots:hover {
    background: transparent;
}

/* First/Last/Prev/Next buttons */
.rewards-pagination .first-page,
.rewards-pagination .last-page,
.rewards-pagination .prev-page,
.rewards-pagination .next-page {
    background: transparent;
    color: #A3A3A3;
}

.rewards-pagination .first-page:hover,
.rewards-pagination .last-page:hover,
.rewards-pagination .prev-page:hover,
.rewards-pagination .next-page:hover {
    background: #616161;
    color: #fff;
}

.rewards-pagination .disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Loading State */
.rewards-loading {
    position: relative;
    pointer-events: none;
}

.rewards-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rewards-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #616161;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

/* Notice */
.point-rewards-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px 20px;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 20px;
}

/* ===================================
   POPUP STYLES
   =================================== */

.redeem-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.redeem-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.redeem-popup-content {
    position: relative;
    background: #fff;
    border-radius: 0px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: popupFadeIn 0.3s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Close Button */
.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.popup-close:hover {
    color: #333;
    background: transparent !important;
}

/* Popup Header */
.popup-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0px;
    color: #171717;
}

.popup-subtitle {
    font-size: 16px;
    color: #A3A3A3;
    margin: 0px;
    padding: 24px;
    padding-bottom: 0px;
}

/* Popup Product Display */
.popup-product {
    display: grid;
    gap: 8px;
    padding: 24px;
    border-radius: 0px;
    text-align: center;
    justify-content: center;
}

.popup-product-image {
    object-fit: cover;
    border-radius: 0px;
    flex-shrink: 0;
    margin-bottom: 24px;
}

.popup-product-info {
    flex: 1;
}

.popup-product-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0px;
    color: #171717;
}

.popup-product-points {
    font-size: 24px;
    font-weight: 300;
    color: #171717;
}

/* Popup Description */
.popup-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 0px;
}

/* Popup Actions */
.popup-actions {
    display: block;
    gap: 16px;
    padding: 24px;
    justify-self: end;
}

.popup-btn {
    flex: 1;
    width: 100px;
    padding: 8px 16px;
    border: none;
    border-radius: 0px;
    font-size: 16px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.5px;
}

.popup-cancel {
    background: #FFF;
    color: #A3A3A3;
    border: 1px solid #A3A3A3;
    margin-right: 16px;
}

.popup-cancel:hover {
    background: #E5E5E5;
    border: 1px solid #E5E5E5;
}

.popup-confirm {
    background: #616161;
    color: #fff;
    border: 1px solid #616161;
}

.popup-confirm:hover {
    background: #404040;
    border: 1px solid #404040;
}

.popup-confirm:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Popup Message */
.popup-message {
    margin: 0px 20px 20px 20px;
    padding: 8px 16px;
    border-radius: 0px;
    text-align: center;
    font-size: 16px;
}

.popup-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.popup-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading State */
.popup-confirm.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.popup-confirm.loading::after {
    content: "";
    position: absolute;
    top: 15%;
    left: 40%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 767px) {
    .redeem-popup-content {
        width: 95%;
        padding-bottom: 20px;
    }
    
    .popup-product {
        flex-direction: column;
        text-align: center;
    }
    
    .popup-product-image {
        width: 100%;
        height: 150px;
        margin: 0 auto;
    }
    
    .popup-actions {
        padding: 0px 20px;
        display: grid;
        width: 100%;
    }

    .popup-cancel {
        order: 1;
    }

    .popup-btn {
        width: 100%;
    }

    .reward-item {
        width: 230px;
    }

    /* Pagination responsive for mobile */
    .rewards-pagination {
        gap: 4px;
    }
    
    .rewards-pagination .page-numbers {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
    
    /* ซ่อนตัวเลขบางหน้าบน mobile */
    /* .rewards-pagination .page-numbers:not(.current):not(.prev-page):not(.next-page):not(.first-page):not(.last-page):not(.dots) {
        display: none;
    } */
    
    /* แสดงเฉพาะหน้าปัจจุบันและหน้าข้างเคียง */
    .rewards-pagination .page-numbers.near-current {
        display: inline-flex;
    }
}

/* Coupon Card */
.coupon-card {
    border-radius: 0px;
    background: #fff;
    position: relative;
    transition: box-shadow 0.3s;
    display: flex;
    gap: 0px;
}
.coupon-card.expired {
    opacity: 0.5;
    background: #FAFAFA;
}
/* Left Icon */
.coupon-icon {
    flex-shrink: 0;
    padding: 24px 12px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-size: cover;
}
.coupon-icon-text {
    writing-mode: sideways-lr;
    text-orientation: mixed;
    font-size: 16px;
    font-weight: 700;
    color: #171717;
    letter-spacing: 1px;
    margin-left: 10px;
}
.coupon-icon-text.icon-text-expire {
    color:#FFF;
}
/* Content */
.coupon-content {
    flex: 1;
    padding: 16px;
    border: 1px solid #E5E5E5;
}
.coupon-title {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    margin-bottom: 12px;
}
.coupon-description {
    font-size: 16px;
    color: #A3A3A3;
    line-height: 1.6;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #E5E5E5;
}
.coupon-details {
    font-size: 14px;
    color: #A3A3A3;
    line-height: 20px;
}
/* Status Badge */
.coupon-status {
    position: absolute;
    top: 35px;
    right: 20px;
    padding: 4px 8px;
    border-radius: 40px;
    font-size: 24px;
    font-weight: 300;
}
.status-available {
    background: #E6F8EE;
    color: #33C973;
    border: 1px solid #33C973;
}
.status-expired {
    background: #F5F5F5;
    color: #A3A3A3;
    border: 1px solid #A3A3A3;
}
/* Redeem Button */
.redeem-btn.coupon-btn {
    width: 215px;
    float: inline-end;
}
.popup-coupon {
    padding: 0px 24px;
    margin-top: 16px;
}

.popup-coupon .coupon-icon {
    top: 108px;
    left: 25px;
    position: relative;
    transform: translate(-50%, -50%);
    font-size: 64px;
}

@media (max-width: 1024px) {
    .reward-coupon-card .coupon-icon {
        left: 3.4%;
    }
}

@media (max-width: 768px) {
    .reward-coupon-card .coupon-icon {
        left: 3.4%;
    }
}
@media (max-width: 767px) {
    .redeem-btn.coupon-btn {
        width: 100%;
    }
    .coupon-status {
        top: 15px;
    }
    .popup-coupon .coupon-icon {
        top: 130px;
    }
    .popup-coupon {
        padding: 24px;
        margin-top: 0px;
    }
    .reward-coupon-card .coupon-icon {
        left: 7.5%;
    }
}

/* ===================================
   SHIPPING ADDRESS POPUP STYLES
   =================================== */

.shipping-address-popup-content {
    max-width: 562px;
    padding: 0;
}

.popup-header {
    padding: 24px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E5E5E5;
}

.popup-close-address {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: opacity 0.3s ease;
}

.popup-close-address:hover {
    opacity: 0.7;
}

.popup-body {
    padding: 24px;
    background: #fff;
}

.addresses-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.address-card {
    padding: 24px;
    border: 1px solid #E5E5E5;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.address-card:hover {
    border-color: #E95283;
}

.address-card.selected {
    border-color: #E95283;
    background: #FFF;
}

.address-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.address-radio {
    width: 24px;
    height: 24px;
    border: 1px solid #A3A3A3;
    border-radius: 50%;
    position: relative;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.address-card.selected .address-radio {
    border-color: #E95283;
}

.address-card.selected .address-radio::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #E95283;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.address-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.address-name {
    color: #171717;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
}

.address-text {
    color: #171717;
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
}

.address-phone {
    color: #171717;
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
}

.address-note-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #E5E5E5;
}

.address-note-title {
    color: #171717;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    margin-bottom: 8px;
}

.address-note-text {
    color: #171717;
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
}

.add-new-address-btn {
    width: 298px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #616161;
    color: #616161;
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    margin: 0 auto;
}

.add-new-address-btn:hover {
    background: #616161;
    color: #fff;
}

.add-new-address-btn:hover svg path {
    fill: #fff;
}

.popup-cancel-address {
    background: #fff;
    color: #A3A3A3;
    border: 1px solid #A3A3A3;
    margin-right: 16px;
}

.popup-cancel-address:hover {
    background: #E5E5E5;
    border: 1px solid #E5E5E5;
}

.popup-submit-address {
    background: #616161;
    color: #fff;
    border: 1px solid #616161;
}

.popup-submit-address:hover {
    background: #404040;
    border: 1px solid #404040;
}

.popup-submit-address:disabled {
    background: #ccc;
    border: 1px solid #ccc;
    cursor: not-allowed;
}

@media (max-width: 767px) {
    .shipping-address-popup-content {
        width: 95%;
    }

    .add-new-address-btn {
        width: 100%;
    }

    .popup-actions {
        display: flex;
        gap: 16px;
    }

    .popup-cancel-address,
    .popup-submit-address {
        flex: 1;
        margin: 0;
    }
}

/* ===================================
   NOTIFICATION STYLES
   =================================== */

#redemption-notification-container {
    position: fixed;
    top: 140px;
    left: 42%;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 620px;
    pointer-events: none;
}

.redemption-notification {
    background: #fff;
    border-radius: 0px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    cursor: pointer;
}

.redemption-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.redemption-notification.fade-out {
    opacity: 0;
    transform: translateX(400px);
}

.redemption-notification-success {
    border-left: 4px solid #28a745;
}

.redemption-notification-error {
    border-left: 4px solid #dc3545;
}

.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.redemption-notification-success .notification-icon {
    color: #28a745;
}

.redemption-notification-error .notification-icon {
    color: #dc3545;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-message {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
}

.notification-message strong {
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.notification-message code {
    display: inline-block;
    margin-top: 8px;
}

.notification-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #999;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.notification-close:hover {
    color: #333;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    #redemption-notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .redemption-notification {
        min-width: 0;
        width: 100%;
    }
}

/* Animation for stacked notifications */
.redemption-notification:not(:first-child) {
    margin-top: -8px;
}