/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ============================================================
   Box model reset — makes width: 100% include padding and border
   so inputs never overflow their containers in flex/grid rows
   ============================================================ */

input,
select,
textarea {
  box-sizing: border-box;
}

/* ============================================================
   Responsive utilities (Tailwind not installed — defined here)
   ============================================================ */

.overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   Global heading scale
   ============================================================ */

h1 { font-size: 30px; }
h2 { font-size: 24px; }

/* ============================================================
   Responsive data table
   ============================================================ */

/* Ensure the table is always wide enough to show all columns;
   overflow-x-auto on the wrapper provides horizontal scroll. */
.responsive-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

table td { font-size: 13px !important; }
.responsive-table th { font-size: 11px !important; }
.responsive-table td { font-size: 13px !important; }

/* Tighter cell padding on tablet (≤1024px) */
@media (max-width: 1024px) {
  .responsive-table th,
  .responsive-table td {
    padding: 10px 12px !important;
    font-size: 12px !important;
  }
}

/* ============================================================
   Responsive form
   ============================================================ */

/* Form grid rows: label + input side-by-side on desktop,
   stacked on small screens */
.form-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 10px;
}

.form-row-top {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: start;
  gap: 10px;
}

.form-row label,
.form-row-top label {
  font-size: 13px;
}

/* Rails wraps error fields in <div class="field_with_errors">.
   display:contents makes it transparent to grid/flex parents so
   the 200px/1fr columns stay intact. */
.field_with_errors {
  display: contents;
}

/* Fluid form inputs — max-width caps growth on large screens */
.form-input {
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}

/* Responsive filter grid (e.g. audit log filters) */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .form-row,
  .form-row-top {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .form-row label,
  .form-row-top label {
    text-align: left !important;
    padding-top: 0 !important;
  }

  .form-input {
    max-width: 100%;
  }

  .filter-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   Floating label (outlined) fields — Tubing Data entry form
   ============================================================ */

.float-field {
  position: relative;
}

.float-input {
  width: 100%;
  padding: 18px 14px 8px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 12px;
  background: white;
  transition: border-color 0.2s;
  outline: none;
  color: #333;
  font-family: inherit;
}

.float-input:focus {
  border-color: #ba8d24;
}

.float-label {
  position: absolute;
  left: 14px;
  top: 0;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  color: #ba8d24;
  pointer-events: none;
  background: white;
  padding: 0 4px;
  line-height: 1;
}

/* Teal variant */
.float-field-teal .float-label { color: #1c7162; }
.float-field-teal .float-input:focus { border-color: #1c7162; }
