/* assets/css/tickets.css */
.page-head h1 { margin:0; font-size:1.6rem; }
.page-head p { margin:6px 0 0; color:var(--muted); }

.ticket-head { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; flex-wrap:wrap; }
.ticket-head h1 { margin:0; font-size:1.55rem; }
.ticket-head .sub { margin-top:8px; display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.muted { color:var(--muted); }

.cols { display:grid; gap:14px; }
@media (min-width: 980px) { .cols { grid-template-columns: 1.2fr .8fr; } }

.kv { display:grid; gap:10px; }
.kv > div { display:grid; gap:6px; padding:10px 12px; border:1px solid var(--border); border-radius:12px; background:var(--panel-2); }
.kv b { color:var(--muted); font-weight:800; }
.kv .full { grid-column: 1 / -1; }
.pre { white-space:pre-wrap; line-height:1.4; }

.ticket-form .grid { display:grid; gap:12px; }
.ticket-form .field { display:grid; gap:6px; }
.ticket-form .field.full { grid-column: 1 / -1; }
.ticket-form input, .ticket-form textarea, .ticket-form select {
  width:100%; padding:10px 12px; border-radius:12px;
  border:1px solid var(--border); background:var(--panel-2); color:var(--text);
}
.ticket-form small { color:var(--muted); }
.ticket-form .err { color:#ffd1d1; }

@media (min-width: 820px) {
  .ticket-form .grid { grid-template-columns: 1fr 1fr; }
  .ticket-form .field.full { grid-column: 1 / -1; }
}

.actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }
.btn { display:inline-flex; align-items:center; justify-content:center; padding:10px 14px; border-radius:12px; border:1px solid var(--border); text-decoration:none; font-weight:800; }
.btn.primary { background:var(--primary); color:#06131a; border-color:transparent; }
.btn.ghost { background:transparent; color:var(--text); }
.btn.tiny { padding:8px 10px; font-size:.85rem; border-radius:10px; }

.badge { display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px; border:1px solid var(--border); font-weight:800; font-size:.82rem; }
.badge.open { color:var(--primary); }
.badge.pending_info { color:var(--warning); }
.badge.in_progress { color:var(--waiting); }
.badge.resolved { color:var(--success); }
.badge.closed { color:var(--muted); }
.badge.vis.public { color:var(--success); }
.badge.vis.private { color:var(--danger); }

.searchbar { display:grid; gap:10px; margin-top:14px; }
.searchbar input, .searchbar select {
  padding:10px 12px; border-radius:12px; border:1px solid var(--border);
  background:var(--panel-2); color:var(--text);
}
@media (min-width: 820px) { .searchbar { grid-template-columns: 1.3fr .7fr .8fr auto; align-items:center; } }

.upload-grid { display:grid; gap:10px; }
@media (min-width: 820px) { .upload-grid { grid-template-columns: 1fr 1fr; } }
.uploader {
  display:grid; gap:6px; padding:12px; border-radius:12px;
  border:1px dashed var(--border); background:transparent;
}

.att-list { display:grid; gap:10px; }
.att {
  display:flex; justify-content:space-between; gap:10px; align-items:center;
  border:1px solid var(--border); border-radius:12px; padding:10px 12px;
  background:var(--panel-2);
}
.att .k { color:var(--muted); font-weight:800; font-size:.85rem; text-transform:uppercase; letter-spacing:.03em; }
.att .n { font-weight:700; }
.mini.private { display:inline-flex; margin-top:6px; padding:4px 8px; border-radius:999px; border:1px solid rgba(255,107,107,.5); color:#ffd1d1; font-size:.75rem; font-weight:800; width:max-content; }

.thread { display:grid; gap:10px; margin-top:10px; }
.bubble {
  border:1px solid var(--border); border-radius:14px; padding:10px 12px; background:var(--panel-2);
}
.bubble.staff { border-left:4px solid var(--primary); }
.bubble.user { border-left:4px solid var(--success); }
.bubble .meta { display:flex; justify-content:space-between; gap:10px; color:var(--muted); font-size:.9rem; }
.hp { position:absolute; left:-9999px; opacity:0; height:0; width:0; }
.note { margin-top:14px; color:var(--muted); }
.alert { padding:12px 14px; border-radius:12px; border:1px solid var(--border); }
.alert.warn { border-color:rgba(255,200,87,.5); color:#ffe7b4; }

.ticket-hero {
  position: relative;
  overflow: hidden;
}

.ticket-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
}

.btn.neutral {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.92);
}
.btn.neutral:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.18);
}

/* Public tickets: search + filters layout */
.public-search {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.public-search-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

/* If Clear button is not present, it still looks good */
.public-search-row .btn {
  white-space: nowrap;
}

/* Input styling (keeps it consistent across pages) */
.input,
.public-search-row input[type="text"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  padding: 12px 12px;
  font-size: 1rem;
  outline: none;
}

.input:focus,
.public-search-row input[type="text"]:focus {
  border-color: rgba(120, 180, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(120, 180, 255, 0.15);
}

/* Chips: keep on one line, scroll on small screens */
.dash-filters {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.dash-filters::-webkit-scrollbar {
  height: 6px;
}

/* Mobile: stack buttons under the input */
@media (max-width: 720px) {
  .public-search-row {
    grid-template-columns: 1fr;
  }
}

.ticket-hero.status-open::before         { background: rgba(90, 180, 255, 0.55); }
.ticket-hero.status-pending_info::before { background: rgba(255, 200, 90, 0.55); }
.ticket-hero.status-in_progress::before  { background: rgba(255, 200, 90, 0.55); }
.ticket-hero.status-testing::before      { background: rgba(190, 140, 255, 0.55); }
.ticket-hero.status-resolved::before     { background: rgba(90, 220, 140, 0.55); }
.ticket-hero.status-released::before     { background: rgba(90, 220, 140, 0.55); }
.ticket-hero.status-closed::before       { background: rgba(255,255,255,0.22); }
.ticket-hero.status-duplicate::before    { background: rgba(255, 150, 150, 0.45); }
.ticket-hero.status-wont_fix::before     { background: rgba(255, 150, 150, 0.45); }

/* New Ticket page */
.new-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:16px;
}
.new-hero h1{ margin:0; }
.new-hero p{ margin:6px 0 0; opacity:.8; }
.new-hero-right{ display:flex; gap:10px; flex-wrap:wrap; }

.new-form{
  padding: 16px;
}

.new-section{
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.new-section:first-child{ border-top: 0; padding-top: 0; }

.new-section-head{
  margin-bottom: 12px;
}
.new-section-head h2{
  font-size: 1.05rem;
  margin: 0;
}
.new-section-head p{
  margin: 6px 0 0;
  opacity: .75;
  font-size: .95rem;
}

.new-grid{
  display:grid;
  gap: 12px;
}
.new-grid.two{
  grid-template-columns: 1fr;
}
.new-grid.one{
  grid-template-columns: 1fr;
}

@media (min-width: 900px){
  .new-grid.two{ grid-template-columns: 1fr 1fr; }
  .span-2{ grid-column: 1 / -1; }
}

/* Fields */
.field{
  display:grid;
  gap: 6px;
}
.field .label{
  font-weight: 800;
  display:flex;
  align-items:center;
  gap:10px;
}
.req{
  font-weight: 800;
  font-size: .75rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  opacity: .9;
}

.field input,
.field select,
.field textarea{
  width:100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  padding: 12px 12px;
  font-size: 1rem;
  outline: none;
}

.field textarea{ resize: vertical; min-height: 120px; }

.field input:focus,
.field select:focus,
.field textarea:focus{
  border-color: rgba(120, 180, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(120, 180, 255, 0.15);
}

.field small{
  opacity: .72;
  font-size: .9rem;
  line-height: 1.3;
}
.err{
  color: rgba(255,160,160,0.95);
  opacity: 1;
}

/* Upload cards */
.upload-card{
  display:grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
}
.upload-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.upload-title{
  font-weight: 900;
}
.upload-hint{
  font-size: .85rem;
  opacity: .75;
}
.upload-body p{
  margin: 0 0 10px;
  opacity: .85;
}
.upload-input{
  width:100%;
}
.upload-card small{
  opacity: .7;
}

/* Actions */
.new-actions{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 16px;
}
@media (max-width: 720px){
  .new-actions{
    flex-direction: column;
  }
  .new-actions .btn,
  .new-actions button.btn{
    width: 100%;
  }
}

.btn.neutral{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.92);
}
.btn.neutral:hover{
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.18);
}
/* ===== New Ticket: form controls polish ===== */

.new-form select,
.new-form input[type="text"],
.new-form input[type="search"],
.new-form input[type="url"],
.new-form textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border, #3a3f48);
  background: var(--panel-2, #2a2f37);
  color: var(--text, #f8f9fb);
}

.new-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 12px 42px 12px 12px;
  line-height: 1.2;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted, #a9b0bb) 50%),
    linear-gradient(135deg, var(--muted, #a9b0bb) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 52%,
    calc(100% - 12px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.new-form select option {
  color: #0b0d10;
}

/* Important: Windows/Chrome uses a separate popup for the opened list.
   This at least prevents "white text on white background" when it *does* apply. */
.new-form select option,
.new-form select optgroup {
  background: #ffffff;
}

/* Focus states */
.new-form select:focus,
.new-form input:focus,
.new-form textarea:focus {
  outline: none;
  border-color: rgba(65, 140, 255, .65);
  box-shadow: 0 0 0 4px rgba(65, 140, 255, .12);
}

/* Placeholder */
.new-form input::placeholder,
.new-form textarea::placeholder {
  color: rgba(248, 249, 251, .45);
}

/* Helper/Errors */
.new-form .field small {
  color: var(--muted, #a9b0bb);
}
.new-form .field .err {
  color: #ff6b6b;
}
/* ===== New Ticket: structure + flow ===== */

.new-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.new-hero h1 { margin: 0 0 6px; }
.new-hero p  { margin: 0; color: var(--muted); max-width: 70ch; }

.new-meta {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: .9rem;
}

.new-section {
  padding-top: 4px;
}

.new-section + .new-section {
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 14px;
}

.new-section-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.new-section-head p {
  margin: 0 0 10px;
  color: var(--muted);
}

.new-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.new-actions-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.save-hint {
  color: var(--muted);
  font-size: .92rem;
}

/* Optional: sticky action bar on larger screens */
@media (min-width: 980px) {
  .new-actions {
    position: sticky;
    bottom: 10px;
    background: rgba(15, 18, 24, .75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 14px;
    padding: 12px;
  }
}
/* ===== New Ticket: grid alignment fixes ===== */

.new-grid.two {
  align-items: start;
}

/* Make each field a consistent layout so controls line up */
.new-form .field {
  display: grid;
  grid-template-rows: auto auto auto; /* label, control, help/error */
  gap: 8px;
}

/* Keep the control row consistent */
.new-form .field > input,
.new-form .field > select,
.new-form .field > textarea {
  margin: 0;
}

/* Helper text always occupies space so the other column aligns */
.new-form .field > small {
  margin: 0;
  min-height: 18px; /* gives a consistent baseline */
}

/* If you want "no helper text" fields to still align perfectly */
.new-form .field > small:empty {
  display: block;
}
/* ===== Stronger section headers (clear separation) ===== */

.new-section {
  margin-top: 18px;
}

/* Turn the section head into a header band */
.new-section-head {
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

/* Accent strip across the top */
.new-section-head::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), rgba(65,140,255,.15));
}

/* Title: bolder + slightly larger */
.new-section-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Section numbering (recommended) ===== */

.new-section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 8px;

  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);

  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--brand);
}


/* Description under title */
.new-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .95rem;
  max-width: 75ch;
}

/* Keep fields separated from the header band */
.new-section .new-grid {
  margin-top: 8px;
}
