/**
 * Premium Wishlist Page Styling
 * 
 * Modern, clean, premium layout for wishlist page
 * Mobile-first, grid-based, accessible
 * 
 * IMPORTANT: This file overrides table styles from style.css
 * 
 * @package RinnoTools
 */

/* ============================================
   OVERRIDE TABLE STYLES FROM style.css
   ============================================ */

/* Force block display to override table styles (higher specificity) */
.page-wishlist .wishlist,
.page-wishlist .wishlist-page .wishlist,
.page-wishlist .wishlist-page__content .wishlist,
.wishlist-page .wishlist,
.wishlist-page__content .wishlist {
    display: block !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
}

/* Hide table elements if they exist */
.page-wishlist .wishlist thead,
.page-wishlist .wishlist tbody,
.page-wishlist .wishlist tr,
.page-wishlist .wishlist th,
.page-wishlist .wishlist td,
.wishlist-page .wishlist thead,
.wishlist-page .wishlist tbody,
.wishlist-page .wishlist tr,
.wishlist-page .wishlist th,
.wishlist-page .wishlist td,
.wishlist-page__content .wishlist thead,
.wishlist-page__content .wishlist tbody,
.wishlist-page__content .wishlist tr,
.wishlist-page__content .wishlist th,
.wishlist-page__content .wishlist td {
    display: block !important;
}

/* Override table column styles with high specificity */
.page-wishlist .wishlist .wishlist__column,
.page-wishlist .wishlist .wishlist__head,
.page-wishlist .wishlist .wishlist__body,
.page-wishlist .wishlist .wishlist__row,
.wishlist-page .wishlist .wishlist__column,
.wishlist-page .wishlist .wishlist__head,
.wishlist-page .wishlist .wishlist__body,
.wishlist-page .wishlist .wishlist__row,
.wishlist-page__content .wishlist .wishlist__column,
.wishlist-page__content .wishlist .wishlist__head,
.wishlist-page__content .wishlist .wishlist__body,
.wishlist-page__content .wishlist .wishlist__row {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    border: none !important;
    text-align: left !important;
    background: transparent !important;
}

/* ============================================
   PAGE STRUCTURE
   ============================================ */

.page-wishlist {
    padding: 0;
    margin: 0;
}

.wishlist-page {
    padding: 24px 0 48px;
    min-height: 60vh;
}

.wishlist-page__header {
    margin-bottom: 32px;
}

.wishlist-page__breadcrumb {
    margin-bottom: 16px;
}

.wishlist-page__title-wrapper {
    margin: 0;
}

.wishlist-page__title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.wishlist-page__count {
    font-size: 24px;
    font-weight: 500;
    color: #6c757d;
}

/* Guest Alert */
.wishlist-page__guest-alert {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.wishlist-page__guest-message {
    margin: 0;
    color: #004085;
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
    min-width: 200px;
}

.wishlist-page__content {
    width: 100%;
}

/* ============================================
   WISHLIST LIST (CONTAINER)
   ============================================ */

.wishlist__list {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
}

/* Ensure list doesn't use table display */
.page-wishlist .wishlist__list,
.wishlist-page .wishlist__list,
.wishlist-page__content .wishlist__list {
    display: flex !important;
    flex-direction: column !important;
}

/* ============================================
   WISHLIST ITEM (CARD)
   ============================================ */

/* Override any table row styles - HIGH SPECIFICITY */
.page-wishlist .wishlist-item,
.page-wishlist .wishlist__list > .wishlist-item,
.page-wishlist .wishlist__list article.wishlist-item,
.wishlist-page .wishlist-item,
.wishlist-page .wishlist__list > .wishlist-item,
.wishlist-page .wishlist__list article.wishlist-item,
.wishlist-page__content .wishlist-item,
.wishlist-page__content .wishlist__list > .wishlist-item,
.wishlist-page__content .wishlist__list article.wishlist-item {
    display: grid !important;
    grid-template-columns: 100px 1fr auto !important;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    align-items: start;
    align-content: start;
    width: 100% !important;
    margin: 0 !important;
}

.wishlist-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
}

.wishlist-item.removing {
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================
   PRODUCT MEDIA (THUMBNAIL)
   ============================================ */

.wishlist-item__image {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8f9fa;
    position: relative;
    display: block !important;
}

.wishlist-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.wishlist-item__image-link:hover img {
    transform: scale(1.05);
}

.wishlist-item__image-link {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================
   PRODUCT CONTENT
   ============================================ */

.wishlist-item__content {
    flex: 1;
    min-width: 0;
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
}

.wishlist-item__title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    color: #2c3e50;
}

.wishlist-item__title a {
    color: inherit;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.wishlist-item__title a:hover {
    color: rgba(17, 112, 118, 1);
}

.wishlist-item__meta {
    font-size: 13px;
    line-height: 1.5;
    color: #6c757d;
}

.wishlist-item__variation {
    margin-top: 4px;
}

.wishlist-item__variation dl {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wishlist-item__variation dt {
    font-weight: 500;
    margin: 0;
}

.wishlist-item__variation dd {
    margin: 0;
}

.wishlist-item__sku {
    margin-top: 4px;
}

.wishlist-item__price-stock {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.wishlist-item__price {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.wishlist-item__price .woocommerce-Price-amount {
    font-weight: 700;
}

.wishlist-item__stock {
    display: flex;
}

.wishlist-item__stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wishlist-item__stock-badge--in-stock {
    background-color: #d4edda;
    color: #155724;
}

.wishlist-item__stock-badge--out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
}

/* ============================================
   ACTIONS
   ============================================ */

.wishlist-item__actions {
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 160px;
    align-self: start;
    justify-content: flex-start;
}

.wishlist-item__btn {
    width: 100%;
    justify-content: center;
    font-weight: 600;
    padding: 10px 20px;
    font-size: 14px;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wishlist-item__link {
    font-size: 13px;
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
    align-self: flex-end;
}

.wishlist-item__link:hover {
    color: rgba(17, 112, 118, 1);
    text-decoration: underline;
}

.wishlist-item__remove {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
    align-self: flex-end;
    margin-top: 4px;
    opacity: 0.6;
}

.wishlist-item:hover .wishlist-item__remove {
    opacity: 1;
}

.wishlist-item__remove:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: scale(1.1);
}

.wishlist-item__remove:active {
    transform: scale(0.95);
}

.wishlist-item__remove:focus {
    outline: 2px solid #1a66ff;
    outline-offset: 2px;
}

.wishlist-item__remove svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.wishlist-item__remove:hover svg {
    transform: rotate(90deg);
}

.wishlist-item__remove:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   MOVE TO CART LOADING STATE
   ============================================ */

/* Loading state for move to cart button */
.wishlist-item__add-to-cart.rinno-is-loading,
.wishlist__move-to-cart.rinno-is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.wishlist-item__add-to-cart.rinno-is-loading::after,
.wishlist__move-to-cart.rinno-is-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    vertical-align: middle;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rinno-spin 0.6s linear infinite;
}

@keyframes rinno-spin {
    to { transform: rotate(360deg); }
}

/* Error message styling */
.wishlist-item__error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #fff5f5;
    border-left: 3px solid #dc3545;
    border-radius: 4px;
}

.wishlist-item__error a {
    color: #dc3545;
    text-decoration: underline;
    font-weight: 500;
}

.wishlist-item__error a:hover {
    text-decoration: none;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.wishlist__empty {
    text-align: center;
    padding: 80px 24px;
    max-width: 500px;
    margin: 0 auto;
}

.wishlist__empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    opacity: 0.3;
    color: #6c757d;
    fill: none;
    stroke: currentColor;
}

.wishlist__empty-message {
    font-size: 18px;
    font-weight: 500;
    color: #495057;
    margin: 0 0 24px;
    line-height: 1.5;
}

.wishlist__empty-cta .btn {
    min-width: 180px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 991px) {
    .wishlist-item {
        grid-template-columns: 100px 1fr;
        gap: 16px;
    }
    
    .wishlist-item__actions {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-width: auto;
        margin-top: 8px;
    }
    
    .wishlist-item__remove {
        align-self: center;
        margin-top: 0;
    }
    
    .wishlist-item__price-stock {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

@media (max-width: 767px) {
    .wishlist-page {
        padding: 20px 0 40px;
    }
    
    .wishlist-page__header {
        margin-bottom: 24px;
    }
    
    .wishlist-page__title {
        font-size: 26px;
    }
    
    .wishlist-page__count {
        font-size: 20px;
    }
    
    .wishlist-page__guest-alert {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
    }
    
    .wishlist-page__guest-message {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .wishlist-item {
        grid-template-columns: 80px 1fr;
        gap: 12px;
        padding: 16px;
    }
    
    .wishlist-item__image {
        width: 80px;
        height: 80px;
    }
    
    .wishlist-item__image img {
        width: 80px;
        height: 80px;
    }
    
    .wishlist-item__title {
        font-size: 15px;
    }
    
    .wishlist-item__price {
        font-size: 16px;
    }
    
    .wishlist-item__actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .wishlist-item__btn {
        width: 100%;
    }
    
    .wishlist-item__link {
        align-self: flex-start;
    }
    
    .wishlist-item__remove {
        align-self: flex-end;
        margin-top: 4px;
    }
    
    .wishlist-item__price-stock {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .wishlist__empty {
        padding: 60px 20px;
    }
    
    .wishlist__empty-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 20px;
    }
    
    .wishlist__empty-message {
        font-size: 16px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes wishlist-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wishlist-item {
    animation: wishlist-fade-in 0.3s ease backwards;
}

.wishlist-item:nth-child(1) {
    animation-delay: 0.05s;
}

.wishlist-item:nth-child(2) {
    animation-delay: 0.1s;
}

.wishlist-item:nth-child(3) {
    animation-delay: 0.15s;
}

.wishlist-item:nth-child(n+4) {
    animation-delay: 0.2s;
}

@keyframes wishlist-remove {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.wishlist-item.removing {
    animation: wishlist-remove 0.3s ease forwards;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.wishlist-item__btn:focus,
.wishlist-item__link:focus,
.wishlist-item__image-link:focus {
    outline: 2px solid #1a66ff;
    outline-offset: 2px;
    border-radius: 4px;
}

.wishlist-item__title a:focus {
    outline: 2px solid #1a66ff;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .wishlist-item__actions {
        display: none;
    }
    
    .wishlist-page__guest-alert {
        display: none;
    }
    
    .wishlist-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
