/* Teamlogix Portal Enhance — Cliente final
   Inyectado vía template footer (swtemplates id=3). Reversible borrando
   los <link>/<script> y poniendo iscustom=0 en swtemplates.
*/

/* ============ Tokens ============ */
:root {
  --tlx-accent: #2563eb;
  --tlx-accent-dark: #1d4ed8;
  --tlx-ok: #16a34a;
  --tlx-warn: #d97706;
  --tlx-err: #dc2626;
  --tlx-radius: 8px;
  --tlx-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* ============ Dark mode ============ */
html[data-tlx-theme="dark"] {
  --tlx-bg: #0f172a;
  --tlx-surface: #1e293b;
  --tlx-text: #e2e8f0;
  --tlx-text-muted: #94a3b8;
  --tlx-border: #334155;
  filter: none;
}
html[data-tlx-theme="dark"] body,
html[data-tlx-theme="dark"] .swift-page,
html[data-tlx-theme="dark"] #maincontainer,
html[data-tlx-theme="dark"] .swiftcustomwide,
html[data-tlx-theme="dark"] .submitticketform,
html[data-tlx-theme="dark"] .ticketlist,
html[data-tlx-theme="dark"] .kbcontainer {
  background: var(--tlx-bg) !important;
  color: var(--tlx-text) !important;
}
html[data-tlx-theme="dark"] a { color: #93c5fd !important; }
html[data-tlx-theme="dark"] input,
html[data-tlx-theme="dark"] textarea,
html[data-tlx-theme="dark"] select {
  background: #0b1220 !important;
  color: var(--tlx-text) !important;
  border-color: var(--tlx-border) !important;
}
html[data-tlx-theme="dark"] table,
html[data-tlx-theme="dark"] .ticketslist,
html[data-tlx-theme="dark"] .panelcontainer {
  background: var(--tlx-surface) !important;
  color: var(--tlx-text) !important;
}
html[data-tlx-theme="dark"] th { background: #111827 !important; }
html[data-tlx-theme="dark"] tr:nth-child(even) td { background: #18243a !important; }

/* ============ Theme toggle ============ */
.tlx-theme-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: var(--tlx-accent);
  color: white;
  cursor: pointer;
  box-shadow: var(--tlx-shadow);
  font-size: 20px;
  line-height: 44px;
  text-align: center;
  transition: transform 0.15s ease;
}
.tlx-theme-btn:hover { transform: scale(1.08); }

/* ============ Validation hints (Submit form) ============ */
.tlx-hint {
  font-size: 12px;
  margin-top: 4px;
  display: block;
  color: var(--tlx-text-muted, #6b7280);
}
.tlx-hint.tlx-err { color: var(--tlx-err); }
.tlx-hint.tlx-ok { color: var(--tlx-ok); }
.tlx-field-err {
  outline: 2px solid var(--tlx-err) !important;
  outline-offset: 0;
}
.tlx-counter {
  float: right;
  font-size: 11px;
  color: var(--tlx-text-muted, #9ca3af);
}

/* ============ My Tickets ============ */
.tlx-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  flex-wrap: wrap;
}
.tlx-search {
  flex: 1 1 220px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: var(--tlx-radius);
  font-size: 14px;
}
.tlx-status-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tlx-status-open    { background: #fee2e2; color: #991b1b; }
.tlx-status-pending { background: #fef3c7; color: #92400e; }
.tlx-status-resolved{ background: #dcfce7; color: #166534; }
.tlx-status-closed  { background: #e5e7eb; color: #374151; }
.tlx-status-info    { background: #dbeafe; color: #1e40af; }

.tlx-new-reply {
  display: inline-block;
  background: var(--tlx-accent);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
  animation: tlxBlink 1.5s infinite;
}
@keyframes tlxBlink {
  50% { opacity: 0.55; }
}

/* ============ Ticket detail ============ */
.tlx-draft-banner {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 14px;
  border-radius: var(--tlx-radius);
  margin: 12px 0;
  font-size: 14px;
}
.tlx-draft-banner button {
  margin-left: 8px;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: var(--tlx-warn);
  color: white;
  cursor: pointer;
  font-size: 12px;
}
.tlx-shortcut-hint {
  display: inline-block;
  font-size: 11px;
  color: var(--tlx-text-muted, #6b7280);
  margin-left: 8px;
}
.tlx-shortcut-hint kbd {
  background: #e5e7eb;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px;
}

/* ============ Knowledgebase ============ */
.tlx-kb-helpful {
  margin: 20px 0;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: var(--tlx-radius);
  background: #f9fafb;
  text-align: center;
}
.tlx-kb-helpful button {
  margin: 0 6px;
  padding: 6px 16px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: var(--tlx-radius);
  cursor: pointer;
  font-size: 14px;
}
.tlx-kb-helpful button.tlx-active {
  background: var(--tlx-accent);
  color: white;
  border-color: var(--tlx-accent);
}
.tlx-kb-highlight {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
}

/* ============ Responsive tickets ============ */
@media (max-width: 720px) {
  .tlx-tickets-mobile table,
  .tlx-tickets-mobile thead,
  .tlx-tickets-mobile tbody,
  .tlx-tickets-mobile tr,
  .tlx-tickets-mobile td {
    display: block;
    width: 100%;
  }
  .tlx-tickets-mobile thead { display: none; }
  .tlx-tickets-mobile tr {
    border: 1px solid #e5e7eb;
    border-radius: var(--tlx-radius);
    margin-bottom: 10px;
    padding: 8px;
    background: white;
  }
  .tlx-tickets-mobile td {
    padding: 4px 0;
    border: 0 !important;
  }
  .tlx-tickets-mobile td:before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--tlx-text-muted, #6b7280);
    margin-right: 6px;
  }
}

/* ============ Attachment warning ============ */
.tlx-attach-warn {
  background: #fef3c7;
  border-left: 3px solid var(--tlx-warn);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13px;
  border-radius: 4px;
  color: #92400e;
}

/* ============ Dept memory hint ============ */
.tlx-dept-hint {
  background: #dbeafe;
  border-left: 3px solid var(--tlx-accent);
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
  margin: 6px 0;
  color: #1e3a8a;
}
