/* Styles specific to the damage report section. */

.damage-section {
  background-color: #3a3a47;
  border: 1.5px solid #f0f0f2;
  border-radius: 25px;
  box-shadow: 0 0 10px rgba(2, 2, 2, 2.3);
  padding: 30px;
  margin: 40px auto;
  max-width: 1100px;
  color: #fff;
}

.damage-section table {
  width: 100%;
  border-collapse: collapse;
}

/* hlavička na desktopu */
#damageTable th,
#damageTable td {
  padding: 8px 10px;
}

.damage-section .add-row-btn {
  width: 80%;
  max-width: 320px;
  display: block;
  margin: 10px auto 0;
}

/* DESKTOP – menší náhled fotky */
.damage-section .img-preview {
  margin-top: 5px;
  max-width: 260px;    /* zmenšený náhled */
  max-height: 180px;
  overflow: hidden;
  border-radius: 6px;
}

.damage-section .img-preview img {
  width: 100%;
  height: 100%;
  cursor: pointer;
  border-radius: 6px;
  object-fit: cover;   /* můžeš dát contain, když nechceš ořez */
}

/* =====================================================
    OVERLAY pro zvětšené fotky poškození (opravené!)
===================================================== */
#damageOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 4000; /* MUSÍ být nad .admin-nav i hamburgerem */
}

#damageOverlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
  z-index: 4001;
}

#damageOverlay .overlay-close {
  position: absolute;
  top: 10px;
  right: 15px;
  cursor: pointer;
  font-size: 24px;
  color: #fff;
  z-index: 4002; /* ještě nad obrázkem */
}

/* =====================================================
    📱 MOBIL = tabulka → karty
===================================================== */
@media (max-width: 768px) {

  #damageTable,
  #damageTable thead,
  #damageTable tbody,
  #damageTable th,
  #damageTable td,
  #damageTable tr {
    display: block;
    width: 100%;
  }

  /* schovat hlavičku tabulky */
  #damageTable thead {
    display: none;
  }

  /* buňka = label + input pod sebou */
  #damageTable td {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0;
  }

  #damageTable td::before {
    position: static;
    transform: none;
    font-weight: 600;
    color: #ffffff;
    font-size: 13px;
    margin-bottom: 2px;
  }

  /* názvy sloupců podle pořadí */
  #damageTable td:nth-child(1)::before { content: "Část vozu"; }
  #damageTable td:nth-child(2)::before { content: "Typ poškození"; }
  #damageTable td:nth-child(3)::before { content: "Závažnost"; }
  #damageTable td:nth-child(4)::before { content: "Poznámka"; }
  #damageTable td:nth-child(5)::before { content: "Foto"; }

  /* inputy přes celou šířku */
  #damageTable input[type="text"],
  #damageTable input[type="file"] {
    width: 100%;
    box-sizing: border-box;
  }

  /* KONTEJNER PREVIEW – nutné pro mobil */
  .damage-section .img-preview {
    max-width: 100%;
    height: 200px;
    max-height: 180px;
    overflow: hidden;
  }

  .damage-section .img-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
    border-radius: 2px;
  }

  .damage-section .add-row-btn {
    width: 100%;
    max-width: 320px;
    display: block;
    margin: 10px auto 0;
    text-align: center;
  }
}

/* =========================================
   SPECIFICKÉ STYLY PRO SEKCI POŠKOZENÍ
   (.sec-poskozeni-jednotlivych-casti-vozu)
========================================= */

.sec-poskozeni-jednotlivych-casti-vozu input[type="text"],
.sec-poskozeni-jednotlivych-casti-vozu textarea {
  width: 100%;
  padding: 8px 10px;
  background-color: #1e1e24;
  color: #ffffff;
  border: 1px solid #555;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

/* ať se to v tabulce nerozpadá */
.sec-poskozeni-jednotlivych-casti-vozu #damageTable td input[type="text"],
.sec-poskozeni-jednotlivych-casti-vozu #damageTable td textarea {
  width: 100%;
  display: block;
}

/* =====================================================
   JustCar – DAMAGE preview UX doplňky
   - lupa (desktop hover, mobil pulzuje)
   - MAX badge (levý horní roh jako standard)
   - remove tlačítko (X vpravo nahoře mimo kartu)
===================================================== */

/* kurzor lupa na obrázku */
.damage-section .img-preview img {
  cursor: zoom-in;
}

/* ZOBRAZIT ikonu lupy (overlay badge) */
.damage-section .img-preview {
  position: relative; /* nutné pro ::before */
}

.damage-section .img-preview::before {
  content: "🔍";
  position: absolute;
  right: 1px;
  bottom: 6px;
  z-index: 6;

  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;

  border-radius: 12px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px);

  font-size: 18px;
  line-height: 1;

  opacity: 1;              /* desktop default: skryté */
  transform: scale(.98);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

/* Desktop: zobrazit lupu při hover */
@media (min-width: 769px) {
  .damage-section .img-preview:hover::before {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobil: vždy vidět a pulzovat */
@media (max-width: 768px) {
  .damage-section .img-preview::before {
    opacity: 1;
    animation: jcZoomPulse 1.8s ease-in-out infinite;
  }
}

@keyframes jcZoomPulse {
  0%, 100% {
    transform: scale(1);
    opacity: .85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* Remove tlačítko – podporuje .remove i .damage-remove */
.damage-section .img-preview .remove,
.damage-section .img-preview .damage-remove {
  position: absolute;
  top: -20px;
  right: -1px;
  width: 1px;
  height: 1px;
  border-radius: 70%;
  border: none;
  background: #c0392b;
  color: #fff;
  font-size: 20px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0, 0, 0, .55);
  z-index: 7;
}

.damage-section .img-preview .remove:hover,
.damage-section .img-preview .damage-remove:hover {
  background: #e74c3c;
  transform: scale(1.05);
}

/* =====================================================
   Poskozeni 2.0 – tabulka vizualne jako karty
===================================================== */
body.jc .damage-section.sec-poskozeni-jednotlivych-casti-vozu {
  max-width: none !important;
  margin: 24px 10px 34px !important;
  padding: 26px !important;
  border: 1px solid rgba(255,255,255,.70) !important;
  border-radius: 14px !important;
  background:
    radial-gradient(circle at 16% 0%, rgba(69,145,213,.12), transparent 30%),
    linear-gradient(135deg, #353544 0%, #30303d 100%) !important;
  box-shadow: 0 16px 36px rgba(0,0,0,.42) !important;
}

body.jc .damage-section #damageTable,
body.jc .damage-section #damageTable tbody,
body.jc .damage-section #damageTable tr,
body.jc .damage-section #damageTable td {
  display: block !important;
  width: 100% !important;
  border: 0 !important;
  box-sizing: border-box !important;
}

body.jc .damage-section #damageTable thead {
  display: none !important;
}

body.jc .damage-section #damageTable tbody {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 14px !important;
}

body.jc .damage-section #damageTable tr {
  position: relative !important;
  display: grid !important;
  grid-template-columns: minmax(180px, .9fr) minmax(180px, .9fr) minmax(170px, .75fr) minmax(260px, 1.2fr) minmax(280px, 1fr) !important;
  gap: 12px !important;
  align-items: start !important;
  min-height: 0 !important;
  padding: 18px !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  border-radius: 14px !important;
  background: rgba(26,26,34,.50) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 8px 18px rgba(0,0,0,.20) !important;
}

body.jc .damage-section #damageTable tr::before {
  content: "Poškození vozu";
  grid-column: 1 / -1;
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(31,41,55,.72);
  color: #9fb8d8;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

body.jc .damage-section #damageTable td {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 7px !important;
  padding: 0 !important;
}

body.jc .damage-section #damageTable td::before {
  position: static !important;
  display: block !important;
  margin: 0 !important;
  color: #aeb9cc !important;
  font-size: 11px !important;
  font-weight: 850 !important;
  letter-spacing: .075em !important;
  line-height: 1.15 !important;
  text-transform: uppercase !important;
  transform: none !important;
}

body.jc .damage-section #damageTable td:nth-child(1)::before { content: "Část vozu"; }
body.jc .damage-section #damageTable td:nth-child(2)::before { content: "Typ poškození"; }
body.jc .damage-section #damageTable td:nth-child(3)::before { content: "Závažnost"; }
body.jc .damage-section #damageTable td:nth-child(4)::before { content: "Popis"; }
body.jc .damage-section #damageTable td:nth-child(5)::before { content: "Fotografie"; }

body.jc .damage-section #damageTable td:nth-child(4) {
  grid-column: auto !important;
}

body.jc .damage-section #damageTable td:nth-child(5) {
  grid-column: auto !important;
  grid-row: auto !important;
}

body.jc .damage-section input[type="text"] {
  height: 52px !important;
  padding: 0 14px !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  border-radius: 13px !important;
  background: #1f2028 !important;
  color: #f8fafc !important;
  font-size: 16px !important;
  font-weight: 750 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03) !important;
}

body.jc .damage-section input[type="text"]:focus {
  outline: none !important;
  border-color: rgba(69,145,213,.72) !important;
  box-shadow: 0 0 0 3px rgba(69,145,213,.16) !important;
}

body.jc .damage-section .damage-severity-select {
  width: 100% !important;
  height: 52px !important;
  padding: 0 42px 0 14px !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  border-radius: 13px !important;
  background-color: #1f2028 !important;
  color: #f8fafc !important;
  font-size: 16px !important;
  font-weight: 850 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03) !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
}

body.jc .damage-section .damage-severity-select:focus {
  outline: none !important;
  border-color: rgba(69,145,213,.72) !important;
  box-shadow: 0 0 0 3px rgba(69,145,213,.16) !important;
}

body.jc .damage-section .damage-severity-select[data-severity="nezkontrolovano"] {
  border-color: rgba(148,163,184,.28) !important;
  background-color: rgba(31,32,40,.92) !important;
  color: #cbd5e1 !important;
}

body.jc .damage-section .damage-severity-select[data-severity="nizka"] {
  border-color: rgba(52,211,153,.42) !important;
  background-color: rgba(6,78,59,.30) !important;
  color: #d1fae5 !important;
}

body.jc .damage-section .damage-severity-select[data-severity="stredni"] {
  border-color: rgba(245,158,11,.48) !important;
  background-color: rgba(92,59,12,.34) !important;
  color: #fde68a !important;
}

body.jc .damage-section .damage-severity-select[data-severity="vysoka"] {
  border-color: rgba(251,113,133,.46) !important;
  background-color: rgba(76,29,42,.42) !important;
  color: #fecdd3 !important;
}

body.jc .damage-section .damage-severity-select[data-severity="kriticka"] {
  border-color: rgba(244,63,94,.68) !important;
  background-color: rgba(127,29,29,.55) !important;
  color: #ffe4e6 !important;
}

body.jc .damage-section input[type="file"] {
  width: 100% !important;
  padding: 10px !important;
  border: 1px dashed rgba(69,145,213,.48) !important;
  border-radius: 13px !important;
  background: rgba(31,41,55,.45) !important;
  color: #dbeafe !important;
  box-sizing: border-box !important;
}

body.jc .damage-section input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: #25364f;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

body.jc .damage-section .img-preview {
  width: 100% !important;
  max-width: none !important;
  min-height: 92px !important;
  max-height: none !important;
  margin-top: 0 !important;
  border-radius: 13px !important;
  background: rgba(15,15,22,.45) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

body.jc .damage-section .img-preview:empty::after {
  content: "📷 Fotka zatím není vložena";
  color: rgba(226,232,240,.55);
  font-weight: 800;
  font-size: 14px;
}

body.jc .damage-section .img-preview .ph-damage,
body.jc .damage-section .img-preview .ph {
  position: relative;
  width: 100%;
  height: 118px;
  border-radius: 13px;
  overflow: hidden;
}

body.jc .damage-section .img-preview img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 13px !important;
}

body.jc .damage-section .img-preview::before {
  right: 10px !important;
  bottom: 10px !important;
}

body.jc .damage-section .img-preview .remove,
body.jc .damage-section .img-preview .damage-remove {
  top: 10px !important;
  right: 10px !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 12px !important;
  background: rgba(20,20,28,.82) !important;
  color: #fff !important;
  font-size: 28px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

body.jc .damage-section .add-row-btn {
  width: auto !important;
  min-width: 250px !important;
  min-height: 54px !important;
  margin: 18px auto 0 !important;
  padding: 0 28px !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, #c93b18, #a72c12) !important;
  color: #fff !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  box-shadow: 0 10px 22px rgba(0,0,0,.25) !important;
}

body.jc .damage-section .add-row-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

@media (max-width: 1380px) {
  body.jc .damage-section #damageTable tbody {
    grid-template-columns: 1fr !important;
  }

  body.jc .damage-section #damageTable tr {
    grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(280px, 1fr) !important;
  }

  body.jc .damage-section #damageTable td:nth-child(4) {
    grid-column: 1 / 3 !important;
  }

  body.jc .damage-section #damageTable td:nth-child(5) {
    grid-column: 3 / 4 !important;
    grid-row: 2 / 4 !important;
  }
}

@media (max-width: 768px) {
  body.jc .damage-section.sec-poskozeni-jednotlivych-casti-vozu {
    margin: 16px 10px 26px !important;
    padding: 12px !important;
    border-radius: 14px !important;
  }

  body.jc .damage-section #damageTable tr {
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
    padding: 14px !important;
    gap: 11px !important;
  }

  body.jc .damage-section #damageTable td:nth-child(4),
  body.jc .damage-section #damageTable td:nth-child(5) {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  body.jc .damage-section .img-preview .ph-damage,
  body.jc .damage-section .img-preview .ph {
    height: 190px;
  }

  body.jc .damage-section .add-row-btn {
    width: 100% !important;
    min-width: 0 !important;
  }
}
