﻿/* ========================================================================
   OPTIMERAD unified-weather-tables.css - RENSAD FRÅN DUPLICERINGAR
   FIXAD IKON-ALIGNMENT FÖR VÄDER-KOLUMN
   ======================================================================== */

/* Grundläggande tabellayout */
.weather-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
}

    /* Header styling */
    .weather-table thead th {
        background-color: #e3f2fd;
        color: #1565c0;
        font-weight: 500;
        font-size: 0.875rem;
        text-transform: none;
        letter-spacing: normal;
        padding: 0.75rem 1rem;
        text-align: left;
        border-bottom: 1px solid #bbdefb;
        vertical-align: middle;
    }

        /* Kolumnjustering - ENDAST EN GÅNG */
        .weather-table thead th:nth-child(1) {
            text-align: left;
            width: 15%;
        }

        .weather-table thead th:nth-child(2) {
            text-align: center;
            width: 15%;
        }

        .weather-table thead th:nth-child(3) {
            text-align: center;
            width: 20%;
        }

        .weather-table thead th:nth-child(4) {
            text-align: center;
            width: 20%;
        }

        .weather-table thead th:nth-child(5) {
            text-align: center;
            width: 30%;
        }

/* Tabellrader */
.forecast-row {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
}

    .forecast-row:hover {
        background-color: #f0f9ff;
        transform: scale(1.01);
        box-shadow: 0 2px 8px rgba(30, 136, 229, 0.08);
    }

    .forecast-row:last-child {
        border-bottom: none;
    }

    .forecast-row td {
        padding: 0.75rem 1rem;
        vertical-align: middle;
        border-top: none;
        font-size: 0.875rem;
        color: #374151;
        background: transparent !important;
    }

    .forecast-row td:nth-child(5) {
        background: transparent !important;
    }

/* Celljustering */
.weather-table tbody td:nth-child(1) {
    text-align: left;
    font-weight: 500;
    color: #1f2937;
}

.weather-table tbody td:nth-child(2),
.weather-table tbody td:nth-child(3),
.weather-table tbody td:nth-child(4),
.weather-table tbody td:nth-child(5) {
    text-align: center;
}

/* FIXAD VÄDER-CELL MED FAST IKON-POSITION */
.weather-cell {
    display: grid;
    grid-template-columns: 24px 1fr; /* Fast bredd för ikonen, resten för text */
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 140px; /* Begränsa total bredd */
    margin: 0 auto; /* Centrera hela cellen */
}

.weather-icon-small {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
    grid-column: 1; /* Fast position i första kolumnen */
    justify-self: center; /* Centrera ikonen i sin kolumn */
}

.weather-cell span {
    grid-column: 2; /* Text i andra kolumnen */
    text-align: left; /* Text vänsterjusterad */
    white-space: nowrap; /* Förhindra radbrytning */
    overflow: hidden; /* Dölj överflödig text */
    text-overflow: ellipsis; /* Visa ... om texten är för lång */
}

.temperature {
    font-size: 1rem;
    font-weight: 500;
    color: #1f2937;
    text-align: center;
}

.wind-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.wind-direction-icon,
.wind-direction-icon-small {
    width: 20px;
    height: 20px;
    object-fit: contain;
    margin-left: 4px;
    vertical-align: middle;
    display: inline-block;
}

/* Forecast cell - FÖRENKLAD */
.forecast-cell {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    position: relative;
    padding: 0;
    justify-content: center;
    background: transparent !important;
}

.forecast-value {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    min-width: auto;
    max-width: auto;
    justify-self: center;
    transition: all 0.2s ease;
    background: transparent !important;
}

    /* Grundläggande staplar - alla SAMMA storlek, mörkgrå som standard */
    .forecast-value .bar {
        display: block;
        width: 6px;
        height: 20px;
        background-color: #666;
        border-radius: 3px;
        transition: all 0.2s ease;
        border: 1px solid rgba(255, 255, 255, 0.4);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    }

    /* Hover-effekt */
    .forecast-value:hover .bar {
        transform: scaleY(1.1);
    }

    /* Säkerhetsnivå: 80-100% - 4 fyllda gröna staplar */
    .forecast-value.certainty-high .bar {
        background-color: #4CAF50;
    }

    /* Säkerhetsnivå: 60-80% - 3 fyllda blå staplar, 1 mörk */
    .forecast-value.certainty-medium-high .bar-1,
    .forecast-value.certainty-medium-high .bar-2,
    .forecast-value.certainty-medium-high .bar-3 {
        background-color: #2196F3;
    }

    /* Säkerhetsnivå: 40-60% - 2 fyllda orange staplar, 2 mörka */
    .forecast-value.certainty-medium .bar-1,
    .forecast-value.certainty-medium .bar-2 {
        background-color: #FF9800;
    }

    /* Säkerhetsnivå: 0-40% - 1 fylld röd stapel, 3 mörka */
    .forecast-value.certainty-low .bar-1,
    .forecast-value.certainty-very-low .bar-1 {
        background-color: #F44336;
    }

.btn-detail {
    grid-column: 1;
    grid-row: 2;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    color: #1565c0;
    padding: 0.15rem;
    border-radius: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    justify-self: center;
    box-shadow: 0 2px 4px rgba(30, 136, 229, 0.15);
}

    .btn-detail:hover {
        background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
        border-color: #64b5f6;
        color: #0d47a1;
        transform: scale(1.1);
        box-shadow: 0 3px 8px rgba(30, 136, 229, 0.25);
    }

    .btn-detail svg {
        transition: transform 0.2s ease;
    }

.weather-table .weather-circle-button {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: center;
    position: static;
    right: auto;
    top: auto;
    transform: none;
    margin: 0;
}

/* Färgkodning genom staplar - tas bort eftersom vi nu använder .bar-klasser */

/* Gammal percentage och text styling - används inte längre med staplar */

/* Provider detaljer */
.provider-detail {
    background: #f9fafb;
}

.providers-comparison {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin: 0;
    padding: 1rem;
    background-color: #f9fafb;
    gap: 1rem;
    justify-content: center;
}

/* DESKTOP LAYOUT */
@media (min-width: 768px) {
    /* Större weather-cell på desktop */
    .weather-cell {
        grid-template-columns: 28px 1fr; /* Lite större ikon-kolumn på desktop */
        gap: 0.75rem;
        max-width: 160px;
    }

    .weather-icon-small {
        width: 28px;
        height: 28px;
    }

    .weather-cell span {
        font-size: 0.875rem;
    }

    /* Lite större staplar på desktop - ALLA SAMMA STORLEK */
    .forecast-value {
        gap: 5px;
        padding: 0;
    }

    .forecast-value .bar {
        width: 8px;
        height: 24px;
        border-radius: 4px;
    }

    /* Större btn-detail på desktop */
    .btn-detail {
        width: 28px;
        height: 28px;
        border-radius: 10px;
    }

    /* Större weather-circle-button på desktop */
    .weather-circle-button {
        width: 34px;
        height: 34px;
    }

        .weather-circle-button::before {
            width: 18px;
            height: 18px;
        }
}

/* MOBIL LAYOUT - ENDAST EN MEDIA QUERY */
@media (max-width: 767.98px) {
    /* Header anpassning */
    .weather-table thead th {
        font-size: 0.65rem;
        padding: 0.3rem 0.4rem;
    }

        .weather-table thead th:nth-child(5) {
            text-align: left;
            padding-left: 1rem;
            padding-right: 0.2rem;
        }

    .weather-table tbody td:nth-child(5) {
        text-align: left;
    }

    /* Endast ikon på mobil - ingen text */
    .weather-cell {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    .weather-icon-small {
        width: 24px;
        height: 24px;
    }

    /* Dölj vädertext på mobil */
    .weather-cell span {
        display: none;
    }

    /* Grid layout för forecast-cell */
    .forecast-cell {
        display: grid;
        grid-template-columns: auto 28px;
        grid-template-rows: auto auto;
        align-items: start;
        gap: 0.3rem;
        width: 100%;
        padding: 0;
    }

    .forecast-value {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        align-self: center;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: row;
        gap: 3px;
    }

    /* Mindre staplar på mobil - ALLA SAMMA STORLEK */
    .forecast-value .bar {
        width: 5px;
        height: 18px;
        border-radius: 3px;
    }

    .btn-detail {
        grid-column: 1;
        grid-row: 2;
        justify-self: center;
        align-self: start;
        margin: 0.2rem 0 0 0;
        width: 22px;
        height: 22px;
    }

    .weather-circle-button {
        grid-column: 2;
        grid-row: 1 / span 2;
        justify-self: center;
        align-self: center;
        margin: 0;
        width: 22px;
        height: 22px;
    }

    /* Vindcell vertikal på mobil */
    .wind-cell {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        font-size: 0.7rem;
    }

    .wind-direction-icon,
    .wind-direction-icon-small {
        width: 14px;
        height: 14px;
        margin-left: 0;
    }

    .forecast-row td {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .temperature {
        font-size: 0.7rem;
    }
}

/* EXTRA SMÅ SKÄRMAR */
@media (max-width: 576px) {
    .weather-table thead th {
        font-size: 0.6rem;
        padding: 0.25rem 0.3rem;
    }

    /* Ännu mindre weather-cell - endast ikon */
    .weather-cell {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .weather-icon-small {
        width: 20px;
        height: 20px;
    }

    /* Text fortfarande dold på extra små skärmar */
    .weather-cell span {
        display: none;
    }

    .forecast-cell {
        grid-template-columns: auto 24px;
    }

    /* Extra små skärmar - ALLA SAMMA STORLEK */
    .forecast-value {
        gap: 2px;
        padding: 0;
    }

    .forecast-value .bar {
        width: 4px;
        height: 16px;
        border-radius: 2px;
    }

    .btn-detail,
    .weather-circle-button {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 360px) {
    /* Minsta skärmar - endast ikon */
    .weather-cell {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .weather-icon-small {
        width: 18px;
        height: 18px;
    }

    /* Text dold även på minsta skärmar */
    .weather-cell span {
        display: none;
    }

    .forecast-cell {
        grid-template-columns: auto 20px;
    }

    /* Minsta skärmar - ALLA SAMMA STORLEK */
    .forecast-value {
        gap: 2px;
        padding: 0;
    }

    .forecast-value .bar {
        width: 3px;
        height: 14px;
        border-radius: 2px;
    }

    .btn-detail,
    .weather-circle-button {
        width: 18px;
        height: 18px;
    }
}
@media (min-width: 768px) {
    /* Större weather-cell på desktop */
    .weather-cell {
        grid-template-columns: 28px 1fr;
        gap: 0.75rem;
        max-width: 200px; /* Ökat från 160px till 200px */
    }

    .weather-icon-small {
        width: 28px;
        height: 28px;
    }

    .weather-cell span {
        font-size: 0.875rem;
        white-space: normal; /* Ändrat från nowrap till normal för att tillåta radbrytning */
        overflow: visible; /* Ändrat från hidden till visible */
        text-overflow: initial; /* Tar bort ellipsis */
    }
}