/* MFFAIS — Global Styles */

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a1a;
    background: #fff;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #0b57d0;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Layout ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 32px 0 48px;
}

/* ── Header / Nav ── */
.site-header {
    background: #1a2332;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.site-header .logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1.5px;
    text-decoration: none;
}

.site-header .logo:hover {
    text-decoration: none;
    opacity: 0.9;
}

.site-nav {
    display: flex;
    gap: 24px;
    list-style: none;
}

.site-nav a {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
    color: #fff;
    text-decoration: none;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* ── Footer ── */
.site-footer {
    background: #f5f6f8;
    border-top: 1px solid #e0e0e0;
    padding: 32px 0 24px;
    font-size: 13px;
    color: #555;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.footer-left,
.footer-center,
.footer-right {
    flex: 1;
    min-width: 180px;
}

.footer-center {
    text-align: center;
}

.footer-center a {
    margin: 0 8px;
    color: #555;
    font-size: 13px;
}

.footer-center a:hover {
    color: #0b57d0;
}

.footer-right {
    text-align: right;
}

.footer-disclaimer {
    border-top: 1px solid #e0e0e0;
    padding-top: 16px;
    font-size: 12px;
    color: #777;
    line-height: 1.5;
}

.footer-meta {
    margin-top: 12px;
    font-size: 11px;
    color: #999;
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 48px 0 32px;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #1a2332;
    margin-bottom: 12px;
}

.hero .tagline {
    font-size: 18px;
    color: #555;
    font-style: italic;
    margin-bottom: 8px;
}

.hero .description {
    font-size: 15px;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* ── Stats Bar ── */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin: 24px 0;
}

.stat {
    text-align: center;
}

.stat .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a2332;
}

.stat .stat-label {
    font-size: 13px;
    color: #777;
    margin-top: 2px;
}

/* ── Cards ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafbfc;
}

.card h3 {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.card .metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a2332;
    margin-bottom: 6px;
}

.card .metric-value.positive {
    color: #137333;
}

.card .metric-value.negative {
    color: #c5221f;
}

.card .metric-sub {
    font-size: 13px;
    color: #777;
}

/* ── Featured Rankings ── */
.featured-rankings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 32px 0;
}

.featured-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a2332;
}

/* ── Tables ── */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background: #f5f6f8;
    border-bottom: 2px solid #e0e0e0;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #444;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

thead th:hover {
    background: #ebedf0;
}

thead th.sorted-asc::after {
    content: " \25B2";
    font-size: 10px;
}

thead th.sorted-desc::after {
    content: " \25BC";
    font-size: 10px;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

tbody tr:hover {
    background: #f8f9fa;
}

td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Search / Filter ── */
.filter-bar {
    margin-bottom: 16px;
}

.filter-bar input {
    width: 100%;
    max-width: 360px;
    padding: 10px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.filter-bar input:focus {
    border-color: #0b57d0;
    box-shadow: 0 0 0 2px rgba(11,87,208,0.15);
}

/* ── Calculator Controls ── */
.calc-check {
    margin-right: 4px;
    cursor: pointer;
}

.calc-sign {
    background: #e8eef7;
    border: 1px solid #c0cfe0;
    border-radius: 3px;
    width: 22px;
    height: 22px;
    font-size: 14px;
    font-weight: 700;
    color: #1a56db;
    cursor: pointer;
    padding: 0;
    line-height: 20px;
    text-align: center;
    margin-right: 4px;
}

.calc-sign:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ── Section Headers ── */
.section-header {
    font-size: 20px;
    font-weight: 700;
    color: #1a2332;
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

/* ── Badge ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: #e8eef7;
    color: #1a56db;
}

/* ── Company Page Header ── */
.company-header {
    margin-bottom: 24px;
}

.company-header h1 {
    font-size: 36px;
    font-weight: 800;
    color: #1a2332;
    margin-bottom: 4px;
}

.company-header .company-name {
    font-size: 18px;
    color: #555;
    font-weight: 400;
}

/* ── Company Page Layout (sidebar for ads) ── */
.page-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
}

.page-main {
    min-width: 0;
}

.page-sidebar {
    padding-top: 8px;
}

/* ── Ad Unit — hidden until AdSense is approved ── */
.ad-unit {
    display: none;
}

/* ── Ranking Category Grid ── */
.ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.ranking-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: box-shadow 0.15s;
}

.ranking-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-decoration: none;
}

.ranking-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 6px;
}

.ranking-card p {
    font-size: 13px;
    color: #666;
}

/* ── A-Z Tabs ── */
.az-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
}

.az-tabs a {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    text-decoration: none;
}

.az-tabs a:hover,
.az-tabs a.active {
    background: #1a2332;
    color: #fff;
    border-color: #1a2332;
    text-decoration: none;
}

/* ── Methodology ── */
.formula-box {
    background: #f5f6f8;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px 20px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 15px;
    margin: 16px 0;
}

.xbrl-fields {
    margin: 16px 0;
}

.xbrl-fields dt {
    font-weight: 600;
    color: #444;
    margin-top: 8px;
}

.xbrl-fields dd {
    color: #666;
    font-family: monospace;
    font-size: 13px;
    margin-left: 16px;
}

.methodology-disclaimer {
    margin-top: 32px;
    padding: 16px 20px;
    background: #fef7e0;
    border: 1px solid #f0d98c;
    border-radius: 6px;
    font-size: 13px;
    color: #665;
    line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
    }

    .page-sidebar {
        order: -1;
    }

    .featured-rankings {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .site-nav {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: #1a2332;
        flex-direction: column;
        padding: 16px 24px;
        gap: 12px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    }

    .site-nav.open {
        display: flex;
    }

    .hamburger {
        display: block;
    }

    .hero h1 {
        font-size: 32px;
    }

    .stats-bar {
        gap: 24px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-left,
    .footer-center,
    .footer-right {
        text-align: center;
    }

    .company-header h1 {
        font-size: 28px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 13px;
    }

    thead th, tbody td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .hero h1 {
        font-size: 24px;
        letter-spacing: 2px;
    }

    .stats-bar {
        flex-direction: column;
        gap: 12px;
    }
}
