html {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
}

.main-content{
    padding-top: 64px; /* leave space for fixed navbar */
    overflow-x: hidden;
    max-width: 100%;
}

.btn-custom:hover {
    background: #1f024c;
    color: white;
}
/* Leaflet Map z-index fix - mapa nie może nachodzić na navbar */
.leaflet-container,
.leaflet-pane,
.leaflet-map-pane {
z-index: 1 !important;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
z-index: 20 !important;
}

.leaflet-control {
z-index: 20 !important;
}

/* Popup i tooltip muszą być wyżej od kontrolek, ale niżej od navbara */
.leaflet-popup,
.leaflet-tooltip {
z-index: 25 !important;
}

/* Prevent zoom on input focus (iOS) - minimum 16px font-size */
@media screen and (max-width: 768px) {
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select,
.input,
.select,
.textarea {
font-size: 16px;
}
}

/* Messages Animation */
@keyframes slideInDown {
from {
transform: translateY(-100px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}

/* Django Messages */
.dj-messages-wrap {
position: fixed;
top: 80px;
left: 50%;
transform: translateX(-50%);
z-index: 10100;
width: 90%;
max-width: 640px;
display: flex;
flex-direction: column;
gap: 8px;
pointer-events: none;
}
.dj-alert {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
border-radius: 10px;
border: 1px solid transparent;
box-shadow: 0 4px 24px rgba(0,0,0,.18);
font-size: 14px;
line-height: 1.5;
pointer-events: auto;
animation: dj-slide-in .22s ease;
}
@keyframes dj-slide-in {
from { opacity: 0; transform: translateY(-10px); }
to   { opacity: 1; transform: translateY(0); }
}
.dj-alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.dj-alert-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.dj-alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.dj-alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.dj-alert-text    { flex: 1; }
.dj-alert-close {
background: none;
border: none;
cursor: pointer;
font-size: 18px;
line-height: 1;
padding: 0 2px;
color: inherit;
opacity: .6;
flex-shrink: 0;
}
.dj-alert-close:hover { opacity: 1; }

/* Cookie Consent Popup */
.cookie-consent {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
color: white;
padding: 20px;
box-shadow: 0 -5px 20px rgba(0,0,0,0.3);
z-index: 9999;
animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
from { transform: translateY(100%); }
to { transform: translateY(0); }
}

.cookie-consent-content {
max-width: 1200px;
margin: 0 auto;
display: flex;
align-items: center;
gap: 20px;
flex-wrap: wrap;
}

.cookie-icon {
font-size: 2.5rem;
color: #f39c12;
flex-shrink: 0;
}

.cookie-text {
flex: 1;
min-width: 300px;
}

.cookie-text h4 {
margin: 0 0 10px 0;
font-size: 1.2rem;
color: #ecf0f1;
}

.cookie-text p {
margin: 0;
line-height: 1.5;
color: #bdc3c7;
}

.cookie-text a {
color: #3498db;
text-decoration: underline;
}

.cookie-text a:hover {
color: #5dade2;
}

.cookie-buttons {
display: flex;
gap: 10px;
flex-wrap: wrap;
}

.btn-cookie {
padding: 12px 20px;
border: none;
border-radius: 25px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
font-size: 0.9rem;
display: flex;
align-items: center;
}

.btn-accept {
background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
color: white;
}

.btn-accept:hover {
background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
transform: translateY(-2px);
}

.btn-reject {
background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
color: white;
}

.btn-reject:hover {
background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
transform: translateY(-2px);
}

.btn-customize {
background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
color: white;
}

.btn-customize:hover {
background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
transform: translateY(-2px);
}

/* Cookie Modal */
.cookie-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.7);
z-index: 10000;
display: flex;
align-items: center;
justify-content: center;
animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}

.cookie-modal-content {
background: white;
border-radius: 15px;
max-width: 600px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
box-shadow: 0 15px 35px rgba(0,0,0,0.3);
animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
from { transform: scale(0.9) translateY(-20px); }
to { transform: scale(1) translateY(0); }
}

/* Messages animation */
.message-slide-in {
animation: message-slide-in 0.4s ease-out;
}

@keyframes message-slide-in {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.cookie-modal-header {
padding: 25px 25px 15px 25px;
border-bottom: 1px solid #ecf0f1;
display: flex;
justify-content: space-between;
align-items: center;
}

.cookie-modal-header h3 {
margin: 0;
color: #2c3e50;
font-size: 1.3rem;
}

.close-modal {
background: none;
border: none;
font-size: 2rem;
color: #7f8c8d;
cursor: pointer;
padding: 0;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
}

.close-modal:hover {
color: #e74c3c;
}

.cookie-modal-body {
padding: 20px 25px;
}

.cookie-category {
margin-bottom: 20px;
padding: 15px;
border: 1px solid #ecf0f1;
border-radius: 8px;
}

.cookie-category-header {
display: flex;
align-items: center;
margin-bottom: 10px;
}

.cookie-category-header input[type="checkbox"] {
margin-right: 10px;
transform: scale(1.2);
}

.cookie-category-header label {
font-weight: 600;
color: #2c3e50;
cursor: pointer;
}

.cookie-description {
color: #7f8c8d;
margin: 0;
font-size: 0.9rem;
line-height: 1.4;
}

.cookie-modal-footer {
padding: 15px 25px 25px 25px;
border-top: 1px solid #ecf0f1;
display: flex;
gap: 10px;
justify-content: flex-end;
}

/* Mobile Responsive */
@media (max-width: 768px) {
.cookie-consent-content {
flex-direction: column;
text-align: center;
}

.cookie-text {
min-width: auto;
}

.cookie-buttons {
justify-content: center;
}

.btn-cookie {
padding: 10px 16px;
font-size: 0.8rem;
}

.cookie-modal-content {
width: 95%;
}

.cookie-modal-footer {
flex-direction: column;
}
}

/* Help text w formularzach - mniejszy rozmiar */
.label-text-alt {
font-size: 0.7rem !important;
line-height: 1.3;
}

/* Help text w różnych miejscach */
.help-text,
form .text-xs.text-base-content\/70,
form .text-xs.text-base-content\/60,
.django-form .text-xs {
font-size: 0.7rem !important;
line-height: 1.3;
}

/* Opcjonalnie - lekko jaśniejszy kolor dla lepszej czytelności przy mniejszym tekście */
.label-text-alt,
.help-text {
opacity: 0.85;
}

/* ========================================
   MODAL — generyczny system
   ======================================== */

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal[open] {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: -1;
}
.modal-backdrop button {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    border: none; background: transparent;
    cursor: default; opacity: 0;
}

.modal-box {
    position: relative;
    background: var(--card, #ffffff);
    color: var(--fg, #1f2937);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
    padding: 24px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-action {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}
@media (max-width: 639px) {
    .modal { padding: 8px; }
    .modal-box { padding: 20px; border-radius: 12px; }
    .modal-action { flex-direction: column-reverse; gap: 8px; }
    .modal-action .btn { width: 100%; }
}

/* ========================================
   BTN — kanoniczny system przycisków (BEM --)
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius, 6px);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}
.btn:disabled,
.btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Variants */
.btn--primary {
    background: var(--primary);
    color: var(--primary-fg, #fff);
}
.btn--primary:hover:not(:disabled) { opacity: 0.9; }

.btn--secondary {
    background: var(--secondary);
    color: #fff;
}
.btn--secondary:hover:not(:disabled) { opacity: 0.9; }

.btn--ghost {
    background: transparent;
    color: var(--muted-fg, #6b7280);
    border: 1px solid var(--border, #e5e7eb);
}
.btn--ghost:hover:not(:disabled) {
    background: var(--muted, #f3f4f6);
    color: var(--fg, #1f2937);
}

.btn--danger {
    color: var(--destructive, #dc2626);
    background: transparent;
    border: 1px solid transparent;
}
.btn--danger:hover:not(:disabled) {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.2);
}

.btn--cta-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 700;
}
.btn--cta-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }

.btn--cta-ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,.5);
}
.btn--cta-ghost:hover:not(:disabled) { background: rgba(255,255,255,.1); }

/* Sizes */
.btn--xs  { padding: 3px 8px;   font-size: 11px; }
.btn--sm  { padding: 5px 12px;  font-size: 12px; }
.btn--lg  { padding: 11px 24px; font-size: 15px; }
.btn--xl  { padding: 14px 28px; font-size: 16px; font-weight: 700; }

/* Modifiers */
.btn--full   { width: 100%; justify-content: center; }
.btn--circle { border-radius: 50%; padding: 8px; width: 32px; height: 32px; }
.btn--icon   { padding: 8px; gap: 0; }

@media (max-width: 858px) {
    .btn { padding: 6px 14px; font-size: 13px; }
}


/* ========================================
   ALERT — generyczny
   ======================================== */

.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.1);
}
.alert-success {
    background: rgba(16,185,129,.1);
    border: 1px solid rgba(16,185,129,.3);
    color: #065f46;
}
.alert-error {
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.3);
    color: #991b1b;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.loading-spinner.loading-sm { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   FORM CONTROL — generyczny
   ======================================== */

.form-control { display: flex; flex-direction: column; }
.form-control label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--fg, #1f2937);
}
.form-control select,
.form-control textarea,
.form-control input[type="text"],
.form-control input[type="search"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg, #ffffff);
    color: var(--fg, #1f2937);
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.form-control select:focus,
.form-control textarea:focus,
.form-control input:focus {
    outline: none;
    border-color: var(--primary, #0d9488);
    box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.u-flex        { display: flex; }
.u-flex-col    { flex-direction: column; }
.u-items-center { align-items: center; }
.u-gap-2       { gap: 8px; }
.u-gap-3       { gap: 12px; }
.u-mb-2        { margin-bottom: 8px; }
.u-mb-6        { margin-bottom: 24px; }
.u-mt-6        { margin-top: 24px; }
.u-w-full      { width: 100%; }
.u-font-bold   { font-weight: 700; }
.u-font-semi   { font-weight: 600; }

@media (max-width: 858px) {
    .btn { padding: 6px 14px; font-size: 14px; }
}

/* ===== Location Autocomplete ===== */
.autocomplete-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0 0 0.5rem 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: none;
}

.autocomplete-suggestions.show {
  display: block;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #f3f4f6);
  transition: background-color 0.12s;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--muted, #f3f4f6);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--muted-fg, #9ca3af);
}

.autocomplete-item-text {
  flex: 1;
  min-width: 0;
}

.autocomplete-item-main {
  font-size: 14px;
  font-weight: 600;
  color: var(--card-fg, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-item-sub {
  font-size: 12px;
  color: var(--muted-fg, #6b7280);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .autocomplete-suggestions {
    max-height: 220px;
    border-radius: 0 0 0.75rem 0.75rem;
  }
  .autocomplete-item {
    padding: 11px 14px;
  }
  .autocomplete-item-main {
    font-size: 15px;
  }
}
