/* ==========================================================================
   MailAI Inbox Business Award - Master Stylesheet
   ========================================================================== */

/* ── 1. Modern CSS Reset & Variables ── */
:root {
    --primary-dark: #0f172a;
    --primary-blue: #2563eb;
    --primary-green: #22c55e;
    --primary-red: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
    --gold: #fbbf24;
    --silver: #cbd5e1;
    --bronze: #b45309;
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.02);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
}

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

body {
    background: var(--bg-color);
    font-family: var(--font-stack);
    color: var(--text-main);
    margin: 0;
}

/* ── 2. General Layout ── */
.bfc-page { padding-bottom: 80px; }
.bfc-wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* ── 3. Premium Hero Banner ── */
.bfc-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1e1b4b 100%);
    border-radius: 0 0 24px 24px;
    padding: 60px 20px 100px;
    text-align: center;
    color: white;
    margin-bottom: -110px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}
.bfc-hero h1 {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}
.bfc-hero p { color: #94a3b8; font-size: 16px; margin: 0; }

/* Kept for the LIVE badge pulse animation in the leaderboard */
@keyframes gentlePulse {
    0%   { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* ── 4. Wall of Fame 2-Row Screenshot Layout (Top 3 / Bottom 7) ── */
.fame-pyramid {
    max-width: 1000px;
    margin: 0 auto 40px;
    display: flex;
    flex-direction: column;
    gap: 25px; /* Spacing between Row 1 and Row 2 */
    position: relative;
    z-index: 10;
}

/* Row 1: The Podium */
.fame-tier.tier-top {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Aligns bottoms so 1st place stands taller */
    gap: 20px;
}

/* Visual Podium Ordering (2nd - 1st - 3rd) */
.fame-tier.tier-top .fame-item:nth-child(1) { order: 2; z-index: 3; transform: scale(1.1); margin: 0 15px; }
.fame-tier.tier-top .fame-item:nth-child(2) { order: 1; z-index: 2; }
.fame-tier.tier-top .fame-item:nth-child(3) { order: 3; z-index: 2; }

/* 1st Place Hover adjustment due to base scale */
.fame-tier.tier-top .fame-item:nth-child(1):hover:not(.empty-state) {
    transform: scale(1.15) translateY(-5px);
}

/* Row 2: Ranks 4-10 */
.fame-tier.tier-bottom {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Base Card Styling */
.fame-item {
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: 14px;
    padding: 16px 10px 12px;
    text-align: center;
    width: 180px; /* Slightly slimmer base width */
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.fame-item:hover:not(.empty-state) {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-blue);
}
.fame-item.empty-state { opacity: 0.6; pointer-events: none; }

/* The Number Badge */
.fame-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #f1f5f9;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    white-space: nowrap;
    z-index: 2;
}

/* 1st Place Highlight */
.fame-item.rank-1 {
    border-color: var(--gold);
    border-width: 3px;
    background: linear-gradient(to bottom, #fff, #fffbeb);
}
.fame-item.rank-1 .fame-badge {
    background: linear-gradient(135deg, #fde047, #d97706);
    color: white;
    border: none;
    font-size: 14px;
    padding: 4px 16px;
}

/* Avatars & Names (Top 3) */
.fame-item .podium-avatar img,
.fame-item .avatar-wrapper {
    width: 65px;
    height: 65px;
    border: 2px solid #f1f5f9;
    border-radius: 50%;
    object-fit: cover;
    margin: 6px auto 0;
    display: block;
}
.fame-item.rank-1 .podium-avatar img,
.fame-item.rank-1 .avatar-wrapper {
    border-color: var(--gold);
    border-width: 3px;
}
.fame-item .podium-name {
    font-size: 14px;
    font-weight: 800;
    margin-top: 10px;
    color: var(--text-main);
    display: block !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── COMPACT RUNNER-UP CARDS (Row 2: Ranks 4-10) ── */
.fame-item.runner-up {
    width: 125px; /* Narrower width so 7 fit in a row */
    padding: 14px 6px 10px;
    border-radius: 12px;
}
.fame-item.runner-up .fame-badge {
    font-size: 10px;
    padding: 3px 8px;
    top: -10px;
}
.fame-item.runner-up .podium-avatar img,
.fame-item.runner-up .avatar-wrapper {
    width: 48px;
    height: 48px;
    margin: 4px auto 0;
    border-width: 2px;
}
.fame-item.runner-up .podium-name {
    font-size: 11px;
    margin-top: 8px;
}

/* Responsive Adjustments */
@media (max-width: 950px) {
    /* Break 7-row on smaller tablets */
    .fame-item.runner-up { width: calc(25% - 12px); }
}
@media (max-width: 768px) {
    /* Stack podium on mobile */
    .fame-tier.tier-top { align-items: center; flex-direction: column; }
    .fame-tier.tier-top .fame-item:nth-child(1) { order: 1; transform: scale(1.05); margin: 0; }
    .fame-tier.tier-top .fame-item:nth-child(2) { order: 2; }
    .fame-tier.tier-top .fame-item:nth-child(3) { order: 3; }
    
    .fame-item { width: calc(50% - 10px); }
    .fame-item.runner-up { width: calc(33.33% - 10px); }
}
@media (max-width: 480px) {
    .fame-item.runner-up { width: calc(50% - 10px); }
}

/* ── 5. Leaderboard Table & Controls ── */
.pts-masked {
    display: inline-block;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 3px;
    background: #f1f5f9;
    padding: 3px 12px;
    border-radius: 6px;
    border: 1px dashed var(--border-light);
    cursor: default;
}
.table-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}
.search-box { position: relative; width: 300px; }
.search-box input {
    width: 100%; padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-light); border-radius: 8px;
    font-size: 14px; outline: none; transition: all 0.2s;
}
.search-box input:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.table-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
}
table.bfc-table { width: 100%; border-collapse: collapse; text-align: left; }
table.bfc-table th {
    background: #f8fafc; padding: 18px 20px; font-size: 13px;
    text-transform: uppercase; color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}
table.bfc-table td { padding: 14px 20px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
table.bfc-table tr:hover td { background: #f1f5f9; }
table.bfc-table tr:last-child td { border-bottom: none; }

.rank-badge-sm {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 8px;
    font-size: 13px; font-weight: 700;
    background: #f1f5f9; color: var(--text-muted);
}
.rank-badge-sm.top { background: #fef9c3; color: #92400e; }
.brand-cell { display: flex; align-items: center; gap: 16px; font-weight: 600; }
.pts-cell { font-weight: 700; color: var(--primary-blue); font-size: 16px; }
.table-title { font-size: 20px; font-weight: 800; color: var(--text-main); margin: 0; }

.avatar-wrapper {
    border-radius: 50%;
    overflow: hidden;
    background: #f1f5f9;
    flex-shrink: 0;
    border: 1px solid var(--border-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.avatar-wrapper img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    min-height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    flex-shrink: 0;
}

.empty-state { color: #cbd5e1 !important; font-weight: 400; }

/* ── Pagination Controls ── */
.bfc-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    margin-top: 15px;
}
.pag-info { font-size: 14px; color: var(--text-muted); }
.pag-info b { color: var(--text-main); }
.pag-btns { display: flex; gap: 8px; }
.pag-btns button {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s;
}
.pag-btns button:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; }
.pag-btns button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 6. Clean FAQ Accordion ── */
.bfc-faq { margin-top: 60px; }
.faq-list { background: var(--card-bg); border-radius: 16px; border: 1px solid var(--border-light); overflow: hidden; }
.faq-q {
    width: 100%; text-align: left; background: none; border: none;
    padding: 20px; font-size: 15px; font-weight: 600; color: var(--text-main);
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    transition: background 0.2s;
}
.faq-q:hover, .faq-q[aria-expanded="true"] { background: #f8fafc; }
.faq-q svg { transition: transform 0.3s ease; color: var(--text-muted); }
.faq-q[aria-expanded="true"] svg { transform: rotate(180deg); }
.faq-a { display: none; padding: 0 20px 20px; font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.faq-a.open { display: block; }