/**
 * WooCommerce Product Bookmarks - Styles
 *
 * Styles for bookmark button, login modal, toast notifications,
 * and My Account bookmarks table.
 *
 * @package WooCommerce_Product_Bookmarks
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    --wcb-transition: 0.2s ease;
}

/* ==========================================================================
   Bookmark Button
   ========================================================================== */

.wcb-bookmark-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--white);
    background-color: var(--text-muted);
    border-radius: var(--radius-s);
    cursor: pointer;
    transition: all var(--wcb-transition);
    -webkit-user-select: none;
    user-select: none;
    box-shadow: var(--shadow-s);
}

.wcb-bookmark-btn:hover {
    box-shadow: none;
}


.wcb-bookmark-btn.wcb-bookmarked {
    opacity: 0.85;
}


.wcb-bookmark-btn.wcb-loading {
    opacity: 0.7;
    pointer-events: none;
}

.wcb-bookmark-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   Login Modal
   ========================================================================== */

.wcb-login-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wcb-login-modal.wcb-modal-active {
    opacity: 1;
    visibility: visible;
}

.wcb-modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.wcb-modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    padding: 32px;
    background-color: var(--bg-card);
    border-radius: var(--radius-m);
    box-shadow: var(--wcb-shadow-lg);
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.wcb-modal-active .wcb-modal-content {
    transform: scale(1);
}

.wcb-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--wcb-transition);
}

.wcb-modal-close:hover {
    background-color: var(--bg-card-alt);
    color: var(--text-body);
}

.wcb-modal-message {
    margin: 0 0 24px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-body);
}

.wcb-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.wcb-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-m);
    transition: all var(--wcb-transition);
}

.wcb-modal-btn-login {
    background-color: var(--primary);
    color: #ffffff;
}

.wcb-modal-btn-login:hover {
    background-color: var(--primary-l-2);
    color: #ffffff;
}

.wcb-modal-btn-join {
    background-color: var(--bg-card-alt);
    color: var(--text-body);
    border: 1px solid var(--border-primary);
}

.wcb-modal-btn-join:hover {
    background-color: var(--border-primary);
    color: var(--text-body);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.wcb-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.wcb-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    min-width: 280px;
    max-width: 400px;
    background-color: var(--bg-card);
    border-radius: var(--radius-m);
    box-shadow: var(--wcb-shadow-lg);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    animation: wcb-toast-in 0.3s ease forwards;
}

.wcb-toast.wcb-toast-out {
    animation: wcb-toast-out 0.3s ease forwards;
}

@keyframes wcb-toast-in {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes wcb-toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.wcb-toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.wcb-toast-success .wcb-toast-icon {
    color: var(--success);
}

.wcb-toast-error .wcb-toast-icon {
    color: var(--error);
}

.wcb-toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-body);
}

/* ==========================================================================
   My Account - Bookmarks Page
   ========================================================================== */

.wcb-bookmarks-wrapper {
    max-width: 100%;
}

/* Stats Row */
.wcb-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.wcb-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-m);
}

.wcb-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-m);
}

.wcb-stat-icon img,
.wcb-stat-icon svg {
    width: 24px;
    height: 24px;
}

.wcb-stat-icon-bookmark {
    background-color: var(--primary-l-3);
}

.wcb-stat-icon-bookmark img {
    filter: invert(35%) sepia(92%) saturate(2065%) hue-rotate(205deg) brightness(96%) contrast(96%);
}

.wcb-stat-icon-page {
    background-color: #fef3c7;
    color: #f59e0b;
}

.wcb-stat-content {
    display: flex;
    flex-direction: column;
}

.wcb-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-body);
    line-height: 1.2;
}

.wcb-stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Table Container */
.wcb-table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-m);
    overflow: hidden;
}

/* Table Header */
.wcb-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-s);
}

.wcb-table-header.account-header {
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.wcb-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wcb-header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wcb-table-title {
    font-size: 1.8em;
    color: var(--text-body);
    line-height: 1.2;
}

.wcb-title-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-10);
    flex-shrink: 0;
}

.wcb-title-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 2;
}

.wcb-header-description {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    opacity: 0.9;
}

.wcb-header-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--bg-card-2);
    border-radius: 14px;
    padding: var(--space-xs);
    text-align: center;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-primary);
}

.wcb-table-count {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    padding: 0;
}

.wcb-count-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

/* Empty State */
.wcb-empty-state {
    padding: 60px 20px;
    text-align: center;
}

.wcb-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    background-color: var(--primary-10);
    border-radius: 50%;
}

.wcb-empty-icon svg {
    width: 40px;
    height: 40px;
    stroke: var(--primary);
}

.wcb-empty-message {
    margin: 0 0 20px;
    font-size: 16px;
    color: var(--text-muted);
}

/* Pill Button Style */
.btn-pill {
    border-radius: 50px;
}

/* Bookmarks Table */
.wcb-bookmarks-table {
    width: 100%;
    border-collapse: collapse;
}

.wcb-bookmarks-table thead {
    background: var(--bg-body);
}

.wcb-bookmarks-table thead th {
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background-color: var(--bg-card-alt);
    border-bottom: 1px solid var(--border-primary);
    text-align: left;
}

.wcb-bookmarks-table thead th.wcb-col-actions {
    text-align: center;
}

.wcb-bookmarks-table tbody td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-body);
    border-bottom: 1px solid var(--border-primary);
    vertical-align: middle;
}

.wcb-bookmarks-table tbody tr:last-child td {
    border-bottom: none;
}

.wcb-bookmarks-table tbody tr:hover {
    background-color: var(--bg-card-alt);
}

/* Sortable columns */
.wcb-sortable .wcb-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.wcb-sortable .wcb-sort-link:hover {
    color: var(--primary);
}

.wcb-sort-icon::after {
    content: '↕';
    font-size: 10px;
    opacity: 0.5;
}

.wcb-sorted-asc .wcb-sort-icon::after {
    content: '↓';
    opacity: 1;
}

.wcb-sorted-desc .wcb-sort-icon::after {
    content: '↑';
    opacity: 1;
}

/* Product link */
.wcb-col-product_name a {
    color: var(--text-body);
    text-decoration: none;
    font-weight: 500;
}

.wcb-col-product_name a:hover {
    color: var(--primary);
}

/* Actions column */
.wcb-col-actions {
    text-align: center;
}

.wcb-actions-wrapper {
    display: inline-flex;
    gap: 8px;
    justify-content: center;
}

.wcb-action-btn img {
    width: 18px;
    height: 18px;
}

.wcb-action-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: 0.2s;
    text-decoration: none;
    border: 1px solid var(--border-primary);
    box-shadow: 2px 2px var(--shadow-primary);

}


a.wcb-action-btn.wcb-action-view svg,
button.wcb-action-btn.wcb-action-remove svg {
    width: 16px !important;
    height: 16px !important;
    stroke: currentColor !important;
    fill: none !important;
    flex-shrink: 0 !important;
}


.wcb-action-view {
    color: rgb(59, 130, 246);
    background: rgba(59, 130, 246, 0.1);
}

.wcb-action-view:hover,
.wcb-action-remove:hover {
    box-shadow: none;
}

.wcb-action-remove {
    background-color: #fef2f2;
    color: var(--error);
}


/* Row removal animation */
.wcb-bookmark-row.wcb-removing {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.3s ease;
}

/* Pagination */
.wcb-pagination {
    padding: 16px 20px;
    border-top: 1px solid var(--border-primary);
}

.wcb-pagination-list {
    display: flex;
    gap: 8px;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wcb-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-body);
    background-color: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-s);
    text-decoration: none;
    transition: all var(--wcb-transition);
}

.wcb-page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.wcb-page-current {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.wcb-page-prev,
.wcb-page-next {
    font-weight: 500;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (max-width: 768px) {
    .wcb-table-header.account-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .wcb-header-left {
        align-items: center;
    }

    .wcb-header-count {
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .wcb-stats-row {
        grid-template-columns: 1fr;
    }

    .wcb-bookmarks-table {
        display: block;
    }

    .wcb-bookmarks-table thead {
        display: none;
    }

    .wcb-bookmarks-table tbody {
        display: block;
    }

    .wcb-bookmarks-table tbody tr {
        display: block;
        padding: 16px;
        margin-bottom: 12px;
        border: 1px solid var(--border-primary);
        border-radius: var(--radius-m);
    }

    .wcb-bookmarks-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: none;
    }

    .wcb-bookmarks-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .wcb-bookmarks-table tbody td.wcb-col-actions {
        justify-content: flex-end;
        padding-top: 12px;
        margin-top: 8px;
        border-top: 1px solid var(--border-primary);
    }

    .wcb-bookmarks-table tbody td.wcb-col-actions::before {
        display: none;
    }

    .wcb-modal-content {
        margin: 20px;
    }

    .wcb-modal-actions {
        flex-direction: column;
    }

    .wcb-toast-container {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
    }

    .wcb-toast {
        min-width: unset;
        max-width: unset;
    }

    .wcb-pagination-list {
        flex-wrap: wrap;
    }
}