* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Sarabun", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}
body {
  background-image: url("../images/floods.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: "Poppins", sans-serif;
  margin: 0;
  padding: 0;
  color: #004d40;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 30px;
  margin-bottom: 30px;
  padding: 10px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.logo-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.logo-container img {
  max-width: 50px;
  height: 50px;
  transition: transform 0.3s;
}

.logo-container img:hover {
  transform: scale(1.1);
}

/*
.header {
  background: linear-gradient(135deg, #2c5f2d 0%, #97bc62 100%);
  color: white;
  padding: 30px;
  text-align: center;
}
*/

header {
  background-color: #1450a3;
  color: white;
  padding: 20px 0;
  width: 100%;
  font-size: 1em;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}
header img {
  max-width: 50px;
  height: auto;
  margin-right: 15px;
}
.header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  background: #f5f5f5;
  border-bottom: 2px solid #ddd;
}

.tab {
  flex: 1;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  font-size: 1.1em;
  transition: all 0.3s;
  border: none;
  background: none;
}

.tab:hover {
  background: #e0e0e0;
}

.tab.active {
  background: white;
  border-bottom: 3px solid #2c5f2d;
  font-weight: bold;
}

.tab-content {
  display: none;
  padding: 30px;
  animation: fadeIn 0.5s;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #333;
}

input[type="text"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1em;
  transition: border 0.3s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2c5f2d;
}

.file-upload {
  border: 3px dashed #ddd;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.file-upload:hover {
  border-color: #2c5f2d;
  background: #f9f9f9;
}

.file-upload input {
  display: none;
}

.preview-area {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.preview-item img,
.preview-item video {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.preview-item .remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: red;
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  cursor: pointer;
  font-weight: bold;
}

.file-info {
  font-size: 0.85em;
  color: #666;
  padding: 5px;
  background: #f5f5f5;
}

.btn {
  background: linear-gradient(135deg, #2c5f2d 0%, #97bc62 100%);
  color: white;
  padding: 15px 40px;
  border: none;
  border-radius: 8px;
  font-size: 1.1em;
  cursor: pointer;
  transition: transform 0.2s;
  width: 100%;
  margin-top: 20px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
}

/* แผนที่ */
#location-map,
#reports-map {
  height: 400px;
  border-radius: 8px;
  margin-bottom: 20px;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.gallery-item {
  border-radius: 12px;
  background: #f9f9f9;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
  cursor: pointer;
}

.gallery-item:hover {
  transform: translateY(-5px);
  
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.gallery-info {
  padding: 15px;
  background: #f9f9f9;
}

.gallery-info h3 {
  margin-bottom: 5px;
  color: #2c5f2d;
}

.gallery-info p {
  font-size: 0.9em;
  color: #666;
  margin: 3px 0;
}

/* Filter & Search */
.year-filter, .year-filter2 {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.year-btn, .year-btn2  {
  padding: 10px 20px;
  border: 2px solid #2c5f2d;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
}

.year-btn:hover,
.year-btn.active, 
.year-btn2:hover,
.year-btn2.active
{
  background: #2c5f2d;
  color: white;
}

.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 12px 20px;
  border: 2px solid #ddd;
  border-radius: 25px;
  font-size: 1em;
}

/* Alert */
.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  animation: slideIn 0.5s;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}



/* ========================================
   LEGACY MODAL
   ======================================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal.active {
  display: flex;
}

.modal-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
  animation: scaleIn 0.25s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-content img,
.modal-content video {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-close:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.modal-close:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .modal-close {
    top: -45px;
    padding: 10px 20px;
    font-size: 1em;
  }
}


/* ========================================
   MEDIA GRID
   ======================================== */

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

@media (min-width: 640px) {
  .media-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.media-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: #f3f3f3;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-item:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.media-item:active {
  transform: scale(0.98);
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease;
}

.media-item:hover img,
.media-item:hover video {
  opacity: 0.9;
}

.media-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  pointer-events: none;
  transition: background 0.2s ease;
}

.media-item:hover .media-more {
  background: rgba(0, 0, 0, 0.75);
}


/* ========================================
   MEDIA MODAL
   ======================================== */

.media-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

.media-modal.is-open {
  display: block;
}

.media-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.media-modal__panel {
  position: absolute;
  inset: 5%;
  background: #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .media-modal__panel {
    inset: 2%;
    border-radius: 12px;
  }
}

.media-modal__stage {
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
}

.media-modal__stage img,
.media-modal__stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.media-modal__caption {
  padding: 16px 20px;
  color: #e5e5e5;
  font-size: 14px;
  line-height: 1.5;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.4);
}

@media (max-width: 640px) {
  .media-modal__caption {
    padding: 12px 16px;
    font-size: 13px;
  }
}

.media-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 20px;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.media-modal__close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.media-modal__close:active {
  transform: scale(0.95);
}

@media (max-width: 640px) {
  .media-modal__close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

.media-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 28px;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.media-modal__nav:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.05);
}

.media-modal__nav:active {
  transform: translateY(-50%) scale(0.95);
}

.media-modal__nav--prev {
  left: 16px;
}

.media-modal__nav--next {
  right: 16px;
}

@media (max-width: 640px) {
  .media-modal__nav {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .media-modal__nav--prev {
    left: 10px;
  }

  .media-modal__nav--next {
    right: 10px;
  }
}


/* ========================================
   POPUP MEDIA GRID
   ======================================== */

.popup-media-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}

@media (max-width: 640px) {
  .popup-media-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

.popup-media-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: #f0f0f0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-media-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.popup-media-item:active {
  transform: scale(0.98);
}

.popup-media-item img,
.popup-media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease;
}

.popup-media-item:hover img,
.popup-media-item:hover video {
  opacity: 0.9;
}

.popup-media-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  pointer-events: none;
  transition: background 0.2s ease;
}

.popup-media-item:hover .popup-media-more {
  background: rgba(0, 0, 0, 0.7);
}