/**
 * InGoal Favorites — Styles
 *
 * Heart button, dashboard list, collections, toast feedback.
 * Uses InGoal navy (#31487A) accent color.
 *
 * @package InGoal
 * @since February 2026
 */

/* ================================================================
 *  BOOKMARK BUTTON — Cards (archive overlays)
 * ================================================================ */

.ingoal-favorite-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: transform 0.15s ease, background-color 0.15s ease;
    flex-shrink: 0;
}

.ingoal-favorite-btn:hover {
    background-color: rgba(49, 72, 122, 0.08);
    transform: scale(1.1);
}

.ingoal-favorite-btn:active {
    transform: scale(0.95);
}

/* Loading state */
.ingoal-favorite--loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Bookmark icon — default (outline) */
.ingoal-favorite-icon {
    fill: none;
    stroke: #999;
    stroke-width: 2;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.ingoal-favorite-btn:hover .ingoal-favorite-icon {
    stroke: #31487A;
}

/* Filled state */
.ingoal-favorite-icon--filled {
    fill: #31487A;
    stroke: #31487A;
}

/* Pop animation on toggle */
@keyframes ingoal-bookmark-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.ingoal-favorite--active .ingoal-favorite-icon {
    animation: ingoal-bookmark-pop 0.35s ease;
}

/* ================================================================
 *  FLOATING BOOKMARK — Edge-docked, mid-screen right
 * ================================================================ */

.ingoal-floating-bookmark {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    cursor: pointer;

    display: flex;
    align-items: center;
    gap: 8px;

    /* Navy base */
    background: #0A1628;
    padding: 12px 16px 12px 18px;

    /* Round left side only — right flush to edge */
    border-radius: 24px 0 0 24px;

    /* Gold accent stripe on left */
    border-left: 3px solid #FFD93D;

    /* Shadow casts left */
    box-shadow: -4px 2px 20px rgba(10, 22, 40, 0.3);

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ingoal-floating-bookmark:hover {
    padding-right: 22px;
    box-shadow: -6px 4px 28px rgba(10, 22, 40, 0.4);
}

.ingoal-floating-bookmark:active {
    transform: translateY(-50%) scale(0.97);
}

/* Icon */
.ingoal-floating-bookmark .ingoal-favorite-icon {
    width: 18px;
    height: 18px;
    stroke: #FFD93D;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

/* Label */
.ingoal-floating-bookmark__label {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    transition: color 0.25s ease;
}

/* Saved state */
.ingoal-floating-bookmark--saved {
    border-left-color: #fff;
    background: linear-gradient(135deg, #0A1628 0%, #1a2a4a 100%);
}

.ingoal-floating-bookmark--saved .ingoal-favorite-icon {
    fill: #FFD93D;
    stroke: #FFD93D;
    filter: drop-shadow(0 0 4px rgba(255, 217, 61, 0.4));
}

.ingoal-floating-bookmark--saved .ingoal-floating-bookmark__label {
    color: #FFD93D;
}

/* Pop animation on save */
.ingoal-floating-bookmark--animating .ingoal-favorite-icon {
    animation: ingoal-bookmark-pop 0.4s ease;
}

/* Focus-visible for keyboard a11y */
.ingoal-floating-bookmark:focus-visible {
    outline: 2px solid #FFD93D;
    outline-offset: 2px;
}

/* ================================================================
 *  ARCHIVE CARDS — Heart overlay
 * ================================================================ */

.ingoal-card-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
}

.ingoal-card-favorite .ingoal-favorite-btn {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.ingoal-card-favorite .ingoal-favorite-btn:hover {
    background: rgba(255, 255, 255, 1);
}

/* ================================================================
 *  DASHBOARD — Favorites section
 * ================================================================ */

.ingoal-favorites-section {
    margin-top: 24px;
}

.ingoal-favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.ingoal-favorites-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ingoal-favorites-count {
    background: #31487A;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.ingoal-favorites-actions {
    display: flex;
    gap: 8px;
}

.ingoal-favorites-email-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #ddd;
    color: #31487A;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ingoal-favorites-email-btn:hover {
    border-color: #31487A;
    background: #f8f9fc;
}

.ingoal-favorites-email-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================================
 *  COLLECTIONS NAV
 * ================================================================ */

.ingoal-collections-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.ingoal-collection-tab {
    background: #f4f5f7;
    border: 1px solid transparent;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ingoal-collection-tab:hover {
    background: #ebedf2;
    color: #31487A;
}

.ingoal-collection-tab--active {
    background: #31487A;
    color: #fff;
    border-color: #31487A;
}

.ingoal-collection-tab--active:hover {
    background: #283b65;
    color: #fff;
}

/* Collection create inline form */
.ingoal-collection-create-form {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.ingoal-collection-create-form input {
    flex: 1;
    min-width: 0;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.ingoal-collection-create-form button {
    background: #31487A;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

/* ================================================================
 *  FAVORITES LIST
 * ================================================================ */

.ingoal-favorites-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ingoal-favorites-list--loading {
    opacity: 0.5;
    pointer-events: none;
}

.ingoal-favorites-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ingoal-favorites-item:last-child {
    border-bottom: none;
}

.ingoal-favorites-item__thumb {
    flex-shrink: 0;
    width: 80px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
    display: block;
}

.ingoal-favorites-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ingoal-favorites-item__content {
    flex: 1;
    min-width: 0;
}

.ingoal-favorites-item__title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    text-decoration: none;
    line-height: 1.35;
    margin-bottom: 4px;
}

.ingoal-favorites-item__title:hover {
    color: #31487A;
}

.ingoal-favorites-item__meta {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.4;
}

/* PRO READ badge */
.ingoal-badge--proread {
    display: inline-block;
    background: #31487A;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
}

/* Empty state */
.ingoal-favorites-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.ingoal-favorites-empty p {
    margin: 4px 0;
    font-size: 14px;
}

.ingoal-favorite-icon-inline {
    color: #31487A;
    font-size: 16px;
}

/* ================================================================
 *  COLLECTION PICKER — Move to collection dropdown
 * ================================================================ */

.ingoal-favorites-item__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.ingoal-collection-picker {
    position: relative;
}

.ingoal-collection-picker__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: #999;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ingoal-collection-picker__trigger:hover {
    color: #31487A;
    background-color: rgba(49, 72, 122, 0.08);
}

.ingoal-collection-picker--open .ingoal-collection-picker__trigger {
    color: #31487A;
    background-color: rgba(49, 72, 122, 0.1);
}

.ingoal-collection-picker__dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    max-width: 240px;
    z-index: 50;
    padding: 4px 0;
    max-height: 240px;
    overflow-y: auto;
}

.ingoal-collection-picker--open .ingoal-collection-picker__dropdown {
    display: block;
}

.ingoal-collection-picker__option {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 14px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ingoal-collection-picker__option:hover {
    background-color: #f4f5f7;
}

.ingoal-collection-picker__option--active {
    color: #31487A;
    font-weight: 600;
    background-color: rgba(49, 72, 122, 0.06);
}

.ingoal-collection-picker__option--active::before {
    content: '\2713\0020';
}

/* ================================================================
 *  TOAST NOTIFICATION
 * ================================================================ */

.ingoal-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1a2e;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 99999;
    pointer-events: none;
}

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

.ingoal-toast--error {
    background: #c0392b;
}

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

@media (max-width: 600px) {
    .ingoal-favorites-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ingoal-favorites-item__thumb {
        width: 60px;
        height: 42px;
    }

    .ingoal-favorites-item__title {
        font-size: 14px;
    }

    .ingoal-collections-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .ingoal-collections-nav::-webkit-scrollbar {
        display: none;
    }

    /* Floating bookmark — smaller on mobile */
    .ingoal-floating-bookmark {
        padding: 10px 14px 10px 15px;
    }

    .ingoal-floating-bookmark__label {
        font-size: 12px;
    }

    .ingoal-floating-bookmark .ingoal-favorite-icon {
        width: 16px;
        height: 16px;
    }
}

/* ================================================================
 *  MEMBER NUDGE — Contextual popover for non-logged-in visitors
 * ================================================================ */

.ingoal-member-nudge {
    z-index: 200;
    width: 280px;
    background: #fff;
    border-radius: 12px;
    padding: 20px 20px 16px;
    box-shadow: 0 8px 32px rgba(10, 22, 40, 0.18), 0 2px 8px rgba(10, 22, 40, 0.08);
    border: 1px solid rgba(49, 72, 122, 0.1);

    /* Animate in */
    opacity: 0;
    transform-origin: right center;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* When positioned for floating bookmark, add right-pointing arrow */
.ingoal-member-nudge::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -7px;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #fff;
    border-right: 1px solid rgba(49, 72, 122, 0.1);
    border-top: 1px solid rgba(49, 72, 122, 0.1);
}

.ingoal-member-nudge--visible {
    opacity: 1;
}

/* Close button */
.ingoal-member-nudge__close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}

.ingoal-member-nudge__close:hover {
    color: #333;
}

/* Text */
.ingoal-member-nudge__text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin: 0 0 12px;
    padding-right: 16px; /* room for close button */
}

/* Subscribe link */
.ingoal-member-nudge__link {
    display: inline-block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #31487A;
    text-decoration: none;
    transition: color 0.15s ease;
}

.ingoal-member-nudge__link:hover {
    color: #0A1628;
    text-decoration: underline;
}

/* Mobile: wider nudge, position adjustments */
@media (max-width: 600px) {
    .ingoal-member-nudge {
        width: calc(100vw - 80px);
        max-width: 300px;
    }
}
