/* ==========================================================================
   RiftHub - wygląd mapy serwera (squaremap) pod stronę RiftHub
   Plugin kopiuje ten plik do plugins/squaremap/web/rifthub/styl.css i dopina go w index.html
   (webmapa.yml -> wyglad). Własna wersja: webmapa.yml -> wyglad.plik, potem /rh webmapa.
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
    --rh-tlo: #0e0a15;
    --rh-panel: rgba(21, 17, 29, 0.86);
    --rh-panel-pelny: #15111d;
    --rh-panel-gora: #211a2e;
    --rh-ramka: rgba(255, 255, 255, 0.1);
    --rh-ramka-mocna: rgba(167, 139, 250, 0.45);
    --rh-tekst: #fafafa;
    --rh-tekst-2: #a1a1a1;
    --rh-fiolet: #8800ff;
    --rh-fiolet-jasny: #c4b5fd;
    --rh-gradient: linear-gradient(90deg, #a78bfa 0%, #8800ff 50%, #c084fc 100%);
    --rh-najechanie: rgba(136, 0, 255, 0.22);
    --rh-zaokraglenie: 14px;
    --rh-cien: 0 12px 32px rgba(0, 0, 0, 0.5);
    --rh-czcionka: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- tło i czcionka ---------- */
html, body {
    background: var(--rh-tlo);
}

/* squaremap daje mapie tło "nieba" w stylu inline (images/overworld_sky.png) - zamiast niego tło strony */
#map.leaflet-container {
    background:
        radial-gradient(120% 90% at 15% -10%, rgba(124, 58, 237, 0.16) 0%, rgba(0, 0, 0, 0) 55%),
        radial-gradient(90% 80% at 100% 110%, rgba(91, 33, 182, 0.12) 0%, rgba(0, 0, 0, 0) 50%),
        var(--rh-tlo) !important;
}

.leaflet-container {
    font-family: var(--rh-czcionka);
    color: var(--rh-tekst);
}

.leaflet-container a {
    color: var(--rh-fiolet-jasny);
}

::selection {
    background: rgba(136, 0, 255, 0.45);
    color: #fff;
}

/* ---------- panele (zoom, warstwy, link, współrzędne) ---------- */
.leaflet-container .leaflet-bar,
.leaflet-container .leaflet-control-layers,
.leaflet-touch .leaflet-bar,
.leaflet-touch .leaflet-control-layers {
    background: var(--rh-panel);
    border: 1px solid var(--rh-ramka);
    border-radius: var(--rh-zaokraglenie);
    box-shadow: var(--rh-cien);
    color: var(--rh-tekst);
    background-clip: padding-box;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.leaflet-top .leaflet-control {
    margin-top: 12px;
}

.leaflet-left .leaflet-control {
    margin-left: 12px;
}

.leaflet-bottom .leaflet-control {
    margin-bottom: 12px;
}

/* zoom + / - */
.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
    width: 38px;
    height: 38px;
    line-height: 38px;
    background: transparent;
    color: var(--rh-tekst);
    border-bottom: 1px solid var(--rh-ramka);
    transition: background-color 0.2s, color 0.2s;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-touch .leaflet-control-zoom-in,
.leaflet-touch .leaflet-control-zoom-out {
    font: 500 20px/38px var(--rh-czcionka);
    text-indent: 0;
}

.leaflet-bar a:first-child,
.leaflet-touch .leaflet-bar a:first-child {
    border-top-left-radius: 13px;
    border-top-right-radius: 13px;
}

.leaflet-bar a:last-child,
.leaflet-touch .leaflet-bar a:last-child {
    border-bottom: none;
    border-bottom-left-radius: 13px;
    border-bottom-right-radius: 13px;
}

.leaflet-bar a:hover,
.leaflet-bar a:focus {
    background: var(--rh-najechanie);
    color: #fff;
}

.leaflet-bar a.leaflet-disabled,
.leaflet-bar a.leaflet-disabled:hover {
    background: transparent;
    color: rgba(255, 255, 255, 0.25);
}

/* warstwy */
.leaflet-control-layers-toggle,
.leaflet-retina .leaflet-control-layers-toggle,
.leaflet-touch .leaflet-control-layers-toggle {
    width: 38px;
    height: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e9d5ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 8l10 5 10-5-10-5z'/%3E%3Cpath d='m2 12.5 10 5 10-5'/%3E%3Cpath d='m2 17 10 5 10-5'/%3E%3C/svg%3E");
    background-size: 20px 20px;
}

.leaflet-control-layers-expanded {
    padding: 8px 10px;
    color: var(--rh-tekst);
}

.leaflet-control-layers label {
    margin: 1px 0;
    padding: 5px 8px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.leaflet-control-layers label:hover {
    background: rgba(255, 255, 255, 0.06);
}

.leaflet-control-layers label > span {
    display: flex;
    align-items: center;
    gap: 9px;
}

.leaflet-control-layers-selector {
    -webkit-appearance: none;
    appearance: none;
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    top: 0;
    border: 1.5px solid var(--rh-ramka-mocna);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.leaflet-control-layers-selector[type="radio"] {
    border-radius: 50%;
}

.leaflet-control-layers-selector:checked {
    border-color: transparent;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 11px 11px no-repeat,
        linear-gradient(135deg, #a78bfa 0%, #8800ff 100%);
    box-shadow: 0 0 0 3px rgba(136, 0, 255, 0.22);
}

.leaflet-control-layers-selector:focus-visible {
    outline: 2px solid var(--rh-fiolet-jasny);
    outline-offset: 2px;
}

.leaflet-control-layers-separator {
    border-top: 1px solid var(--rh-ramka);
    margin: 6px -2px;
}

/* link do widoku + współrzędne pod kursorem */
.leaflet-control-layers.link {
    overflow: hidden;
    cursor: pointer;
}

div.leaflet-control-layers.link img {
    display: block;
    width: 38px;
    height: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e9d5ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E");
    background-size: 18px 18px;
    transition: background-color 0.2s;
}

div.leaflet-control-layers.link:hover img {
    background-color: var(--rh-najechanie);
}

div.leaflet-control-layers.coordinates {
    box-sizing: border-box;
    height: auto;
    min-height: 38px;
    min-width: 104px;
    margin-left: 8px;
    padding: 6px 12px;
    line-height: 1.35;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--rh-tekst);
}

div.leaflet-control-layers.coordinates::first-line {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rh-fiolet-jasny);
}

/* ---------- dymek po kliknięciu ---------- */
.leaflet-popup-content-wrapper {
    padding: 0;
    background: linear-gradient(180deg, var(--rh-panel-gora) 0%, var(--rh-panel-pelny) 100%);
    color: var(--rh-tekst);
    border: 1px solid var(--rh-ramka);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.leaflet-popup-tip {
    background: var(--rh-panel-pelny);
    border: 1px solid var(--rh-ramka);
    box-shadow: none;
}

.leaflet-popup-content {
    margin: 16px 18px 14px;
    min-width: 220px;
    font: 13px/1.5 var(--rh-czcionka);
}

.leaflet-container a.leaflet-popup-close-button {
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font: 400 20px/26px var(--rh-czcionka);
    color: var(--rh-tekst-2);
    transition: background-color 0.2s, color 0.2s;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

/* dymek państwa (szablon: webmapa.yml -> dymek) */
.rh-panstwo {
    text-align: center;
}

.rh-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.rh-pokoj {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.rh-wojna {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.rh-flaga {
    display: block;
    margin: 12px auto 8px;
    border-radius: 3px;
    image-rendering: pixelated;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.rh-nazwa {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #fff;
}

.rh-tag {
    background: var(--rh-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.rh-wiersze {
    display: grid;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--rh-ramka);
    text-align: left;
}

.rh-wiersz {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.rh-wiersz span {
    color: var(--rh-tekst-2);
}

.rh-wiersz b {
    font-weight: 600;
    color: var(--rh-tekst);
    text-align: right;
}

.rh-lista {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--rh-ramka);
    text-align: left;
    color: var(--rh-tekst);
}

.rh-lista > span {
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rh-fiolet-jasny);
}

.rh-lista-wojna > span {
    color: #f87171;
}

/* ---------- podpowiedzi i plakietki graczy ---------- */
.leaflet-tooltip {
    padding: 6px 10px;
    background: var(--rh-panel-pelny);
    border: 1px solid var(--rh-ramka);
    border-radius: 10px;
    box-shadow: var(--rh-cien);
    font: 600 12px/1.3 var(--rh-czcionka);
    color: var(--rh-tekst);
}

.leaflet-tooltip-top:before {
    border-top-color: var(--rh-panel-pelny);
}

.leaflet-tooltip-bottom:before {
    border-bottom-color: var(--rh-panel-pelny);
}

.leaflet-tooltip-left:before {
    border-left-color: var(--rh-panel-pelny);
}

.leaflet-tooltip-right:before {
    border-right-color: var(--rh-panel-pelny);
}

div.leaflet-nameplate-pane > div {
    padding: 4px 9px 4px 5px;
    background: rgba(14, 10, 21, 0.85);
    border: 1px solid var(--rh-ramka-mocna);
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
    font: 700 12px/1.1 var(--rh-czcionka);
}

img.head {
    border-radius: 3px;
}

/* ---------- panel boczny (światy, gracze) ---------- */
#sidebar {
    font-family: var(--rh-czcionka);
    font-size: 13px;
    background: var(--rh-panel);
    border-left: 1px solid var(--rh-ramka);
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

#sidebar fieldset {
    border-top: 1px solid var(--rh-ramka);
}

#sidebar legend {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rh-fiolet-jasny);
}

#sidebar fieldset a,
#sidebar fieldset a:visited {
    margin: 2px 8px;
    border-radius: 10px;
    color: var(--rh-tekst);
    font-weight: 500;
}

#sidebar fieldset a:hover,
#sidebar fieldset a.following:hover {
    background: var(--rh-najechanie);
}

#sidebar fieldset a.following {
    background: rgba(136, 0, 255, 0.32);
}

#sidebar fieldset#players::-webkit-scrollbar-thumb {
    border-right-color: rgba(167, 139, 250, 0.6);
}

/* ---------- telefon ---------- */
@media (max-width: 640px) {
    .leaflet-top .leaflet-control {
        margin-top: 10px;
    }

    .leaflet-left .leaflet-control {
        margin-left: 10px;
    }

    div.leaflet-control-layers.coordinates {
        min-width: 92px;
        font-size: 12px;
    }
}
