/* === ZMIENNE KOLORÓW === */
:root {
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-text: #222;
    --color-muted: #555;
    --color-border: #e5e5e5;
    --color-accent: #77b255;
    --color-accent-hover: #66a04a;
    --color-blue: #4f8ef7;
    --color-blue-hover: #3c7de6;
    --shadow-small: 0 2px 6px rgba(0,0,0,0.03);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.06);
}

/* Tryb ciemny */
[data-theme="dark"] {
    --color-bg: #121212;
    --color-surface: #1e1e1e;
    --color-text: #eee;
    --color-muted: #aaa;
    --color-border: #333;
    --shadow-small: 0 2px 6px rgba(0,0,0,0.5);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.6);
}

/* === OGÓLNY STYL === */
body {
    margin: 0;
    font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* === NAGŁÓWEK === */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.logo {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

/* === PRZEŁĄCZNIK TRYBU === */
.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 10px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background: var(--color-surface);
    box-shadow: var(--shadow-small);
}

.row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}
.column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* === KONTAINER GŁÓWNY === */
.container {
    width: 90%;
    height: 90%;
    min-height: 75vh;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* === UKŁAD MAPY I FORMULARZY === */
#map, #crops-text {
    background: var(--color-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-medium);
    padding: 1rem;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

/* Desktop: obok siebie */
@media (min-width: 992px) {
    .container {
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }

    #map {
        flex-grow: 1;
        align-self: stretch;
        min-width: 500px;
        min-height: 500px;
    }

    #crops-text {
        max-width: 450px;
        position: sticky;
        top: 5.5rem; /* uwzględnienie wysokości headera */
    }
}

/* Mobile: jedno pod drugim */
@media (max-width: 991px) {
    #map {
        height: 60vh;
        width: 90%;
    }

    #crops-text {
        width: 100%;
    }

    .logo {
        font-size: 1.0rem;
        font-weight: 600;
        color: var(--color-text);
        text-decoration: none;
    }
}

/* === PRZYCISKI === */
button {
    background-color: var(--color-accent);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.3rem 0;
}

button:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.blue-button {
    background-color: var(--color-blue);
}

.blue-button:hover {
    background-color: var(--color-blue-hover);
}

/* === PANELE FORMULARZY === */
.bordered-div {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    box-shadow: var(--shadow-small);
}

h3, h6 {
    margin-top: 0;
    color: var(--color-text);
}

label {
    display: block;
    margin-top: 0.5rem;
    font-weight: 500;
    color: var(--color-text);
}

input, select {
    width: 80%;
    margin-top: 0.3rem;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    font-size: 1rem;
    background-color: var(--color-bg);
    color: var(--color-text);
    transition: all 0.2s;
}

input[type="checkbox"] {
    /* style dla wszystkich checkboxów */
    width: 10%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(119,178,85,0.2);
}

/* === DODATKOWE === */
#save-result {
    min-height: 1.5rem;
    color: var(--color-muted);
    font-size: 0.95rem;
}

#crops-activities button {
    display: block;
    width: 100%;
}

a {
    text-decoration: none;
}

/* === MENU WARSTW LEAFLET === */
.leaflet-control-layers {
    background-color: var(--color-surface) !important;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow-small) !important;
}

.leaflet-control-layers-list {
    background-color: var(--color-surface) !important;
    color: var(--color-text) !important;
}

.leaflet-control-layers label,
.leaflet-control-layers span {
    color: var(--color-text) !important;
}

/* Dopasowanie hoverów i przełączników */
.leaflet-control-layers input:checked + span {
    color: var(--color-accent) !important;
}

.marker-text {
    color: white;
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 2px 5px;
    border-radius: 3px;
    pointer-events: none; /* Zapobiega interakcjom z tekstem */
}

/* Komunikaty błędów w formularzu */
.error {
    color: #dc3545;            /* klasyczny czerwony bootstrap */
    background-color: #f8d7da; /* delikatne czerwone tło */
    border: 1px solid #f5c6cb; /* obramowanie pasujące do tła */
    padding: 8px 12px;         /* trochę przestrzeni wewnątrz */
    border-radius: 5px;        /* zaokrąglone rogi */
    font-size: 0.875rem;       /* trochę mniejszy tekst */
    margin-top: 5px;           /* odstęp od pola formularza */
    display: inline-block;      /* dopasowuje szerokość do tekstu */
}

.error::before {
    content: "⚠ ";             /* ikona ostrzeżenia przed błędem */
}

a[href] {
    color: #007BFF;           /* niebieski, przyjazny dla oka */
    text-decoration: none;    /* usuwa podkreślenie */
    transition: color 0.3s ease, text-decoration 0.3s ease;
    font-weight: 500;         /* lekko pogrubiony tekst */
}

a[href]:hover {
    color: #0056b3;           /* ciemniejszy niebieski po najechaniu */
    text-decoration: underline;
}

a[href]:focus {
    outline: 2px solid #0056b3; /* dostępność dla klawiatury */
    outline-offset: 2px;
}

.price-old {
    color: red;
    text-decoration: line-through;
    font-weight: bold;
}

th, td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}
