/*
 * traffic_common.css
 * Version 1.00 2026-10-13
 * Version 1.01 2026-10-13  Mindre text i tabellen på mobil (13px, 12px på små skärmar)
 *                          i stället för 1.5rem (24px).
 *
 * Gemensam CSS för trafiksok.php och trafiktemp.php (Trafikverkets data).
 * Laddas efter weather_common.css och före trafiksok.css / trafiktemp.css.
 *
 * Borttaget jämfört med tidigare filer:
 * - Generella h1-regler (alla h1 på sidorna styrs nu av .site-title och rubrikrutan).
 * - td { padding: 2px } som aldrig fick effekt.
 * - Dubbel max-width i tooltipen.
 */

/* Innehållsruta */
.traffic-content {
    width: 100%;
    box-sizing: border-box;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 1rem;
}

.my-4 {
    align-items: center;
    justify-content: space-between;
    position: relative; /* Behåll innehållets relativa position */
}

.flex-grow-1 {
    flex-grow: 1;
    text-align: center; /* Centrera texten inom sin div */
}

/* Footer-ruta (fanns tidigare i lumen_min.css) */
.well {
    padding: 10px;
    margin-top: 0;
    margin-bottom: 0;
    background-color: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* ------------------------------------------------------------------
   Tooltips
   ------------------------------------------------------------------ */
i[data-title] {
    position: relative;
    cursor: pointer;
}

i[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    top: -30px; /* Ovanför ikonen */
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

a[data-title] {
    position: relative;
    cursor: pointer;
}

a[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    top: 50px;
    left: 110%; /* Till höger om länken */
    transform: translateY(-50%);
    background-color: #333;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 1000;
    min-width: 150px;
    max-width: 300px;
    text-align: left;
    white-space: pre-wrap; /* Tillåter radbrytning med &#10; */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ------------------------------------------------------------------
   Tabell
   ------------------------------------------------------------------ */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
    font-weight: bold;
}

tbody td {
    text-align: center;
    padding: 10px;
}

/* Förhindra radbrytning i datum/tid */
td[data-datetime] {
    white-space: nowrap;
}

/* Vänsterjustera första kolumnen (Station) */
tbody td:first-child,
thead th:first-child {
    text-align: left;
    padding-left: 15px;
}

/* Mobil: kompakt tabell.
   Tidigare stod font-size: 1.5rem (24px) på th/td, vilket gjorde texten
   STÖRRE på mobil än på datorn. */
@media (max-width: 768px) {
    thead th:nth-child(2), th:nth-child(3),
    tbody td:nth-child(2), td:nth-child(3) {
        width: 7%; /* Smalare kolumner */
    }

    table th,
    table td {
        font-size: 13px;
        line-height: 1.3;
        padding: 4px;
    }

    tbody td:first-child,
    thead th:first-child {
        padding-left: 6px;
    }

    .btn-sm {
        font-size: 0.8rem;
        padding: 5px 10px;
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    table th,
    table td {
        font-size: 12px;
        padding: 3px;
    }

    .btn-sm {
        font-size: 0.8rem;
        padding: 3px 5px;
        white-space: nowrap;
    }
}