/* ==========================================================================
   GM Favorites — Plugin Styles
   Toast · Loading states · Drawer
   ========================================================================== */

/* ---------- Toast ---------- */
.gm-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.gm-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.gm-toast--success { background: #059669; }
.gm-toast--error   { background: #dc2626; }

/* ---------- Loading state ---------- */
.gm-product-card-fav.is-loading,
.gm-fav-remove-btn.is-loading,
.gm-fav-drawer-item-remove.is-loading {
    pointer-events: none;
    opacity: 0.5;
}


/* ==========================================================================
   Favorites Drawer
   ========================================================================== */

/* ---------- Overlay ---------- */
.gm-fav-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.gm-fav-drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Panel ---------- */
.gm-fav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    background: #fff;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
}

.gm-fav-drawer.is-open {
    transform: translateX(0);
}

/* ---------- Header ---------- */
.gm-fav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.gm-fav-drawer-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1f2937;
}

.gm-fav-drawer-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

.gm-fav-drawer-count {
    background: #ef4444;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}

.gm-fav-drawer-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    background: transparent;
    border: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.gm-fav-drawer-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* ---------- Body ---------- */
.gm-fav-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ---------- List ---------- */
.gm-fav-drawer-list {
    padding: 8px 0;
}

.gm-fav-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    transition: background 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
    position: relative;
}

.gm-fav-drawer-item:hover {
    background: #f9fafb;
}

.gm-fav-drawer-item.is-removing {
    opacity: 0;
    transform: translateX(40px);
    pointer-events: none;
}

/* Image */
.gm-fav-drawer-item-img {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.gm-fav-drawer-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Info */
.gm-fav-drawer-item-info {
    flex: 1;
    min-width: 0;
}

.gm-fav-drawer-item-title {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.35;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.gm-fav-drawer-item-title:hover {
    color: #124947;
}

.gm-fav-drawer-item-price {
    font-size: 0.9375rem;
    font-weight: 800;
    color: #1f2937;
    margin-top: 4px;
    letter-spacing: -0.01em;
}

.gm-fav-drawer-item-price span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.gm-fav-drawer-item-na {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
}

/* Remove Button */
.gm-fav-drawer-item-remove {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    cursor: pointer;
    background: transparent;
    border: none;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.gm-fav-drawer-item-remove:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* ---------- Empty State ---------- */
.gm-fav-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    color: #9ca3af;
    height: 100%;
    min-height: 300px;
}

.gm-fav-drawer-empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.gm-fav-drawer-empty p {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 4px;
}

.gm-fav-drawer-empty span {
    font-size: 0.8125rem;
    color: #9ca3af;
}

/* ---------- Footer ---------- */
.gm-fav-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.gm-fav-drawer-view-all {
    display: flex;
    width: 100%;
    justify-content: center;
    text-decoration: none;
}

/* ---------- Skeleton Loading ---------- */
.gm-fav-drawer-loading {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gm-fav-drawer-skeleton {
    height: 72px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: gm-skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes gm-skeleton-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Mobile — full-screen bottom sheet ---------- */
@media (max-width: 767px) {
    .gm-fav-drawer {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 92vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    }

    .gm-fav-drawer.is-open {
        transform: translateY(0);
    }

    /* Drag handle hint */
    .gm-fav-drawer-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 4px;
        background: #d1d5db;
    }

    .gm-fav-drawer-header {
        padding: 24px 16px 14px;
        position: relative;
    }

    .gm-fav-drawer-item-img {
        width: 56px;
        height: 56px;
    }

    .gm-fav-drawer-item {
        padding: 10px 16px;
        gap: 12px;
    }

    .gm-fav-drawer-footer {
        padding: 14px 16px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
}
