/* ============================================================
   TRADER SAFETY — flagranking.css
   Finance-grade UI: Deep navy authority + gold accents
   Google Fonts: Sora (headings) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── CSS Variables ───────────────────────────────────────── */

:root {
    --navy: #0B1437;
    --navy-mid: #132054;
    --navy-soft: #1C2E6B;
    --gold: #C9960C;
    --gold-light: #F5C842;
    --gold-pale: #FEF9E7;
    --accent: #2D6BE4;
    --accent-lt: #EEF4FF;
    --danger: #D93025;
    --danger-lt: #FEF0EF;
    --success: #15803D;
    --success-lt: #F0FDF4;
    --text-main: #0F172A;
    --text-sub: #475569;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --surface: #FFFFFF;
    --bg: #F4F6FB;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 4px rgba(11, 20, 55, .06);
    --shadow-md: 0 4px 20px rgba(11, 20, 55, .10);
    --shadow-lg: 0 12px 40px rgba(11, 20, 55, .14);
    --transition: 0.22s cubic-bezier(.4, 0, .2, 1);
}


/* ── Reset & Base ────────────────────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}


/* ── Width Helpers ───────────────────────────────────────── */

.w-1200 {
    max-width: 1200px;
}

.lg\:w-940 {
    max-width: 940px;
}

.md\:w-760 {
    max-width: 760px;
}

.sm\:w-full {
    max-width: 100%;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}


/* ── Outer Wrapper ───────────────────────────────────────── */

.ranking-list {
    padding: 28px 16px 60px;
    min-height: 100vh;
}


/* ── Info Banner ─────────────────────────────────────────── */

.mb-20.flex.h-36 {
    background: var(--gold-pale) !important;
    border: 1px solid #F0E0A0;
    border-radius: var(--radius-md) !important;
    color: #7A6420 !important;
    font-size: 13px !important;
    height: auto !important;
    padding: 10px 18px !important;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mb-20.flex.h-36::before {
    content: "ℹ";
    font-size: 16px;
    color: var(--gold);
    flex-shrink: 0;
}


/* ── Navigation Tabs ─────────────────────────────────────── */

.tab-box {
    margin-bottom: 6px;
}

.article-tab .tab {
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.article-tab .position {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.article-tab .position .span-link,
.article-tab .position a {
    display: inline-block;
    padding: 10px 20px;
    font-family: 'Sora', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-sub);
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
    white-space: nowrap;
}

.article-tab .position .span-link.active,
.article-tab .position a.active {
    color: var(--navy);
    border-bottom-color: var(--gold);
}

.article-tab .position .span-link:hover,
.article-tab .position a:hover {
    color: var(--navy);
    border-bottom-color: var(--gold-light);
}


/* Alternative tab style (doc 5) */

.tab-box .d-flex a {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 13.5px;
    padding: 8px 16px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: background var(--transition), color var(--transition);
}


/* ── Main Layout ─────────────────────────────────────────── */

.content {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.content-left {
    flex: 1;
    min-width: 0;
}

.content-right {
    width: 272px;
    flex-shrink: 0;
}


/* ── Broker List Box ─────────────────────────────────────── */

.list-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
}


/* ── Broker Card (allrankings / brandranking / popularity) ─ */

.list-box-item,
.broker-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-main);
}

.list-box-item::before,
.broker-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--gold), var(--gold-light));
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.list-box-item:hover,
.broker-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: #C9DCFF;
}

.list-box-item:hover::before,
.broker-card:hover::before {
    opacity: 1;
}


/* Highlighted top card */

.list-box-item.bg-blue-50\/30 {
    background: linear-gradient(135deg, #EEF4FF 0%, #F9FBFF 100%);
    border-color: #BDD3FF;
}


/* ── Broker Logo Box ─────────────────────────────────────── */

.img-box,
.item-left .img-box {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-md);
    border: 1.5px solid #E8EEF6;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(11, 20, 55, .08);
    transition: box-shadow var(--transition);
}

.list-box-item:hover .img-box {
    box-shadow: 0 6px 20px rgba(11, 20, 55, .13);
}

.img-box img {
    object-fit: contain;
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}


/* Regulated tag */

.regulated-tag,
.absolute.bottom-0 {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--success);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    padding: 2px 0;
    letter-spacing: .5px;
    text-transform: uppercase;
}


/* ── Broker Info Text ────────────────────────────────────── */

.text-box {
    flex: 1;
    min-width: 0;
}

.text-box .fw-bold,
.text-box h5,
.text-box .fs-5.fw-bold {
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Flag row */

.flag-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.flag-box img {
    border-radius: 2px;
}


/* Info badges */

.d-flex.flex-wrap.gap-2 .badge,
.d-flex.flex-wrap.gap-2 span {
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 500;
    background: #F1F5F9 !important;
    color: var(--text-sub) !important;
    border: 1px solid var(--border) !important;
    border-radius: 20px;
    padding: 3px 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}


/* ── Score / Wiki Score ──────────────────────────────────── */

.score-box,
.text-2xl.font-bold {
    font-family: 'Sora', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
}

.text-right .text-2xl {
    color: var(--success);
}

.text-\[10px\].text-gray-400 {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-top: 2px;
    font-weight: 500;
}


/* ── Shield / Rank Badge ─────────────────────────────────── */

.shield-badge {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--navy), var(--navy-soft));
    color: #fff;
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(11, 20, 55, .3);
}


/* Top 3 ranks */

.list-box>*:nth-child(1) .shield-badge {
    background: linear-gradient(135deg, #C9960C, #F5C842);
}

.list-box>*:nth-child(2) .shield-badge {
    background: linear-gradient(135deg, #8E9BAE, #C5CED9);
}

.list-box>*:nth-child(3) .shield-badge {
    background: linear-gradient(135deg, #C2773A, #E09B62);
}


/* ── Average Spread (item-right) ─────────────────────────── */

.item-right {
    text-align: right;
    min-width: 100px;
    flex-shrink: 0;
}

.item-right .text-muted.small {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 500;
}

.item-right .fs-5.fw-bold,
.item-right .text-primary {
    font-family: 'Sora', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent) !important;
}


/* ── Flagship Store Pill ─────────────────────────────────── */

.flagship {
    background: linear-gradient(90deg, #FEF9E7, #FFF3C4);
    border: 1px solid #F5C842;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    display: inline-flex;
    align-items: center;
}


/* ── Blacklisted Broker Cards ────────────────────────────── */

.broker-card.row {
    background: var(--surface);
    border: 1px solid #FECACA;
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-bottom: 14px !important;
    transition: box-shadow var(--transition), transform var(--transition);
}

.broker-card.row:hover {
    box-shadow: 0 6px 24px rgba(217, 48, 37, .10);
    transform: translateY(-1px);
}

.broker-card .badge.bg-danger {
    background: var(--danger) !important;
    font-family: 'Sora', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    border-radius: 20px;
    padding: 4px 10px;
}

.broker-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border: 1.5px solid #E8EEF6;
    border-radius: var(--radius-md);
    padding: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(11, 20, 55, .07);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}


/* ── Filter Box (Regulator Chips) ────────────────────────── */

.filter-box-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.filter-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-sub);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
    user-select: none;
}

.filter-box input[type="radio"] {
    display: none;
}

.filter-box:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(45, 107, 228, .12);
}

.filter-box.selected,
.filter-box:has(input:checked) {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
    box-shadow: 0 4px 14px rgba(11, 20, 55, .25);
}


/* ── Right Sidebar ───────────────────────────────────────── */

.content-right .title,
.content-right h4,
.fs-5.fw-bold.mb-3 {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 4px solid var(--gold);
}

.content-right .list-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    gap: 2px;
}

.content-right .list-box a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    transition: background var(--transition), transform var(--transition);
}

.content-right .list-box a:hover {
    background: var(--accent-lt);
    transform: translateX(4px);
}

.content-right .list-box a .com-img {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    border: 1.5px solid #E8EEF6;
    padding: 3px;
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(11, 20, 55, .08);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}


/* ── Pagination ──────────────────────────────────────────── */

.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 32px;
    flex-wrap: wrap;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    background: var(--surface);
    transition: all var(--transition);
}

.page-item .page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-lt);
}

.page-item.active .page-link {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
    box-shadow: 0 4px 12px rgba(11, 20, 55, .3);
}


/* Prev / Next wider buttons */

.page-item:first-child .page-link,
.page-item:last-child .page-link {
    width: auto;
    padding: 0 14px;
}


/* ── Alert ───────────────────────────────────────────────── */

.alert-warning {
    background: var(--gold-pale);
    border: 1px solid #F5C842;
    border-radius: var(--radius-md);
    color: #7A6420;
    padding: 14px 20px;
    font-size: 14px;
}


/* ── "More" Download Link ────────────────────────────────── */

a.more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--navy), var(--navy-soft));
    color: #fff;
    border-radius: var(--radius-md);
    font-family: 'Sora', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    transition: box-shadow var(--transition), transform var(--transition);
}

a.more:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

a.more .iconfont {
    font-size: 14px;
}


/* ── Scroll Ticker ───────────────────────────────────────── */

.wiki_text_scroll {
    overflow: hidden;
}

.text_warp {
    white-space: nowrap;
}


/* ── Dialog ──────────────────────────────────────────────── */

.el-dialog__wrapper {
    position: fixed;
    inset: 0;
    background: rgba(11, 20, 55, .55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.el-dialog {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 520px;
    overflow: hidden;
    animation: dialogSlideIn .25s ease;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.el-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.el-dialog__title {
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.el-dialog__headerbtn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    line-height: 1;
    transition: color var(--transition);
}

.el-dialog__headerbtn:hover {
    color: var(--danger);
}


/* ── Tag Badges (blackranking) ───────────────────────────── */

.tag-badge {
    display: inline-block;
    background: var(--danger-lt);
    color: var(--danger);
    border: 1px solid #FECACA;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    margin: 2px 3px 2px 0;
}


/* ── Loading Skeleton ────────────────────────────────────── */

@keyframes shimmer {
    0% {
        background-position: -800px 0;
    }
    100% {
        background-position: 800px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}


/* ── Page Entry Animation ────────────────────────────────── */

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-box-item,
.broker-card {
    animation: fadeSlideUp .35s ease both;
}

.list-box>*:nth-child(1) {
    animation-delay: .04s;
}

.list-box>*:nth-child(2) {
    animation-delay: .08s;
}

.list-box>*:nth-child(3) {
    animation-delay: .12s;
}

.list-box>*:nth-child(4) {
    animation-delay: .16s;
}

.list-box>*:nth-child(5) {
    animation-delay: .20s;
}

.list-box>*:nth-child(6) {
    animation-delay: .24s;
}

.list-box>*:nth-child(7) {
    animation-delay: .28s;
}

.list-box>*:nth-child(8) {
    animation-delay: .32s;
}

.list-box>*:nth-child(9) {
    animation-delay: .36s;
}

.list-box>*:nth-child(10) {
    animation-delay: .40s;
}


/* ── Utility Helpers ─────────────────────────────────────── */

.sm\:mx-16 {
    margin-left: 0;
    margin-right: 0;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.overflow-hidden {
    overflow: hidden;
}


/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1024px) {
    .content-right {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .ranking-list {
        padding: 16px 12px 48px;
    }
    .content {
        flex-direction: column;
    }
    .content-right {
        width: 100%;
        order: -1;
    }
    .content-right .list-box {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    .list-box-item,
    .broker-card {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }
    .item-right {
        display: none;
    }
    .score-box {
        font-size: 22px;
    }
    .article-tab .position {
        gap: 0;
        overflow-x: auto;
    }
    .article-tab .position .span-link,
    .article-tab .position a {
        padding: 8px 14px;
        font-size: 12.5px;
    }
    .filter-box-container {
        gap: 8px;
    }
    .filter-box {
        padding: 5px 13px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    .img-box {
        width: 76px;
        height: 76px;
    }
    .text-box .fw-bold,
    .text-box h5 {
        font-size: 14.5px;
    }
    .content-right .list-box {
        grid-template-columns: repeat(2, 1fr);
    }
    .pagination {
        gap: 4px;
    }
    .page-item .page-link {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}