/* ========== WATCHLIST BUTTON ========== */

.watchlist-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #10b981; /* Delicate green */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
    margin-right: 4px;
}

.watchlist-btn svg {
    width: 24px;
    height: 24px;
    fill: transparent; /* Top modern design - outline only */
    stroke: currentColor;
    stroke-width: 2.1; /* Increased thickness for rounder corners */
    stroke-linejoin: round; /* Rounded corners */
    stroke-linecap: round; /* Rounded corners */
    transition: transform 0.2s ease, fill 0.2s ease;
}

.watchlist-btn:hover {
    background: rgba(16, 185, 129, 0.08); /* Sophisticated subtle hover */
    color: #059669; /* Slightly darker stroke on hover */
    transform: translateY(-1px);
}

/* ========== WATCHLIST PANEL ========== */

.watchlist-panel {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 320px;
    max-height: 420px;
    overflow: hidden;
    display: flex;
    flex-direction: column;

    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border-radius: 20px;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.1);

    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.97);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    z-index: 200;
}

.watchlist-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.watchlist-panel-header {
    padding: 14px 18px 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #059669;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
    flex-shrink: 0;
}

/* Scrollable list */
.watchlist-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.2) transparent;
}

.watchlist-list::-webkit-scrollbar {
    width: 4px;
}

.watchlist-list::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.25);
    border-radius: 4px;
}

/* ========== WATCHLIST ITEM ========== */

.watchlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    transition: background 0.15s ease;
    cursor: default;
}

.watchlist-item:hover {
    background: rgba(16, 185, 129, 0.06);
}

.watchlist-item-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

.watchlist-item-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.watchlist-item-logo.watchlist-item-logo--dark {
    background: #1a1a1a;
}

body.dark .watchlist-item-logo.watchlist-item-logo--dark {
    background: #2a2a2a;
}

.watchlist-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.watchlist-item-info:hover .watchlist-item-name {
    color: #059669;
    text-decoration: underline;
}

.watchlist-item-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}

.watchlist-item-section {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
}

.watchlist-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.watchlist-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

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

.watchlist-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 24px;
    gap: 10px;
    color: #9ca3af;
    text-align: center;
}

.watchlist-empty svg {
    opacity: 0.35;
}

.watchlist-empty p {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin: 0;
}

.watchlist-empty span {
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.7;
}

/* ========== BOOKMARK BUTTON ON CARDS ========== */

.bookmark-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #d1d5db;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.bookmark-btn svg {
    width: 17px;
    height: 17px;
    fill: transparent;
    stroke: currentColor;
    stroke-width: 1.8;
    transition: fill 0.18s ease, stroke 0.18s ease, stroke-width 0.18s ease;
}

.bookmark-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    transform: scale(1.1);
}

.bookmark-btn.active {
    color: #10b981;
}

.bookmark-btn.active svg {
    fill: transparent;
    stroke: currentColor;
    stroke-width: 2.2; /* Indicating active state with a thicker stroke */
}

/* In list-view, slightly smaller */
.card-list.list-view .bookmark-btn {
    width: 28px;
    height: 28px;
}

/* Bookmark on tool page header */
.bookmark-btn-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #9ca3af; /* Gray when inactive */
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, color 0.15s ease;
    margin-left: -4px; /* Bring star closer to text */
    margin-top: 2px; /* Vertically align visually with the text */
}

.bookmark-btn-large svg {
    width: 24px;
    height: 24px;
    fill: transparent;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linejoin: round; /* Rounded corners */
    stroke-linecap: round; /* Rounded corners */
    transition: fill 0.2s ease, stroke-width 0.2s ease;
}

.bookmark-btn-large:hover {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    transform: translateY(-1px);
}

.bookmark-btn-large.active {
    background: transparent;
    color: #10b981;
}

.bookmark-btn-large.active svg {
    fill: transparent;
    stroke-width: 2.4;
}

/* ========== WATCHLIST WRAPPER (for positioning) ========== */
.watchlist-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

body.dark .watchlist-btn {
    color: #34d399; /* Delicate green for dark mode */
}

body.dark .watchlist-btn svg {
    fill: transparent;
    stroke: currentColor;
}

body.dark .watchlist-btn:hover {
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7; /* Lighter delicate green on hover */
}
body.dark .watchlist-panel {
    background: rgba(16, 21, 18, 0.95);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.08);
}

body.dark .watchlist-panel-header {
    color: #34d399;
    border-bottom-color: rgba(52, 211, 153, 0.08);
}

body.dark .watchlist-item:hover {
    background: rgba(52, 211, 153, 0.06);
}

body.dark .watchlist-item-name {
    color: #e2ebe6;
}

body.dark .watchlist-item-section {
    color: #6b7280;
}

body.dark .watchlist-item-info:hover .watchlist-item-name {
    color: #34d399;
}

body.dark .watchlist-remove {
    color: #6b7280;
}

body.dark .watchlist-remove:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}

body.dark .watchlist-empty {
    color: #6b7280;
}

body.dark .watchlist-empty p {
    color: #9ca3af;
}

body.dark .watchlist-item-logo {
    background: rgba(255, 255, 255, 0.05);
}

body.dark .bookmark-btn {
    color: #374151;
}

body.dark .bookmark-btn:hover {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
}

body.dark .bookmark-btn.active {
    color: #34d399;
}

body.dark .bookmark-btn.active svg {
    fill: transparent;
    stroke: currentColor;
    stroke-width: 2.2;
}

body.dark .bookmark-btn-large {
    background: transparent;
    color: #6b7280; /* Gray when inactive in dark mode */
}

body.dark .bookmark-btn-large:hover {
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7;
}

body.dark .bookmark-btn-large.active {
    background: transparent;
    color: #34d399; /* Green when active in dark mode */
}

body.dark .bookmark-btn-large.active svg {
    fill: transparent;
    stroke-width: 2.4;
}
