/* ==========================================================================
   TCP123 UK — Dedicated IT Support Ticketing System Styles
   Standard: Strict British English
   ========================================================================== */

.tickets-body {
  background-color: var(--color-primary);
  color: var(--color-text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .tickets-body {
  background-color: #060910;
  color: #f1f5f9;
}

/* 1. Header Navigation Bar */
.tickets-header {
  background: rgba(9, 13, 22, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.tickets-nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tickets-nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.tickets-nav-link {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.tickets-nav-link:hover,
.tickets-nav-link.active {
  color: #ffffff;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: #e2e8f0;
}

.user-profile-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--color-brand-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.btn-signout {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-signout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  transform: translateY(-1px);
}

.btn-signout svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* 2. Main Two-Column Layout */
.tickets-main-container {
  flex: 1;
  padding: 2.25rem 0 3.5rem 0;
}

.tickets-grid-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 1.75rem;
  align-items: start;
}

/* 3. Ticket Cards Container */
.ticket-panel-card {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  position: relative;
}

[data-theme="dark"] .ticket-panel-card {
  background: #0b111e;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.panel-header-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.85rem;
  margin-bottom: 1.35rem;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="dark"] .panel-title {
  color: #f8fafc;
}

/* 4. Pre-populated User Identity Card */
.user-identity-card {
  background: rgba(0, 68, 179, 0.05);
  border: 1px solid rgba(0, 68, 179, 0.15);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="dark"] .user-identity-card {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(56, 189, 248, 0.18);
}

.user-identity-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.identity-avatar-large {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-brand-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
}

.identity-name {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--color-primary);
}

[data-theme="dark"] .identity-name {
  color: #ffffff;
}

.identity-email {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

[data-theme="dark"] .identity-email {
  color: #94a3b8;
}

.identity-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

/* 5. Knowledgebase Deflection Banner */
.kb-deflection-banner {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.kb-deflection-text {
  font-size: 0.82rem;
  color: var(--color-text-main);
  line-height: 1.4;
}

[data-theme="dark"] .kb-deflection-text {
  color: #cbd5e1;
}

/* 6. Form Groups & Inputs */
.ticket-form-group {
  margin-bottom: 1.25rem;
}

.ticket-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

[data-theme="dark"] .ticket-form-label {
  color: #94a3b8;
}

.ticket-select,
.ticket-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-primary);
  box-sizing: border-box;
  transition: all var(--transition-fast);
}

[data-theme="dark"] .ticket-select,
[data-theme="dark"] .ticket-input {
  background: rgba(9, 13, 22, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

.ticket-select:focus,
.ticket-input:focus {
  outline: none;
  border-color: var(--color-brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 68, 179, 0.15);
}

/* 7. Rich Text WYSIWYG Editor */
.wysiwyg-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  transition: border-color var(--transition-fast);
}

[data-theme="dark"] .wysiwyg-wrapper {
  background: rgba(9, 13, 22, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
}

.wysiwyg-wrapper:focus-within {
  border-color: var(--color-brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 68, 179, 0.15);
}

.wysiwyg-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.6rem;
  background: #f1f5f9;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

[data-theme="dark"] .wysiwyg-toolbar {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.toolbar-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-main);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
}

[data-theme="dark"] .toolbar-btn {
  color: #cbd5e1;
}

.toolbar-btn:hover {
  background: rgba(0, 68, 179, 0.1);
  color: var(--color-brand-blue);
}

[data-theme="dark"] .toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: rgba(0, 0, 0, 0.15);
  margin: 0 0.25rem;
}

[data-theme="dark"] .toolbar-divider {
  background: rgba(255, 255, 255, 0.12);
}

.wysiwyg-editor {
  min-height: 150px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--color-primary);
  outline: none;
}

[data-theme="dark"] .wysiwyg-editor {
  color: #f1f5f9;
}

/* State-driven placeholder (OPEN-77): :empty breaks in Firefox once the
   editor retains a residual <br>/text node — js/tickets.js toggles
   data-empty instead. */
.wysiwyg-editor[contenteditable="true"][data-empty="true"]:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
  display: block;
}

.wysiwyg-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.85rem;
  background: #f8fafc;
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: #94a3b8;
}

[data-theme="dark"] .wysiwyg-statusbar {
  background: rgba(255, 255, 255, 0.02);
  border-top-color: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

/* 8. Attachment Dropzone */
.attachment-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: #f8fafc;
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .attachment-dropzone {
  background: rgba(9, 13, 22, 0.4);
  border-color: rgba(255, 255, 255, 0.12);
}

.attachment-dropzone:hover,
.attachment-dropzone.dragover {
  border-color: var(--color-brand-blue);
  background: rgba(0, 68, 179, 0.05);
}

.attachment-file-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  justify-content: center;
}

.attachment-file-chip {
  background: rgba(0, 68, 179, 0.1);
  color: var(--color-brand-blue);
  border: 1px solid rgba(0, 68, 179, 0.2);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

[data-theme="dark"] .attachment-file-chip {
  background: rgba(15, 23, 42, 0.9);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.attachment-thumbnail-img {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.attachment-chip-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: #ef4444;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0 0 0 2px;
  line-height: 1;
}

.attachment-chip-delete:hover {
  color: #f87171;
}

/* 9. Submission Action Buttons */
.ticket-submit-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1rem;
}

.btn-submit-ticket {
  background: linear-gradient(135deg, #047857, #065f46);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0.85rem 1.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: all var(--transition-fast);
}

.btn-submit-ticket:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.btn-discard-ticket {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.btn-discard-ticket:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

/* 10. Database Schema Preview Box */
.schema-preview-box {
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.76rem;
  line-height: 1.5;
  color: #38bdf8;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.schema-field-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.schema-key {
  color: #94a3b8;
}

.schema-val {
  color: #a7f3d0;
  font-weight: 600;
  text-align: right;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 11. Workflow Engine Status Tracker */
.workflow-tracker-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.workflow-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: 1rem 0;
}

.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  z-index: 1;
}

.workflow-step.active {
  color: #34d399;
}

.step-node {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: #1e293b;
  border: 2px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #ffffff;
}

.workflow-step.active .step-node {
  background: #047857;
  border-color: #34d399;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 12. Flat-File Storage Browser */
.flat-file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.flat-file-table th {
  text-align: left;
  padding: 0.5rem;
  color: #94a3b8;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.flat-file-table td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .tickets-grid-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .tickets-panel-card {
    padding: 1.15rem 0.85rem;
  }

  .ticket-submit-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-submit-ticket,
  .btn-discard-ticket {
    width: 100%;
    justify-content: center;
  }
}

/* 13. Dark Glassmorphic Ticket & Modal Buttons */
.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-outline.active {
  background: rgba(0, 68, 179, 0.35) !important;
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
}

.btn-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
  color: #94a3b8 !important;
}

#btn-toggle-manager-edit {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

#btn-toggle-manager-edit:hover {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #fbbf24 !important;
  color: #fef3c7 !important;
}

#btn-modal-set-inprogress {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

#btn-modal-set-inprogress:hover {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #fbbf24 !important;
  color: #fef3c7 !important;
}

#btn-modal-set-pending {
  background: rgba(168, 85, 247, 0.12) !important;
  color: #c084fc !important;
  border: 1px solid rgba(168, 85, 247, 0.35) !important;
}

#btn-modal-set-pending:hover {
  background: rgba(168, 85, 247, 0.25) !important;
  border-color: #c084fc !important;
  color: #f3e8ff !important;
}

#btn-modal-set-closed {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

#btn-modal-set-closed:hover {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: #34d399 !important;
  color: #d1fae5 !important;
}

#btn-modal-set-reopen {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
}

#btn-modal-set-reopen:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  color: #e0f2fe !important;
}

#btn-modal-claim {
  background: rgba(168, 85, 247, 0.12) !important;
  color: #c084fc !important;
  border: 1px solid rgba(168, 85, 247, 0.35) !important;
}

#btn-modal-claim:hover {
  background: rgba(168, 85, 247, 0.25) !important;
  border-color: #c084fc !important;
  color: #f3e8ff !important;
}

/* Focus-visible parity (OPEN-77 / WCAG 2.4.7): these controls defined only
   :hover, leaving keyboard users without a visible focus indicator. */
.toolbar-btn:focus-visible,
.btn-signout:focus-visible,
.btn-submit-ticket:focus-visible,
.btn-discard-ticket:focus-visible,
.attachment-chip-delete:focus-visible,
.btn-outline:focus-visible,
.attachment-dropzone:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}
