/* =====================================================================
   CUSTOM FIXES — dropdown visibility, layout wrapping, admin polish
   Loaded on every page that has our custom forms/admin panels.
   ===================================================================== */

/* ---------- 1. Fix invisible dropdown options (dark theme selects) ---------- */
.pf-input,
select,
input,
textarea {
  box-sizing: border-box;
  max-width: 100%;
}

select.pf-input,
select {
  background-color: #131f16 !important;
  color: #ffffff !important;
  border: 1px solid #2b3a2f;
  -webkit-appearance: menulist;
  appearance: menulist;
  color-scheme: dark;
}

/* The <option> list itself is rendered by the OS/browser, not fully
   stylable — forcing color-scheme + explicit colors is what stops it
   from rendering white-on-white or invisible text on most browsers. */
select.pf-input option,
select option {
  background-color: #131f16;
  color: #ffffff;
}

/* ---------- 2. Prevent content overflow / "going out of the box" ---------- */
.pf-input, .pf-row, .pf-row input, .pf-row select,
#personnel-form, #leave-form,
.contact-form-wrapper {
  min-width: 0; /* allows flex children to shrink instead of overflowing */
}

.pf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
  background: #101c13;
  border: 1px solid #223227;
  border-radius: 8px;
  padding: 12px;
}

.pf-row input, .pf-row select {
  flex: 1 1 160px;
  min-width: 0;
}

.pf-row .pf-remove {
  flex: 0 0 auto;
}

textarea.pf-input {
  resize: vertical;
  word-break: break-word;
}

/* Long unbroken text (emails, long IDs) should wrap, not stretch layout */
td, .p-personal-info div, p, span, div {
  overflow-wrap: break-word;
}

/* ---------- 3. Section spacing / arrangement inside forms ---------- */
.pf-section {
  background: #0e1a12;
  border: 1px solid #223227;
  border-radius: 10px;
  padding: 22px 25px;
  margin-bottom: 25px;
}

.pf-section h4 {
  color: #c9a24b;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid #223227;
}

.pf-add-btn {
  display: inline-block;
  margin-bottom: 25px;
}

/* Two/three-column responsive field grid without relying on bootstrap rows */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 6px;
}

@media (max-width: 576px) {
  .pf-grid { grid-template-columns: 1fr; }
  .pf-row { flex-direction: column; align-items: stretch; }
  .pf-row .pf-remove { align-self: flex-end; }
}

/* ---------- 4. Admin table / list wrapping ---------- */
#personnel-table-wrap table {
  width: 100%;
  table-layout: fixed;
}
#personnel-table-wrap td, #personnel-table-wrap th {
  overflow-wrap: break-word;
  vertical-align: middle;
}

/* ---------- 5. Admin nav bar ---------- */
.admin-topbar {
  background: #0e1a12;
  border-bottom: 1px solid #223227;
  padding: 14px 0;
}
.admin-topbar .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-topbar-brand {
  color: #c9a24b;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 16px;
}
.admin-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-nav-links a, .admin-nav-links button {
  color: #ddd;
  background: transparent;
  border: 1px solid #2b3a2f;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.admin-nav-links a.active, .admin-nav-links a:hover {
  background: #c9a24b;
  color: #101c13;
  border-color: #c9a24b;
}
.admin-nav-links .logout-btn {
  color: #ff8080;
  border-color: #5a2323;
}
.admin-nav-links .logout-btn:hover {
  background: #5a2323;
  color: #fff;
}

/* ---------- 6. Dashboard stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}
.stat-card {
  background: #0e1a12;
  border: 1px solid #223227;
  border-radius: 10px;
  padding: 22px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 30px;
  color: #c9a24b;
  font-weight: 700;
}
.stat-card .stat-label {
  color: #aaa;
  font-size: 13px;
  margin-top: 6px;
}

/* ---------- 12. Personnel portal tabs ---------- */
.portal-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #223227;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.portal-tab {
  background: transparent;
  border: none;
  color: #888;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.portal-tab.active {
  color: #c9a24b;
  border-bottom-color: #c9a24b;
}
.portal-tab-panel { display: none; }
.portal-tab-panel.active { display: block; }
.leave-card {
  background: #0e1a12;
  border: 1px solid #223227;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 18px;
  color: #eee;
}
.leave-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.leave-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 20px;
  font-size: 14px;
  color: #ddd;
  margin-bottom: 12px;
}
.leave-label {
  display: block;
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 2px;
}
.leave-reason {
  font-size: 14px;
  color: #ddd;
  border-top: 1px solid #223227;
  padding-top: 12px;
  margin-bottom: 14px;
}
.leave-card-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.leave-copy-btn {
  background: #131f16;
  color: #4caf50;
  border: 1px solid #4caf50;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
}
.personnel-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.personnel-card {
  background: #0e1a12;
  border: 1px solid #223227;
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.personnel-card-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #c9a24b;
  margin-bottom: 10px;
}
.personnel-card-body h5 {
  color: #fff;
  margin: 0 0 4px;
}
.personnel-card-id {
  color: #c9a24b;
  font-size: 12px;
  letter-spacing: 1px;
  margin: 0 0 8px;
}
.personnel-card-meta {
  color: #aaa;
  font-size: 13px;
  margin: 8px 0 0;
}
.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.st-active { background: rgba(76,175,80,.15); color: #4caf50; }
.st-leave { background: rgba(201,162,75,.15); color: #c9a24b; }
.st-suspended { background: rgba(255,107,107,.15); color: #ff6b6b; }
.st-retired { background: rgba(150,150,150,.15); color: #999; }
.st-other { background: rgba(150,150,150,.15); color: #999; }
.personnel-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
}
.personnel-card-actions a {
  color: #4caf50;
  text-decoration: none;
}
.personnel-card-actions a.danger { color: #ff6b6b; }
.mission-card {
  background: #101c13;
  border: 1px solid #223227;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.mission-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.mission-card-top .mis-name { flex: 2 1 200px; }
.mission-card-top .mis-type { flex: 1 1 130px; }
.mission-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.mission-card-grid label { margin-bottom: 4px; }
.mission-card textarea { width: 100%; }
.db-search-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.db-search-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid #2b3a2f;
  background: #131f16;
  color: #fff;
  font-size: 16px;
  letter-spacing: 1px;
  text-align: center;
}
.db-search-input:focus {
  outline: none;
  border-color: #c9a24b;
}
.db-search-btn {
  width: 100%;
  padding: 15px 20px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #c9a24b, #a9822f);
  color: #101c13;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.db-search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(201,162,75,.35);
}
.db-search-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
.floating-widgets {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
}
.fw-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  cursor: pointer;
  text-decoration: none;
  border: none;
}
.fw-whatsapp { background: #25D366; }
.fw-translate { background: #4285F4; font-size: 22px; }
#google_translate_element {
  display: none;
}
.fw-translate-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 65px;
  background: #101c13;
  border: 1px solid #2b3a2f;
  border-radius: 8px;
  padding: 10px;
}
.fw-translate-panel.open { display: block; }
