/* ============================================
   TRAILS PAGE — Public View Styling
   ============================================ */

/* Status Block */
.gp-trails-status-block {
    display: inline-block;
    padding: 6px 20px;
    background: #eef7ff;
    border: 1px solid #bcd5ff;
    margin-bottom: 16px;
    color: #003366;
    font-size: 0.95rem;
    border-radius: 4px;
}

/* Container */
#trailTable {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 24px auto;
    padding: 0;
    font-size: 0.9rem;
    text-align: center;
}

/* Table */
#trailTable table {
    width: 100%;
    border-collapse: collapse;
}

/* TABLE HEADER */
#trailTable th {
    background-color: #1f4056;
    color: #fff;
    padding: 8px;
}

/* TABLE CELLS */
.trailCell {
    padding: 8px 6px;
    border-bottom: 1px solid #ddd;
}

/* Name always left aligned */
.trail-col-name {
    text-align: left;
}

/* Open highlight */
.trail-open {
    background-color: #d4edda;
}

/* Mobile legend (hidden default) */
#gp-trails-legend {
    display: none;
}

/* =================================================================
   FIX FOR PROD (Astra/UAG forces table header height constraints)
   ================================================================= */
#trailTable th {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    block-size: auto !important;
    line-height: normal !important;
    white-space: normal !important;
}

/* Ensure browser respects our widths */
#trailTable {
    table-layout: auto !important;
}

/* ===========================================================
   MOBILE RESPONSIVE LAYOUT 
   =========================================================== */
@media (max-width: 600px) {

    /* Scrollable table container */
    #trailTable {
        overflow-x: auto;
        display: block;
        white-space: nowrap;
        font-size: 0.8rem;
    }

    /* Force predictable width behavior */
    #trailTable table {
        table-layout: fixed !important;
        min-width: 600px; /* Increase if needed */
    }

    /* Prevent headers and cells from wrapping */
    #trailTable th,
    #trailTable td {
        white-space: nowrap !important;
    }

    /* Status block spacing */
    .gp-trails-status-block {
        margin: 15px 0 20px;
    }

    /* Newline for "Trails Updated:" */
    .gp-trails-updated strong::after {
        content: "\A";
        white-space: pre;
    }

    /* MOBILE LEGEND */
    #gp-trails-legend {
        display: block;
        font-size: 0.8rem;
        margin: 8px 0 10px 0;
        padding: 6px 10px;
        background: #eef7ff;
        border: 1px solid #b0c7db;
        color: #003366;
        border-radius: 4px;
        text-align: center;
    }

    /* Hide Snowmaking + Groomed columns on mobile */
    .trail-col-snowmaking,
    .trail-col-groomed {
        display: none;
    }

    /* ============================================
       MOBILE COLUMN WIDTH MANAGEMENT (PIXEL BASED)
       ============================================ */

    /* Trail Name (emoji included) */
    .trail-col-name {
        width: 45px !important;
        max-width: 45px !important;
        white-space: nowrap;
    }

    /* Day */
    .trail-col-day {
        width: 25px !important;
        max-width: 25px !important;
        font-size: 0.75em;
        position: relative;
        color: transparent; /* hide original text */
    }

    /* Night */
    .trail-col-night {
        width: 25px !important;
        max-width: 25px !important;
        font-size: 0.75em;
        position: relative;
        color: transparent;
    }

    /* Replace text with abbreviation */
    .trail-col-day::after,
    .trail-col-night::after {
        content: attr(data-mobile);
        position: absolute;
        left: 0;
        top: 0;
        color: #003366;
        font-weight: bold;
    }

    /* Surface column */
    .trail-col-surface {
        width: 40px !important;
        max-width: 40px !important;
        white-space: nowrap;
    }

    /* ============================================
       Emoji indicators for Name column
       ============================================ */
    tr.snowmaking-yes .trail-col-name::after {
        content: " ❄️";
    }

    tr.groomed-yes .trail-col-name::after {
        content: " 🧹";
    }

    tr.snowmaking-yes.groomed-yes .trail-col-name::after {
        content: " ❄️🧹";
    }
}
