/**
 * Watchlist page (page-watchlist.php) — light mode.
 */

.cap-watchlist-page {
    min-height: 60vh;
    padding: 3rem 0 4rem;
}


/* Head ------------------------------------------------------------------- */
.wl-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.wl-title {
    font-size: 25px;
    margin: 0;
    color: #0f172a;
}

.wl-add-btn {
    appearance: none;
    border: 1px solid #0167cc;
    background: #fff;
    color: #0167cc;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.wl-head__titles {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wl-subtitle {
    margin: 5px 0 10px;
    font-size: 15px;
    line-height: 1.4;
}

/* Sign-in call to action (header + empty state) -------------------------- */
.wl-signin__link {
    text-decoration: underline;
    color: #0066CC;
    font-weight: 500;
}

/* Guest preview: dim the non-interactive chrome so the sign-in CTA leads -- */
.cap-watchlist--guest .wl-summary,
.cap-watchlist--guest .wl-table-wrap thead{
    opacity: 0.75;
}

/* Locked toolbar (logged-out) */
.wl-toolbar--locked .wl-search {
    display: flex;
    align-items: center;
}

.wl-search__lock {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.wl-toolbar--locked input[type=search].wl-search__input {
    padding-left: 36px;
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

.wl-toolbar--locked .wl-sort__select {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Summary cards ---------------------------------------------------------- */
.wl-summary {
    display: grid;
    grid-template-columns: repeat( 4, 1fr );
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.wl-summary__card {
    background: var(--bb-content-background-color);
    border: 1px solid #e2e8f05c;
    border-radius: 6px;
    padding: 1.3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wl-summary__label {
    font-size: 14px;
    color: #64748b;
    font-weight: 600;
}

.wl-summary__value {
    font-size: 27px;
    font-weight: 500;
    line-height: 1;
    color: #0f172a;
}

.wl-summary__value--up {
    color: #16a34a;
}

.wl-summary__value--down {
    color: #dc2626;
}

.wl-summary__value--muted {
    color: #64748b;
}

/* Toolbar ---------------------------------------------------------------- */
.wl-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.wl-search {
    position: relative;
    flex: 1 1 auto;
}

input[type=search].wl-search__input {
    width: 100%;
    box-sizing: border-box;
    border-radius: 6px;
    background: #fff;
    padding: 12px 15px;
    font-size: 15px;
    color: #0f172a;
}

.wl-search__results {
    list-style: none;
    margin: 4px 0 0;
    padding: 4px;
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0bf;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba( 15, 23, 42, 0.12 );
    max-height: 320px;
    overflow-y: auto;
}

.wl-search__results[hidden] {
    display: none;
}

.wl-search__result {
    display: flex;
    align-items: baseline;
    gap: 8px;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
}

.wl-search__result:hover,
.wl-search__result.is-active {
    background: #f1f5f9;
}

.wl-search__result-name {
    font-weight: 500;
    color: #0f172a;
    font-size: 15px;
}

.wl-search__result-ticker {
    font-size: 12px;
    border-radius: 4px;
    padding: 2px 7px;
    font-weight: 500;
    color: var(--dossier-primary, #2563eb);
    letter-spacing: .07em;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.08) 0%, rgba(0, 163, 224, 0.08) 100%);
}

.wl-search__empty {
    padding: 10px;
    color: #64748b;
    font-size: 14px;
}

.wl-sort__select {
    border-radius: 6px;
    font-size: 14px;
    color: #0f172a;
    cursor: pointer;
    min-width: 150px;
}

/* Table ------------------------------------------------------------------ */
.wl-table-wrap {
    overflow-x: auto;
}

.wl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    border: none;
}

.wl-table thead th {
    color: #525760;
    padding: 14px 16px;
    background: #f6f8fb;
    font-weight: 600;
    font-size: 15px;
    text-align: left;
    white-space: nowrap;
}

.wl-table tbody td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 17px;
}

.wl-table tbody tr:last-child td {
    border-bottom: 1px solid #f1f5f9 !important;
}

.wl-col-price,
.wl-col-iv,
.wl-col-youriv {
    white-space: nowrap;
}

.wl-company__name {
    display: block;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    font-size: 16px;
    line-height: 1.4;
}

.wl-company__name:hover {
    color: #2563eb;
}

.wl-company__meta {
    display: block;
    font-size: 14px;
    color: #94a3b8;
    margin-top: 2px;
}

.wl-col-price,
.wl-iv__value {
    font-weight: 600;
}

.wl-iv__date,
.wl-youriv__note {
    display: block;
    font-size: 13px;
    color: #94a3b8;
}

.wl-youriv__value {
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
}

.wl-youriv__value:hover {
    color: #2563eb;
}

.wl-youriv__set {
    color: #2563eb;
    text-decoration: underline;
}

/* Upside pill */
.wl-upside {
    display: inline-block;
    font-weight: 600;
    font-size: 14px;
    padding: 2px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
}

.wl-upside--up {
    background: #dcfce7ad;
    color: #15803d;
}

.wl-upside--down {
    background: #fee2e2;
    color: #b91c1c;
}

.wl-badge {
    display: inline-block;
    font-size: 14px;
    padding: 2px 12px;
    border-radius: 999px;
    font-weight: 500;
    cursor: help;
}

.wl-badge--high {
    background: #dcfce7;
    color: #15803d;
}

.wl-badge--medium {
    background: #fef3c7c4;
    color: #92400e;
}

.wl-badge--low {
    background: #fee2e2db;
    color: #b91c1c;
}

.wl-badge--none {
    background: #f1f5f9;
    color: #94a3b8;
}

.wl-none {
    color: #94a3b8;
    font-size: 14px;
    line-height: 1;
    cursor: help;
}

.wl-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    color: #94a3b8;
    font-size: 13px;
    cursor: help;
    vertical-align: middle;
}

.wl-help:hover,
.wl-help:focus-visible {
    color: #0066CC;
    outline: none;
}

.wl-help__tip {
    position: absolute;
    top: calc( 100% + 8px );
    right: -8px;
    z-index: 400;
    width: 290px;
    padding: 0.9rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: #1aa1de;
    color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba( 16, 24, 40, 0.24 );
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    text-transform: none;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.14s ease, visibility 0.14s ease;
}

.wl-help:hover .wl-help__tip,
.wl-help:focus .wl-help__tip,
.wl-help:focus-visible .wl-help__tip {
    opacity: 1;
    visibility: visible;
}

.wl-help__lead {
    color: #ffffff;
}

.wl-help__row b {
    color: #fff;
    font-weight: 700;
}

@media ( prefers-reduced-motion: reduce ) {
    .wl-help__tip {
        transition: none;
    }
}

.wl-col-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.wl-actions {
    position: relative;
    display: inline-flex;
}

.wl-actions__toggle {
    appearance: none;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    line-height: 1;
    font-size: 16px;
}

.wl-actions__toggle:hover,
.wl-actions__toggle[aria-expanded="true"] {
    background: #f1f5f9;
    color: #0f172a;
}

.wl-actions__toggle:focus-visible {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}

.wl-actions__menu {
    position: fixed;
    z-index: 600;
    min-width: 210px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba( 16, 24, 40, 0.14 );
    text-align: left;
}

.wl-actions__menu[hidden] {
    display: none;
}

.wl-actions__item {
    appearance: none;
    border: 0;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.wl-actions__item i {
    width: 14px;
    text-align: center;
    color: #64748b;
}

.wl-actions__item:hover,
.wl-actions__item:focus-visible {
    background: #f1f5f9;
    color: #0f172a;
    text-decoration: none;
    outline: none;
}

.wl-actions__item--danger:hover i {
    color: #b91c1c;
}

.wl-actions__item--danger:hover,
.wl-actions__item--danger:focus-visible {
    background: #fef2f2;
    color: #991b1b;
}

.wl-undo {
    position: fixed;
    left: 50%;
    bottom: 1.75rem;
    transform: translate( -50%, 8px );
    z-index: 700;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: calc( 100vw - 2rem );
    padding: 0.8rem 1rem 0.8rem 1.4rem;
    background: #1aa1de;
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba( 16, 24, 40, 0.28 );
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.wl-undo.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate( -50%, 0 );
}

.wl-undo__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wl-undo__btn {
    appearance: none;
    flex: 0 0 auto;
    border: 1px solid #ffffff40;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
}

.wl-undo__btn:hover {
    background: #fff;
    border-color: #fff;
    color: #1aa1de;
}

.wl-undo__btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.wl-undo__close {
    appearance: none;
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 17px;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
}

.wl-undo__close:hover {
    color: #fff;
    background: #ffffff1f;
}

@media ( prefers-reduced-motion: reduce ) {
    .wl-undo {
        transition: none;
    }
}

/* Empty state */
.wl-empty {
    text-align: center;
    color: #64748b;
    padding: 2.5rem 1rem;
}

.wl-empty i {
    font-size: 24px;
    color: #cbd5e1;
    display: block;
    margin-bottom: 0.5rem;
}

.wl-empty p {
    margin: 0;
    font-size: 15px;
}

.wl-disclaimer {
    font-size: 15px;
    color: #525760;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

@media ( max-width: 900px ) {
    .wl-head{
        display: block;
    }
    .wl-summary {
        grid-template-columns: repeat( 2, 1fr );
    }
}

@media ( max-width: 640px ) {
    .wl-add-btn{
        font-size: 12px;
        padding: 4px 10px;
    }
    .wl-title{
        font-size: 22px;
    }
    .wl-summary {
        gap: 5px;
    }
    .wl-summary__card{
        padding: 5px 10px;
        text-align: center;
    }
    .wl-summary__value{
        font-size: 20px;
    }
    .wl-toolbar {
        flex-direction: column;
    }
    .wl-table {
        font-size: 14px;
    }
    .wl-actions__item{
        font-size: 13px;
    }
    .wl-table thead th,
    .wl-table tbody td {
        font-size: 13px;
        padding: 12px 8px;
    }
    .wl-disclaimer,
    .wl-none,
    .wl-company__name{
        font-size: 14px;
        line-height: 1.3;
    }
    .wl-iv__date, .wl-youriv__note,
    .wl-company__meta{
        font-size: 12px;
        line-height: 1.3;
    }
    .wl-badge,
    .wl-upside{
         font-size: 12px;
         padding: 1px 10px;
    }
}
