:root {
    --svg-left-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 64 64'><path fill='currentColor' d='M32 2C15.432 2 2 15.432 2 32s13.432 30 30 30s30-13.432 30-30S48.568 2 32 2m17 35.428H30.307V48L15 32l15.307-16v11.143H49z'/></svg>");
    --svg-right-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 64 64'><path fill='currentColor' d='M32 2C15.432 2 2 15.432 2 32s13.432 30 30 30s30-13.432 30-30S48.568 2 32 2m1.693 46V37.428H15V27.143h18.693V16L49 32z'/></svg>");
    --svg-zoom-reset: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 24 24'><g fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'><path d='m21 21l-6-6M3.268 12.043A7.02 7.02 0 0 0 9.902 17a7.01 7.01 0 0 0 7.043-6.131a7 7 0 0 0-5.314-7.672A7.02 7.02 0 0 0 3.39 7.6'/><path d='M3 4v4h4'/></g></svg>");
    --svg-zoom-in: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 24 24'><g fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'><circle cx='11' cy='11' r='8'/><path d='m21 21l-4.35-4.35M11 8v6m-3-3h6'/></g></svg>");
    --svg-zoom-out: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 24 24'><g fill='none'><path d='M15.803 15.803A7.5 7.5 0 1 1 5.197 5.197a7.5 7.5 0 0 1 10.606 10.606'/><path stroke='currentColor' stroke-linecap='square' stroke-width='2' d='M15.803 15.803A7.5 7.5 0 1 1 5.197 5.197a7.5 7.5 0 0 1 10.606 10.606Zm0 0l5.304 5.304M7.5 10.5h6'/></g></svg>");
    --svg-save-icon: url("data:image/svg+xml;utf8,<svg width='800px' height='800px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M18.1716 1C18.702 1 19.2107 1.21071 19.5858 1.58579L22.4142 4.41421C22.7893 4.78929 23 5.29799 23 5.82843V20C23 21.6569 21.6569 23 20 23H4C2.34315 23 1 21.6569 1 20V4C1 2.34315 2.34315 1 4 1H18.1716ZM4 3C3.44772 3 3 3.44772 3 4V20C3 20.5523 3.44772 21 4 21L5 21L5 15C5 13.3431 6.34315 12 8 12L16 12C17.6569 12 19 13.3431 19 15V21H20C20.5523 21 21 20.5523 21 20V6.82843C21 6.29799 20.7893 5.78929 20.4142 5.41421L18.5858 3.58579C18.2107 3.21071 17.702 3 17.1716 3H17V5C17 6.65685 15.6569 8 14 8H10C8.34315 8 7 6.65685 7 5V3H4ZM17 21V15C17 14.4477 16.5523 14 16 14L8 14C7.44772 14 7 14.4477 7 15L7 21L17 21ZM9 3H15V5C15 5.55228 14.5523 6 14 6H10C9.44772 6 9 5.55228 9 5V3Z' fill='currentColor'/></svg>");
}

.reset-content, 
.reset-content * {
    all: revert;
    box-sizing: border-box;
}


.app-body { font-family: Arial, sans-serif; margin: 20px; background-color: #f4f6f9; color: #333; }
.app-container { max-width: 1440px;  width: 100%; margin: auto auto; background: white; padding: 0; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);}
#app .controls { display: flex; gap: 20px; margin-bottom: 20px; background: #007bff; padding: 15px; border-radius: 6px; }
#app .control-group { display: flex; flex-direction: column; gap: 5px; }
#app .refresh-container {align-items: center; display: flex;}
#app .current-location {width: 100%;}
#app select { padding: 8px; font-family: Arial, sans-serif; font-size: 16px; border-radius: 4px; border: 1px solid #0062cc; min-width: 200px; }
#app .location-container { font-size: 16px; color: #333; margin: 10px 0; text-align: center;}
#app .loading { font-size: 18px; color: #666; text-align: center; padding: 40px; }
#app .error { color: red; font-weight: bold; background: #fff3f3; padding: 15px; border-radius: 6px; border: 1px solid #ffe3e3; }
#app .forecast-container {
    overflow-x: auto; 
    /* border-color: black; 
    border-bottom-width: 1px; 
    border-bottom-style: solid; */
}
#app .forecast-item {
    overflow-x: auto; 
    padding-top: 1rem;
}
#app .forecast-container .forecast-item:first-of-type {
    border-top: 2px solid #007bff;
}        
#app .forecast-container .forecast-item:not(:last-child) {
    border-bottom: 2px dotted #007bff;
}
#app .forecast-container h2 {
    margin-bottom: .5rem;
}
#app .location-label {
    color: #f4f6f9
} 

#app .chart-canvas-container {
    max-width: 96%;
    margin: 30px auto;
}
#app .chart-canvas-wraper {
    max-width: 100%;
    position: relative; 
    /* max-height: 25rem;
    height: 25rem; */
    max-height: 450px;
    height: 440px; 
    padding-bottom: 15px;

    overflow: hidden;
} 

/* Panel z przyciskami umieszczony nad wykresem */
#app .chart-controls {
    position: absolute;
    top: 10px;
    /* right: 10px; */
    z-index: 10; /* Dzięki temu przyciski zawsze będą na wierzchu, nad canvas */
    display: flex;
    gap: 5px;

    
    flex-direction: column;
    right: 10px;    
}

/* Przykładowy wygląd przycisków */
/* #app .chart-controls button {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #ccc;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background 0.2s;
} */

#app .chart-canvas {
    max-width: 100%;
    border: 1px solid #f0f0f0; /* Kolor i grubość ramki */
    border-radius: 6px;        /* Opcjonalnie: możesz zaokrąglić rogi wykresu */
    overflow: hidden;

    /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */ /* Opcjonalnie: delikatny cień pod wykresem */
} 

#app .chart-canvas-container .chart-canvas-wraper:not(:last-child) {
    margin-bottom: 2rem;
}

#app h1, h2 {
    padding-left: 1rem;
    padding-right: 1rem;
}

#app p {
    line-height: 1.5;
    text-align: justify;
    padding-left: 1rem;
    padding-right: 1rem;
}

.forecast-item div {
    line-height: 1.5;
    text-align: justify;
    padding-left: 1rem;
    padding-right: 1rem;
}



#app .custom-spinner {

    margin-top: 1rem;
    margin-bottom: 1rem;
    /* Rozmiar spinnera */
    width: 3rem;
    height: 3rem;
    
    /* Grubość i kolory krawędzi (czarne tło z przezroczystością, niebieski pasek postępu) */
    border: 0.25em solid rgba(0, 0, 0, 0.1);
    border-left-color: #007bff;
    
    /* Nadanie kształtu koła */
    border-radius: 50%;
    
    /* Animacja obrotu o płynnym przebiegu (linear) trwająca 0.75 sekundy w nieskończoność */
    animation: spin 0.75s linear infinite;
    
    /* Wyśrodkowanie (opcjonalnie) */
    display: inline-block;
}


/* Główna klasa przycisku (zgodna z Twoimi stylami) */
#app .button {
    --btn-color: #000000;
    color: var(--btn-color);         /* Główny zielony kolor tekstu/ikon */
    border: 2px solid transparent;
    /* padding: 16px 32px; */
    padding: 0;
    text-align: center;
    display: inline-flex;   /* Ułatwia równe pozycjonowanie samej ikony */
    align-items: center;
    justify-content: center;
    text-transform: unset;
    font-weight: normal;


   /* 1. Początkowe tło przycisku - zmieniamy na lekko przezroczyste lub zostawiamy białe/szare */
    background-color: #f8fafc; 
    border-radius: 8px; /* Opcjonalnie: zaokrąglenie rogów dla lepszego wyglądu */
    
    /* 2. Płynne przejście dla koloru, ramki ORAZ tła */
    transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease, transform 0.1s ease;    
    
    /* transition: all 0.4s ease;
    cursor: pointer;
    background-color: #f0f0f0; /* Przykładowe tło przycisku */
}

/* Klasa bazowa dla wszystkich masek SVG (Silnik ikon) */
#app .btn-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    background-color: currentColor; /* Magia: ikona automatycznie przyjmuje kolor właściwości 'color' z .button! */
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: background-color 0.4s ease;
}

/* --- SEKCJA PRZYPISYWANIA IKON --- */
/* Wskazujesz tylko, która zmienna tekstowa odpowiada za dany kształt */
#app .icon-left-arrow {
    -webkit-mask-image: var(--svg-left-arrow);
    mask-image: var(--svg-left-arrow);
}
#app .icon-right-arrow {
    -webkit-mask-image: var(--svg-right-arrow);
    mask-image: var(--svg-right-arrow);
}
#app .icon-zoom-reset {
    -webkit-mask-image: var(--svg-zoom-reset);
    mask-image: var(--svg-zoom-reset);
}
#app .icon-zoom-in {
    -webkit-mask-image: var(--svg-zoom-in);
    mask-image: var(--svg-zoom-in);
}
#app .icon-zoom-out {
    -webkit-mask-image: var(--svg-zoom-out);
    mask-image: var(--svg-zoom-out);
}
#app .icon-save {
    -webkit-mask-image: var(--svg-save-icon);
    mask-image: var(--svg-save-icon);
}

/* --- STANY HOVER ORAZ DISABLED (Zarządzanie kolorem) --- */

/* Efekt najechania myszką (np. ciemniejszy zielony lub inny kolor) */
#app .button:hover:not(:disabled) {
    color: color-mix(in srgb, var(--btn-color) 70%, white);
    border-color: currentColor; 
    
    /* MAGIA: Tworzymy delikatne tło (bierzemy 10% koloru przycisku i 90% przezroczystości) */
    background-color: color-mix(in srgb, var(--btn-color) 10%, transparent);
}

/* --- EFEKT ACTIVE (Kliknięcie przycisku) --- */
#app .button:active:not(:disabled) {
    /* Sprawiamy, że na ułamek sekundy tło staje się nieco mocniejsze (20% krycia) */
    background-color: color-mix(in srgb, var(--btn-color) 20%, transparent);
    
    /* OPCJONALNIE: Delikatne fizyczne "wciśnięcie" przycisku o 2 piksele w dół */
    transform: translateY(2px);
    
    /* Szybkie przejście dla kliknięcia, żeby reakcja była natychmiastowa */
    transition: all 0.05s ease; 
}

/* Stan nieaktywny (Disabled) - np. szary kolor dla tekstu i ikony jednocześnie */
#app .button:disabled {
   color: #9ca3af; 
    border-color: transparent;
    background-color: #f3f4f6;
    cursor: auto;
    opacity: 0.6;
    transform: none; /* Blokujemy wciskanie, gdy przycisk jest nieaktywny */
}

#app .btn-green {
    --btn-color: #20A020;
}

#app .btn-blue {
    --btn-color: #0066cc;
}

#app .btn-red {
    --btn-color: #e11d48;
}

#app .btn-indigo {
    --btn-color: #7740ff;
}

/* Definicja animacji obrotu */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* --- BAZOWY KONTENER --- */
.has-tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

/* --- DOMYŚLNY DYMEK (GÓRA) --- */
.has-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background-color: #2d3748;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: sans-serif;
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

/* --- DOMYŚLNA STRZAŁKA (GÓRA) --- */
.has-tooltip::before {
    content: "";
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    margin-bottom: -6px;
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #2d3748 transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

/* --- EFEKT HOVER (DLA DOMYŚLNEGO) --- */
.has-tooltip:not(.tooltip-left):hover::after,
.has-tooltip:not(.tooltip-left):hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}


/* MODYFIKATOR: Jeśli brakuje miejsca na górze, dodajesz tę klasę w HTML */
.has-tooltip.tooltip-bottom::after {
    bottom: auto;
    top: 125%; /* Przenosi dymek pod ikonę */
}

/* ========================================================
   NOWOŚĆ: MODYFIKATOR DLA DYMKA PO LEWEJ STRONIE (.tooltip-left)
   ======================================================== */

/* Reset góry i ustawienie dymka po lewej stronie ikony */
.has-tooltip.tooltip-left::after {
    bottom: auto;
    left: auto;
    top: 50%;        /* Środek wysokości ikony */
    right: 125%;     /* Odsunięcie w lewo od prawej krawędzi ikony */
    transform: translateY(-50%) scale(0.9); /* Centrowanie w pionie i zmniejszenie do animacji */
}

/* Reset góry i przebudowa trójkąta (teraz musi wskazywać w prawo) */
.has-tooltip.tooltip-left::before {
    bottom: auto;
    left: auto;
    top: 50%;
    right: 125%;
    transform: translateY(-50%) scale(0.9);
    margin-bottom: 0;
    margin-right: -6px; /* Wciśnięcie strzałki lekko pod dymek z prawej strony */
    
    /* Nowy kształt trójkąta wskazujący w prawo */
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #2d3748; /* Kolor z lewej strony */
}

/* Efekt Hover dla wersji po lewej stronie */
.has-tooltip.tooltip-left:hover::after,
.has-tooltip.tooltip-left:hover::before {
    opacity: 1;
    transform: translateY(-50%) scale(1); /* Płynne pokazanie z zachowaniem centrowania w pionie */
}


.chart-canvas {
    /* Pozwala przeglądarce przewijać stronę palcem w pionie, 
       a gesty w poziomie zostawia dla wykresu */
    touch-action: pan-y !important; 
}


@media (max-width: 720px) {
    .app-body {
        margin: .3rem;

    }
    .app-container { 
        width: 100%;
        margin: .3rem auto;
        padding: 10px 4px;  
    }    
    #app .chart-canvas-container {
        max-width: 98%;
    }  
    #app .chart-canvas-container .chart-canvas-wraper:not(:last-child) {
        margin-bottom: 1rem;
    }
    #app .pleace {
        display: block;
        width: 100%;
    }
    #app .elevation {
        display: block;
        width: 100%;
    }
    #app .chart-controls {
        flex-direction: column;
        right: 2px;
        top: 50px;
        gap: 15px;
    }
}
@media (max-width: 1024px) {
    #app h1 {
        font-size: 2rem;
    }
    #app h2 {
        font-size: 1.8rem;
    } 
    #app p, div {
        font-size: 1.6rem;
    }  
    #app .chart-controls {
        gap: 15px;
    }     
}

@media (min-width: 720px) and (max-width: 1024px) {
    .app-body {
        margin: .6rem;
    } 
    .app-container { 
        width: 98%;
        margin: .6rem auto; 
        padding: 10px 6px;  
    }   
    #app .chart-canvas-container .chart-canvas-wraper:not(:last-child) {
        margin-bottom: 1.5rem;
    }                   
    #app .controls {
        display: block;
        margin: 0;
        padding-bottom: 1px;
    }
    #app .control-group {
        margin-bottom: 8px;
    }
}
@media (min-width: 1440px) {
    #app .location-container { font-size: 24px; }
    #app .pleace { font-size: 32px; }
}   