/* Client portal styles. Builds on styles.css (shared shell, buttons, forms). */

/* The HTML `hidden` attribute must always win. Several elements below set an
   explicit `display` (flex/grid/inline-flex), which would otherwise override
   the attribute's default `display: none` and leave modals, auth forms, and the
   user menu all visible at once. This keeps show/hide logic in portal.js working. */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.button-sm {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.portal-user {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.link-button:hover {
  text-decoration: underline;
}

/* --- Auth --------------------------------------------------------------- */

.auth-section {
  display: flex;
  justify-content: center;
  padding-top: 42px;
}

.auth-card {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.auth-title {
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin: 0 0 8px;
}

.auth-subtitle {
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form span {
  font-size: 0.93rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(17, 39, 66, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.field-hint {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.auth-error,
.modal-error {
  background: rgba(203, 45, 62, 0.12);
  border: 1px solid rgba(203, 45, 62, 0.3);
  color: #8f1d2b;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.auth-notice {
  background: rgba(29, 119, 203, 0.12);
  border: 1px solid rgba(29, 119, 203, 0.3);
  color: var(--accent-strong);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

/* --- Board -------------------------------------------------------------- */

.board-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 22px;
}

.board-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin: 0 0 6px;
}

.board-subtitle {
  color: var(--muted);
  margin: 0;
}

.board-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.board-filter select {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.board-status {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.board-column {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-column.drag-over {
  border-color: var(--accent);
  background: rgba(29, 119, 203, 0.08);
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.column-count {
  background: rgba(17, 39, 66, 0.08);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.column-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 40px;
}

.ticket-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
  display: grid;
  gap: 8px;
}

.ticket-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(61, 103, 153, 0.16);
}

.ticket-card[draggable="true"] {
  cursor: grab;
}

.ticket-card.dragging {
  opacity: 0.5;
}

.ticket-card-title {
  font-weight: 700;
  line-height: 1.35;
  font-size: 0.96rem;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-work {
  background: rgba(29, 119, 203, 0.14);
  color: var(--accent-strong);
}

.badge-feature {
  background: rgba(120, 79, 209, 0.14);
  color: #5b34b0;
}

.badge-priority-low {
  background: rgba(83, 112, 141, 0.14);
  color: var(--muted);
}

.badge-priority-medium {
  background: rgba(214, 158, 46, 0.16);
  color: #8a6100;
}

.badge-priority-high {
  background: rgba(203, 45, 62, 0.14);
  color: #a1202f;
}

.ticket-owner {
  font-size: 0.8rem;
  color: var(--muted);
}

.board-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 18px;
}

/* --- Modals ------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 39, 66, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  width: min(560px, 100%);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h2 {
  font-size: 1.6rem;
}

.modal-close {
  background: none;
  border: 0;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.detail-section {
  margin-bottom: 18px;
}

.detail-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 6px;
}

.detail-value {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.detail-controls {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  margin-bottom: 18px;
}

.detail-controls label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

.detail-controls select,
.detail-controls input,
.detail-controls textarea {
  padding: 12px 14px;
  border: 1px solid rgba(17, 39, 66, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-weight: 500;
}

.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button-danger {
  background: rgba(203, 45, 62, 0.12);
  color: #a1202f;
  border: 1px solid rgba(203, 45, 62, 0.3);
}

@media (max-width: 900px) {
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .board {
    grid-template-columns: 1fr;
  }
}
