/**
 * Zdrowotka Wishlist v2.0 - Frontend styles
 * Brand: #2E7D32 (zielony), #d32f2f (czerwony aktywny), font Inter
 * Mobile: 44px tap targets (iOS HIG compliance)
 */

/* ════════════════════════════════════════════════════
   WISHLIST BUTTON na karcie produktu (archive grid)
   ════════════════════════════════════════════════════ */

/* Karta produktu WC — pozwala absolute pozycjonowanie */
ul.products li.product,
.zd-grid-item { position: relative; }

.zd-wl-btn--loop {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: 1.5px solid #e0e0e0;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}
.zd-wl-btn--loop .zd-wl-icon {
    width: 20px;
    height: 20px;
    color: #999;
    transition: color 0.18s ease, transform 0.18s ease;
}
.zd-wl-btn--loop .zd-wl-btn-label {
    display: none;
}
.zd-wl-btn--loop:hover,
.zd-wl-btn--loop:focus-visible {
    border-color: #2E7D32;
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(46,125,50,0.18);
    outline: none;
}
.zd-wl-btn--loop:hover .zd-wl-icon,
.zd-wl-btn--loop:focus-visible .zd-wl-icon {
    color: #2E7D32;
}
.zd-wl-btn:disabled,
.zd-wl-btn.is-loading {
    opacity: 0.7;
    cursor: wait;
}

/* Stan AKTYWNY (dodane do listy) - czerwone wypełnione */
.zd-wl-btn.is-active {
    border-color: #d32f2f;
    background: #fff;
}
.zd-wl-btn.is-active .zd-wl-icon {
    color: #d32f2f;
}
.zd-wl-btn.is-active .zd-wl-icon path {
    fill: #d32f2f;
    stroke: #d32f2f;
}

/* Animacja kliknięcia */
.zd-wl-btn.is-animating .zd-wl-icon {
    animation: zd-wl-pop 0.4s ease;
}
@keyframes zd-wl-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ════════════════════════════════════════════════════
   WISHLIST BUTTON na stronie produktu (single)
   ════════════════════════════════════════════════════ */

.zd-wl-btn--single {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-top: 12px;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    color: #555;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    min-height: 44px;
}
.zd-wl-btn--single .zd-wl-icon {
    width: 18px;
    height: 18px;
    color: #555;
    transition: color 0.18s;
}
.zd-wl-btn--single:hover,
.zd-wl-btn--single:focus-visible {
    border-color: #2E7D32;
    color: #2E7D32;
    outline: none;
}
.zd-wl-btn--single:hover .zd-wl-icon,
.zd-wl-btn--single:focus-visible .zd-wl-icon {
    color: #2E7D32;
}
.zd-wl-btn--single.is-active {
    border-color: #d32f2f;
    color: #d32f2f;
}
.zd-wl-btn--single.is-active .zd-wl-icon {
    color: #d32f2f;
}
.zd-wl-btn--single.is-active .zd-wl-btn-label[data-label-default] {
    display: none;
}
.zd-wl-btn--single .zd-wl-btn-label[data-label-active] {
    display: none;
}
.zd-wl-btn--single.is-active .zd-wl-btn-label[data-label-active] {
    display: inline;
}

/* ════════════════════════════════════════════════════
   HEADER counter (shortcode [zd_wishlist_header])
   ════════════════════════════════════════════════════ */

.zd-wl-header {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.18s;
}
.zd-wl-header:hover,
.zd-wl-header:focus-visible {
    color: #2E7D32;
    outline: none;
}
.zd-wl-header-icon {
    width: 22px;
    height: 22px;
}
.zd-wl-header-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #d32f2f;
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    border-radius: 9px;
    text-align: center;
}

/* ════════════════════════════════════════════════════
   TOAST notification
   ════════════════════════════════════════════════════ */

.zd-wl-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #2E7D32;
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 600;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    max-width: 90vw;
}
.zd-wl-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.zd-wl-toast--remove { background: #555; }
.zd-wl-toast--info { background: #1565C0; }
.zd-wl-toast--error { background: #c62828; }
.zd-wl-toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════
   STRONA /lista-zyczen/ (shortcode [zd_wishlist])
   ════════════════════════════════════════════════════ */

.zd-wl-page {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 16px;
    font-family: "Inter", sans-serif;
}

/* Toolbar (action buttons + opt-in) */
.zd-wl-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    margin-bottom: 20px;
    background: #f8f8f8;
    border-radius: 12px;
}
.zd-wl-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.zd-wl-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s;
    min-height: 44px;
    font-family: inherit;
}
.zd-wl-action-btn:hover,
.zd-wl-action-btn:focus-visible {
    border-color: #2E7D32;
    color: #2E7D32;
    outline: none;
}
.zd-wl-action-btn--primary {
    background: #2E7D32;
    border-color: #2E7D32;
    color: #fff;
}
.zd-wl-action-btn--primary:hover,
.zd-wl-action-btn--primary:focus-visible {
    background: #1B5E20;
    border-color: #1B5E20;
    color: #fff;
}
.zd-wl-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Opt-in toggle (GDPR) */
.zd-wl-optin {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}
.zd-wl-optin input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2E7D32;
    cursor: pointer;
}
.zd-wl-optin label {
    cursor: pointer;
    user-select: none;
}

/* Empty state */
.zd-wl-page-empty {
    text-align: center;
    padding: 50px 20px;
    background: #fafafa;
    border-radius: 12px;
    color: #666;
}
.zd-wl-page-empty-icon {
    width: 64px;
    height: 64px;
    color: #c0c0c0;
    margin-bottom: 16px;
}
.zd-wl-page-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
}
.zd-wl-page-empty-text {
    font-size: 15px;
    margin: 0 auto 24px;
    max-width: 480px;
    line-height: 1.5;
}
.zd-wl-page-empty-cta {
    display: inline-block;
    padding: 12px 28px;
    background: #2E7D32;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.18s;
    min-height: 44px;
    line-height: 20px;
}
.zd-wl-page-empty-cta:hover { background: #1B5E20; color: #fff; }

/* Empty state suggestions (4 bestsellery) */
.zd-wl-suggestions {
    margin-top: 32px;
}
.zd-wl-suggestions-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    margin: 0 0 16px;
}
.zd-wl-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.zd-wl-suggestion {
    display: flex;
    flex-direction: column;
    padding: 14px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    text-decoration: none;
    color: #1a1a1a;
    transition: box-shadow 0.18s, transform 0.18s;
}
.zd-wl-suggestion:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.zd-wl-suggestion-img {
    aspect-ratio: 1;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.zd-wl-suggestion-img img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
}
.zd-wl-suggestion-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.zd-wl-suggestion-price {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: auto;
}
.zd-wl-suggestion-price ins {
    color: #d97706;
    text-decoration: none;
}
.zd-wl-suggestion-price del {
    color: #999;
    font-size: 12px;
    margin-right: 4px;
    font-weight: 400;
}

/* Loading state */
.zd-wl-loading {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 14px;
}
.zd-wl-loading::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #2E7D32;
    border-radius: 50%;
    animation: zd-wl-spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}
@keyframes zd-wl-spin {
    to { transform: rotate(360deg); }
}

/* Grid items */
.zd-wl-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.zd-wl-item {
    display: flex;
    gap: 16px;
    padding: 14px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    transition: box-shadow 0.18s;
    position: relative;
}
.zd-wl-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.zd-wl-item-img {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border-radius: 8px;
    overflow: hidden;
}
.zd-wl-item-img img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}
.zd-wl-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.zd-wl-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    line-height: 1.35;
}
.zd-wl-item-title:hover { color: #2E7D32; }
.zd-wl-item-meta {
    font-size: 12px;
    color: #888;
}
.zd-wl-item-price {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}
.zd-wl-item-price ins {
    color: #d97706;
    text-decoration: none;
}
.zd-wl-item-price del {
    color: #999;
    font-size: 13px;
    font-weight: 400;
    margin-right: 6px;
}
.zd-wl-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 4px;
    flex-wrap: wrap;
}
.zd-wl-item-atc {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 10px 16px !important;
    background: #2E7D32 !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    border: none !important;
    transition: background 0.18s;
    min-height: 44px;
}
.zd-wl-item-atc:hover { background: #1B5E20 !important; color: #fff !important; }
.zd-wl-item-atc svg { width: 14px; height: 14px; }
.zd-wl-item-unavailable {
    padding: 10px 16px;
    background: #f5f5f5;
    color: #999;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.zd-wl-item-remove {
    margin-left: auto;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1.5px solid #e0e0e0;
    border-radius: 50%;
    color: #999;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
}
.zd-wl-item-remove:hover,
.zd-wl-item-remove:focus-visible {
    border-color: #d32f2f;
    color: #d32f2f;
    outline: none;
}

/* Share dialog */
.zd-wl-share {
    margin-top: 12px;
    padding: 14px;
    background: #f0faf0;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    display: none;
}
.zd-wl-share.is-visible { display: block; }
.zd-wl-share-label {
    font-size: 13px;
    font-weight: 600;
    color: #2E7D32;
    margin: 0 0 8px;
}
.zd-wl-share-input {
    display: flex;
    gap: 8px;
}
.zd-wl-share-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    background: #fff;
    font-family: monospace;
    font-size: 12px;
    color: #555;
}
.zd-wl-share-copy {
    padding: 10px 16px;
    background: #2E7D32;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    font-family: inherit;
}
.zd-wl-share-copy:hover { background: #1B5E20; }

/* Email myself form */
.zd-wl-email-form {
    margin-top: 12px;
    padding: 14px;
    background: #f8f8f8;
    border-radius: 8px;
    display: none;
}
.zd-wl-email-form.is-visible { display: block; }
.zd-wl-email-form-row {
    display: flex;
    gap: 8px;
}
.zd-wl-email-form-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    min-height: 44px;
}
.zd-wl-email-form-row button {
    padding: 10px 18px;
    background: #2E7D32;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    font-family: inherit;
}
.zd-wl-email-form-row button:hover { background: #1B5E20; }

/* Public share view (kontekst: ?key=) */
.zd-wl-public-banner {
    margin-bottom: 20px;
    padding: 14px 18px;
    background: #f0faf0;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    font-size: 14px;
    color: #2E7D32;
}
.zd-wl-public-banner strong { color: #1B5E20; }

/* Desktop grid */
@media (min-width: 768px) {
    .zd-wl-grid {
        grid-template-columns: 1fr 1fr;
    }
    .zd-wl-suggestions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .zd-wl-btn--loop {
        width: 40px;
        height: 40px;
        top: 6px;
        right: 6px;
    }
    .zd-wl-btn--loop .zd-wl-icon {
        width: 18px;
        height: 18px;
    }
    .zd-wl-item-img {
        width: 80px;
        height: 80px;
    }
    .zd-wl-item-title {
        font-size: 14px;
    }
    .zd-wl-item-price {
        font-size: 15px;
    }
    .zd-wl-toast {
        font-size: 13px;
        padding: 10px 16px;
        bottom: 16px;
    }
    .zd-wl-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .zd-wl-toolbar-actions {
        justify-content: stretch;
    }
    .zd-wl-action-btn {
        flex: 1;
        justify-content: center;
    }
}
