/*
 * 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.
 */

/* Drag & Drop Styles */
.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.drag-handle {
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.drop-zone-active {
  background-color: #eff6ff;
  border: 2px dashed #0284C7;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Completed todos hover effects */
.completed-todo-item {
  transition: background-color 0.2s ease;
}

.completed-todo-item:hover {
  background-color: #f9fafb;
}

/* Checkbox hover effect for uncomplete action */
.completed-todo-item [data-action*="uncomplete"]:hover {
  opacity: 0.8;
  transform: scale(1.05);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Form Validation Styles */
.field_with_errors input,
.field_with_errors select,
.field_with_errors textarea {
  @apply border-red-500 border-2 shadow-sm;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field_with_errors input:focus,
.field_with_errors select:focus,
.field_with_errors textarea:focus {
  @apply outline-none border-red-500;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Custom validation styling for JavaScript validation */
.border-red-500 {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.border-red-500:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* Custom error message styling */
.error-message {
  @apply text-red-500 text-sm mt-1 block;
}

/* Disable HTML5 validation tooltips only - preserve Tailwind styling */
form[novalidate] input:invalid,
form[novalidate] select:invalid,
form[novalidate] textarea:invalid {
  /* Only disable the validation popup, keep border styling */
}

/* Prevent validation styling from showing on page load for empty required fields */
input:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus),
textarea:invalid:not(:focus):not(:placeholder-shown) {
  border-color: rgb(209 213 219) !important; /* Keep gray-300 border */
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important; /* Keep shadow-sm */
}

/* Column Ordering Styles */
.pinned-column {
  position: relative;
}

.pinned-column::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 2px,
    rgba(2, 132, 199, 0.1) 2px,
    rgba(2, 132, 199, 0.1) 4px
  );
  pointer-events: none;
  border-radius: 0.5rem;
}

/* Chevron Rotation */
.chevron-collapsed {
  transform: rotate(-90deg);
  transition: transform 0.2s ease;
}

.chevron-expanded {
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

/* Import-progress bar: subtle pulse so the bar feels alive while we wait. */
@keyframes import-progress-pulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

/* Row anchor highlight: brief yellow flash when a row is targeted via
   #row-:id (e.g. jumping from a hardware set's "applicable doors" link). */
@keyframes row-anchor-flash {
  0%   { background-color: rgb(254 240 138); }
  100% { background-color: transparent; }
}

.row-anchor-highlight > td {
  animation: row-anchor-flash 2.5s ease-out;
}

/* Card Header Consistency - ensures all headers are same height regardless of content */
.card-header {
  min-height: 3rem;
  display: flex;
  align-items: center;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

.card-header h2,
.card-header h3 {
  font-size: 1.25rem; /* text-xl */
}

/* Todo Checkbox Base */
.todo-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border: 2px solid #9ca3af;
  border-radius: 4px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Todo Completed States */
.todo-completed .todo-checkbox {
  background-color: #10b981;
  border-color: #10b981;
}

.todo-completed .todo-title {
  text-decoration: line-through;
  opacity: 0.6;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  transform: translateX(-20px);
}

/* Checklist Item Transitions */
.checklist-item input[type="checkbox"] {
  transition: all 0.2s ease;
}

.checklist-item p,
.checklist-item span {
  transition: all 0.3s ease;
}

/* Checklist Checkbox States */
.checklist-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border: 2px solid #9ca3af;
  background-color: white;
  border-radius: 4px;
}

.checklist-checkbox.checked {
  border-color: #0284C7;
  background-color: #0284C7;
}

/* Button Styles - Reusable classes for consistent button styling */

/* Secondary button - standard gray button with darker hover */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(55 65 81);
  background-color: white;
  border: 1px solid rgb(209 213 219);
  border-radius: 0.375rem;
  transition: all 0.15s ease-in-out;
}

.btn-secondary:hover,
.btn-secondary.pressed {
  background-color: rgb(229 231 235);
  border-color: rgb(156 163 175);
}

/* Danger button - gray background with red border on hover */
.btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(55 65 81);
  background-color: white;
  border: 1px solid rgb(209 213 219);
  border-radius: 0.375rem;
  transition: all 0.15s ease-in-out;
}

.btn-danger:hover {
  background-color: rgb(229 231 235);
  border-color: rgb(220 38 38);
  color: rgb(185 28 28);
}

/* Primary button - gray that turns blue on hover */
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(55 65 81);
  background-color: white;
  border: 1px solid rgb(209 213 219);
  border-radius: 0.375rem;
  transition: all 0.15s ease-in-out;
}

.btn-primary:hover {
  background-color: rgb(2 132 199);
  border-color: rgb(2 132 199);
  color: white;
}

.btn-primary:hover svg {
  color: white !important;
}

/* Back button - simple gray button */
.btn-back {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: rgb(55 65 81);
  background-color: white;
  border: 1px solid rgb(209 213 219);
  border-radius: 0.375rem;
  transition: all 0.15s ease-in-out;
}

.btn-back:hover {
  background-color: rgb(229 231 235);
}

/* Icon-only button - for small action buttons */
.btn-icon {
  padding: 0.25rem;
  color: rgb(156 163 175);
  transition: color 0.15s ease-in-out;
}

.btn-icon:hover {
  color: rgb(75 85 99);
}

/* Icon-only danger button */
.btn-icon-danger {
  padding: 0.25rem;
  color: rgb(156 163 175);
  transition: color 0.15s ease-in-out;
}

.btn-icon-danger:hover {
  color: rgb(220 38 38);
}

/* DSL command preview highlights — applied to rows/cells while the
   interpretation panel is showing, cleared on Escape / clear / fire. */
tr.dsl-preview-update-row > td {
  background-color: rgb(254 249 195) !important; /* yellow-100 */
}
td.dsl-preview-update-cell {
  background-color: rgb(253 224 71) !important; /* yellow-300 */
  box-shadow: inset 0 0 0 2px rgb(202 138 4); /* yellow-600 */
}
tr.dsl-preview-delete-row > td {
  background-color: rgb(254 226 226) !important; /* red-100 */
  text-decoration: line-through;
  opacity: 0.85;
}

/* Nested door schedule rows: visually distinguish child doors under openings */
tr.door-row > td:first-child {
  /* Indent the row-number column on child doors */
  padding-left: 1.5rem;
}
tr.door-row > td {
  background-color: rgb(249 250 251); /* gray-50 */
  font-size: 0.8125rem;
}

/* Hide elements with data-procurement-hide when the ancestor table is in
   procurement view mode. Used for Add Item and similar action buttons that
   don't apply to procurement workflows. */
[data-controller~="schedule-table"][data-view-mode="procurement"] [data-procurement-hide="true"] {
  display: none;
}

/* Procurement view: dim rows whose material is "(Existing)" / "(E)". They're
   not purchasable — we already have those doors/frames. Only applies in
   procurement view; in other modes the row renders normally. */
[data-controller~="schedule-table"][data-view-mode="procurement"] tr[data-existing="true"] > td {
  opacity: 0.45;
}
[data-controller~="schedule-table"][data-view-mode="procurement"] tr[data-existing="true"]:hover > td {
  opacity: 0.65;
}

/* Import Specs styling */
@import 'specs.css';
