/* ============================================================
   Visioneer Global Styles (global.css)
   Applies to ALL pages (master + client)
   ============================================================ */

/* -----------------------------
   Reset + Base
   ----------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: "Inter", sans-serif;
  background: #f5f7f5;
  color: #0b1f10;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-weight: 600;
}

p {
  line-height: 1.5;
}

/* -----------------------------
   Layout Containers
   ----------------------------- */
.page-container {
  padding: 1.5rem;
}

.section-title {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
}

/* -----------------------------
   Buttons
   ----------------------------- */
button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: #1f8f4d;
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.btn-secondary {
  background: #ccc;
  color: #000;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.btn-danger {
  background: #b00020;
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.btn-small {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* -----------------------------
   Inputs
   ----------------------------- */
.input-field,
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
  margin-top: 0.4rem;
  background: #fff;
}

textarea {
  resize: vertical;
}

/* -----------------------------
   Cards
   ----------------------------- */
.card {
  background: #fff;
  padding: 1.25rem;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* -----------------------------
   Tables
   ----------------------------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

/* Card-like table container */
.visioneer-table {
  background: #fff;
  border: 1px solid #e0e4e0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Make table containers scroll horizontally on narrow screens */
.assets-table-wrap,
.work-table-wrap,
.report-table-wrap,
[class*="-table-wrap"] {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

th {
  background: #0b1f10;
  color: #fff;
  padding: 0.7rem 0.85rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #f0f2f0;
  color: #333;
  vertical-align: middle;
}

/* Last row no border */
.visioneer-table tbody tr:last-child td { border-bottom: none; }

/* Alternating row stripes */
.visioneer-table tbody tr:nth-child(even) { background: #f8faf8; }

/* Hover */
.visioneer-table tbody tr:hover { background: #eef4ee; }
tr:hover { background: #eef5ee; }

/* ── Sortable column headers ── */
.visioneer-table th[data-sort-key] {
  cursor: pointer;
  position: relative;
  padding-right: 1.4rem;
  transition: background 0.15s;
  user-select: none;
}
.visioneer-table th[data-sort-key]:hover { background: #163a1e; }
.visioneer-table th[data-sort-key]::after {
  content: "\21C5";
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.35;
  font-size: 0.72rem;
}
.visioneer-table th.sort-asc::after { content: "\25B2"; opacity: 0.9; }
.visioneer-table th.sort-desc::after { content: "\25BC"; opacity: 0.9; }

/* -----------------------------
   Badges
   ----------------------------- */
.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #fff;
}

.badge.green { background: #1f8f4d; }
.badge.blue { background: #2c6ed5; }
.badge.orange { background: #d98c00; }
.badge.red { background: #b00020; }
.badge.gray { background: #555; }

/* -----------------------------
   Modal Base Layer
   (Component-specific styles still injected)
   ----------------------------- */
.visioneer-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease;
  /* Base value; overridden by modal.js with a higher z-index */
  z-index: 9998;
}

.visioneer-modal-overlay.visible {
  opacity: 1;
}

.visioneer-modal {
  background: #fff;
  border-radius: 10px;
  max-width: 90%;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  overflow: hidden;
}

/* -----------------------------
   Utility Classes
   ----------------------------- */
.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grid {
  display: grid;
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* -----------------------------
   Responsive
   ----------------------------- */
@media (max-width: 768px) {
  .page-container {
    padding: 1rem;
  }

  .header-row {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 600px) {
  .page-container { padding: 0.75rem; }
  .visioneer-modal { max-width: 95%; }
}
/* Prevent modal from stretching full screen */
.visioneer-modal {
  max-height: 90vh;
  overflow: hidden;
}

/* Allow content to scroll instead of stretching the modal */
.visioneer-modal-content {
  max-height: calc(90vh - 60px);
  overflow-y: auto;
}