/* =========================================
   BFT Public Results Styles
   ========================================= */

/* --- TABS --- */
.bft-tabs {
    overflow: hidden;
    border-bottom: 1px solid #ccc;
    margin-bottom: 20px;
}

.bft-tab-btn {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 16px;
    border-bottom: 3px solid transparent;
}

.bft-tab-btn:hover {
    background-color: #ddd;
}

.bft-tab-btn.active {
    border-bottom: 3px solid #f6c453;
    font-weight: bold;
}

.bft-tab-content {
    display: none;
    animation: fadeEffect 0.5s;
}

/* Nested Tabs (Sectors) */
.bft-nested-tabs {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.bft-nested-tab-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.bft-nested-tab-btn.active {
    border-bottom-color: #333;
    font-weight: bold;
}

@keyframes fadeEffect {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- ROW HIGHLIGHTS --- */
.bft-rank-1 {
    background-color: #fff6cc;
    font-weight: bold;
}

.bft-rank-2 {
    background-color: #f2f2f2;
}

.bft-rank-3 {
    background-color: #fbe4d5;
}

.bft-dq {
    background-color: #ffe6e6;
    color: red;
}

/* --- TABLE STYLES --- */
table.bft-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

table.bft-table th,
table.bft-table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

table.bft-table th {
    background-color: #f4f4f4;
    font-weight: bold;
}

/* --- PUBLIC TABLE (Start List) --- */
table.bft-public-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e1e9f1;
}

table.bft-public-table thead th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    padding: 15px;
    border-bottom: 2px solid #edf2f7;
    text-align: left;
}

table.bft-public-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

/* Reduce Rank Column Width to save space */
table.bft-table th:first-child,
table.bft-table td:first-child {
    width: 60px;
    text-align: center;
    padding-left: 5px;
    padding-right: 5px;
}

/* Ensure 'Biggest Fish' column doesn't wrap awkwardly if possible */
table.bft-table td:last-child {
    white-space: nowrap;
}

/* --- STATS GRID --- */
.bft-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.bft-stat-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bft-stat-card.highlight {
    border-color: #f6c453;
    background: #fffbe6;
}

.bft-stat-label {
    font-size: 0.9em;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.bft-stat-value {
    font-size: 1.6em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.bft-stat-sub {
    font-size: 0.85em;
    color: #888;
}

@keyframes bft-spin {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-90deg);
    }

    50% {
        transform: rotate(-90deg);
    }

    100% {
        transform: rotate(0deg);
    }
}


/* --- ROTATE DEVICE OVERLAY REMOVED (Moved to assets/bft-rotate-overlay.css) --- */

/* Show Overlay only on Portrait Mobile */
@media screen and (max-width: 768px) and (orientation: portrait) {
    #bft-rotate-overlay {
        display: flex !important;
    }

    /* Blur common containers */
    .bft-results-container,
    .bft-analytics-wrapper {
        filter: blur(5px);
        pointer-events: none;
        overflow: hidden;
        height: 100vh;
        /* Prevent scrolling behind */
    }
}

/* --- COMPACT MODE (Landscape Mobile / Tablet) --- */
@media screen and (max-width: 900px) {

    /* Try to widen the container by negating theme padding */
    .bft-results-container {
        width: 100%;
    }

    table.bft-table th,
    table.bft-table td {
        padding: 6px 2px;
        /* Minimal side padding */
        font-size: 13px;
        /* Smaller font */
    }

    /* Force numbers to stay on one line */
    table.bft-table td:nth-child(1),
    /* Rank */
    table.bft-table td:nth-child(3),
    /* Sector/Category */
    table.bft-table td:nth-child(4),
    /* Points/Weight */
    table.bft-table td:nth-child(5),
    /* Weight/BigFish */
    table.bft-table td:last-child

    /* Big Fish */
        {
        white-space: nowrap;
    }

    /* Allow Team Name to wrap if needed */
    table.bft-table td:nth-child(2) {
        white-space: normal;
        min-width: 80px;
        /* Reduced min-width to allow more shrinking */
        line-height: 1.2;
        /* Tighter line height for wrapped names */
    }

    /* Specific optimization for Biggest Fish Table (4 cols: Rank, Team, Cat, Weight) */
    /* Category (3rd col in BF table) - make it small or wrap? */
    #biggest_fish_tab table.bft-table td:nth-child(3) {
        font-size: 0.9em;
        white-space: normal;
        /* Category can wrap */
        max-width: 80px;
    }

    /* Keep Weight (4th col in BF table) inline */
    #biggest_fish_tab table.bft-table td:nth-child(4) {
        white-space: nowrap;
        font-weight: bold;
    }

    /* Reduce Rank Column Width to save space - Global override */
    table.bft-table th:first-child,
    table.bft-table td:first-child {
        width: 30px;
        /* Highly compact */
        padding-left: 2px;
        padding-right: 2px;
        text-align: center;
    }

    table.bft-table td small {
        display: inline-block;
        font-size: 0.8em;
        margin-left: 2px;
    }
}

/* --- MOBILE RESPONSIVE (Card View - Portrait) --- */
/* (This applies when width < 600px AND likely portrait due to overlay logic, 
   but standard card view is good fallback) */
@media screen and (max-width: 600px) {

    /* Hide Table Headers */
    .bft-table thead {
        display: none;
    }

    /* Make table elements block-level */
    .bft-table,
    .bft-table tbody,
    .bft-table tr,
    .bft-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        /* Crucial for padding */
    }

    /* Card styling for Row */
    .bft-table tr {
        margin-bottom: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }

    /* Cell styling */
    .bft-table td {
        text-align: right;
        padding-left: 45%;
        /* Adjusted from 50% for more space */
        padding-right: 15px;
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;

        /* Text Wrapping Fixes */
        word-break: break-word;
        hyphens: auto;
        min-height: 40px;
        /* Ensure height for label */
    }

    .bft-table td:last-child {
        border-bottom: none;
    }

    /* Pseudo-element for Label */
    .bft-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 40%;
        /* Adjusted from 45% */
        text-align: left;
        font-weight: bold;
        color: #555;
        white-space: nowrap;
        /* Keep label on one line generally */
        overflow: hidden;
        text-overflow: ellipsis;
        top: 12px;
        /* Vertically align top */
    }

    /* Tweaks for nested tabs on mobile */
    .bft-nested-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .bft-nested-tab-btn {
        flex: 1 1 auto;
        text-align: center;
        border: 1px solid #eee;
        border-radius: 4px;
        margin-bottom: 5px;
    }

    .bft-nested-tab-btn.active {
        background: #eee;
        border-color: #ccc;
    }

    /* Stats Grid tweaks */
    .bft-stat-value {
        font-size: 1.4em;
        /* Slightly smaller on mobile to fit */
        word-wrap: break-word;
    }
}

/* Extra small devices (portrait phones) */
@media screen and (max-width: 380px) {
    .bft-table td {
        padding-left: 10px;
        padding-top: 35px;
        /* Move content below label */
        text-align: left;
    }

    .bft-table td::before {
        position: absolute;
        top: 8px;
        left: 10px;
        width: 100%;
        text-align: left;
        font-size: 0.85em;
        text-transform: uppercase;
        color: #888;
        border-bottom: none;
    }
}