/* === Dynamic Area Manager Frontend Styles === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@400;500;600&display=swap');

.dda-container {
  background: #fff;
  padding: 32px;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  margin: 30px auto;
  max-width: 1100px;
  font-family: "Poppins", "Inter", sans-serif;
  text-align: left;
  box-sizing: border-box;
  color: #111827;
}

/* --------------------
   Search Input
-------------------- */
.dda-container #dda-search {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 15px;
  background: #f9fafb;
  transition: border 0.2s ease, background 0.2s ease;
  color: #111827;
}
.dda-container #dda-search::placeholder { color: #9ca3af; }
.dda-container #dda-search:focus {
  border-color: #dc2626;
  background: #fff5f5;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.2);
  outline: none;
}

/* --------------------
   Labels
-------------------- */
.dda-container label {
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
  font-size: 14px;
  color: #374151;
  white-space: normal;
}

/* --------------------
   Select Boxes
-------------------- */
.dda-selects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.dda-container .ts-control {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
}
.dda-container .ts-control .item,
.dda-container .ts-control .ts-placeholder {
  color: #374151;
  font-weight: 500;
}
.dda-container .ts-control.focus {
  border-color: #dc2626;
  background: #fff5f5;
  box-shadow: 0 0 0 2px rgba(220,38,38,0.2);
}

/* Dropdown */
.dda-container .ts-dropdown {
  background: #fff !important;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  margin-top: 4px;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dda-container .ts-dropdown .option {
  padding: 10px 12px;
  font-size: 15px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.dda-container .ts-dropdown .option:last-child { border-bottom: none; }
.dda-container .ts-dropdown .option:hover {
  background-color: #fee2e2;
  color: #dc2626;
}
.dda-container .ts-dropdown .option.selected {
  background-color: #fecaca;
  font-weight: 600;
  color: #b91c1c;
}

/* --------------------
   Results Section
-------------------- */
.dda-container #dda-results {
  margin-top: 20px;
  padding: 10px;
}
.dda-container #dda-results h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: #1e293b;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fef2f2;
  border-left: 5px solid #dc2626;
  line-height: 1.4;
}
.dda-container #dda-results h4 {
  margin: 16px 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: #991b1b;
  line-height: 1.3;
}

/* --------------------
   Area Cards Grid
-------------------- */
.dda-areas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dda-area {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.dda-area:hover,
.dda-area:focus-visible {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
  transform: scale(1.02) translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  outline: none;
}
.dda-area .pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.25s ease;
}
.dda-area:hover .pin,
.dda-area:focus-visible .pin {
  background: #dc2626;
  color: #fff;
  transform: scale(1.15);
}

/* --------------------
   Request Button
-------------------- */
button.request-new-area {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  display: inline-block;
  transition: background 0.2s ease, transform 0.2s ease;
}
button.request-new-area:hover {
  background: #b91c1c;
  transform: translateY(-2px);
}
button.request-new-area:active {
  background: #991b1b;
  transform: scale(0.98);
}

/* --------------------
   Centered Floating Modal (No Backdrop)
-------------------- */
#dda-request-modal {
  display: none;
  position: fixed;
  z-index: 99999;
  top: 0; left: 0;
  width: 100%; height: 100%;

  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;

  display: flex;
  align-items: center;
  justify-content: center;
}
#dda-request-modal .dda-modal-content {
  background: #fff;
  padding: 28px;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  position: relative;
  animation: fadeInScale 0.25s ease;
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
#dda-request-modal .dda-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  color: #666;
}
#dda-request-modal .dda-close:hover { color: #dc2626; }

/* ✅ Modal form inputs styling */
#dda-request-form label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  font-size: 14px;
}
#dda-request-form input,
#dda-request-form textarea {
  width: 100%;
  padding: 10px 14px;
  margin-top: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}
#dda-request-form textarea {
  min-height: 70px;
  resize: vertical;
}
#dda-request-form button {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 18px;
  width: 100%;
  transition: background 0.25s ease;
}
#dda-request-form button:hover {
  background: #b91c1c;
}

/* --------------------
   Responsive
-------------------- */
@media (max-width: 1024px) {
  .dda-areas { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .dda-selects { grid-template-columns: 1fr; }
  .dda-areas { grid-template-columns: repeat(2, 1fr); }
  #dda-request-modal { align-items: flex-end; }
  #dda-request-modal .dda-modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 90%;
    overflow-y: auto; /* ✅ Scroll inside modal */
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
  #dda-request-form { display: flex; flex-direction: column; }
  #dda-request-form button { 
    margin-top: 20px !important;
    margin-bottom: 20px !important;
  }
}
@media (max-width: 480px) {
  .dda-areas { grid-template-columns: 1fr; }
  .dda-container { padding: 20px; }
  #dda-results h3 { font-size: 18px; }
  #dda-results h4 { font-size: 14px; }

  #dda-request-modal .dda-modal-content {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
  #dda-request-form button { 
    margin-bottom: calc(28px + env(safe-area-inset-bottom)) !important;
  }
}

/* Edge alignment */
.dda-container .ts-wrapper,
.dda-container .ts-control {
  display: block;
  width: 100% !important;
  box-sizing: border-box;
}
.dda-container #dda-search {
  width: 100%;
  box-sizing: border-box;
}

/* ✅ FIX: Keep TomSelect single line ONLY in main container */
.dda-container .ts-control {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}
.dda-container .ts-control > .item {
  margin-right: 6px;
  white-space: nowrap;
}
.dda-container .ts-control > input {
  flex: 1 1 auto !important;
  min-width: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  display: inline-block !important;
}

/* ✅ Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
  height: 100%;
}
.ts-wrapper.ts-glow .ts-control {
  border: 2px solid #0073e6 !important;
  box-shadow: 0 0 6px rgba(0,115,230,0.6) !important;
}
