/* ===== Ticket Logs Page ===== */
.ticket-logs-page {
  padding: 1.5rem 2rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100%;
  animation: ticketLogsFadeIn 0.3s ease-out;
}

@keyframes ticketLogsFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----- Breadcrumb ----- */
.ticket-logs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.ticket-logs-breadcrumb-link {
  color: var(--primary, #0d9488);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.ticket-logs-breadcrumb-link:hover {
  color: var(--primary-dark, #0f766e);
  text-decoration: underline;
}

.ticket-logs-breadcrumb-sep {
  color: var(--text-muted, #94a3b8);
  user-select: none;
}

.ticket-logs-breadcrumb-current {
  color: var(--text-secondary, #64748b);
  font-weight: 500;
}

/* ----- Header ----- */
.ticket-logs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.ticket-logs-header-text {
  flex: 1;
  min-width: 0;
}

.ticket-logs-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  color: var(--text-primary, #0f172a);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.ticket-logs-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.5;
  max-width: 560px;
}

.ticket-logs-header-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.ticket-logs-btn-secondary {
  padding: 0.6rem 1.2rem;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #334155);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ticket-logs-btn-secondary:hover {
  background: var(--hover-bg, #f8fafc);
  border-color: #cbd5e1;
}

.ticket-logs-btn-primary {
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, var(--primary, #0d9488) 0%, #0f766e 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}

.ticket-logs-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

/* ----- Stats ----- */
.ticket-logs-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ticket-logs-stat-card {
  padding: 1.25rem 1rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}

.ticket-logs-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ticket-logs-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.ticket-logs-stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
  opacity: 0.9;
}

.ticket-logs-stat-open {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
}

.ticket-logs-stat-in-progress {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
}

.ticket-logs-stat-resolved {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
}

/* ----- Filters ----- */
.ticket-logs-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.ticket-logs-filter-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  margin-right: 0.25rem;
}

.ticket-logs-filter-btn {
  padding: 0.45rem 0.9rem;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #334155);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ticket-logs-filter-btn:hover {
  background: var(--hover-bg, #f8fafc);
  border-color: #cbd5e1;
}

.ticket-logs-filter-btn.active {
  background: var(--primary, #0d9488);
  color: #fff;
  border-color: var(--primary, #0d9488);
}

/* ----- Error ----- */
.ticket-logs-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #b91c1c;
  font-size: 0.9rem;
}

.ticket-logs-error-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fecaca;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.75rem;
}

/* ----- Section ----- */
.ticket-logs-section {
  margin-top: 0.5rem;
}

.ticket-logs-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.ticket-logs-section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
}

.ticket-logs-section-count {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  font-weight: 500;
}

/* ----- Table ----- */
.ticket-logs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  background: var(--card-bg, #fff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ticket-logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ticket-logs-table thead {
  background: var(--hover-bg, #f8fafc);
  border-bottom: 2px solid var(--border-color, #e2e8f0);
}

.ticket-logs-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary, #334155);
}

.ticket-logs-table tbody tr {
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  transition: background 0.15s;
}

.ticket-logs-table tbody tr:last-child {
  border-bottom: none;
}

.ticket-logs-table tbody tr:hover {
  background: var(--hover-bg, #f8fafc);
}

.ticket-logs-table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  color: var(--text-primary, #334155);
}

.ticket-logs-col-id {
  font-weight: 600;
  color: var(--primary, #0d9488);
}

.ticket-logs-col-subject {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-logs-col-date {
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
}

.ticket-logs-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.ticket-logs-status-open {
  background: #dbeafe;
  color: #1e40af;
}

.ticket-logs-status-in-progress {
  background: #fef3c7;
  color: #92400e;
}

.ticket-logs-status-resolved {
  background: #d1fae5;
  color: #065f46;
}

.ticket-logs-btn-view {
  padding: 0.4rem 0.85rem;
  background: var(--primary, #0d9488);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.ticket-logs-btn-view:hover {
  background: #0f766e;
  transform: translateY(-1px);
}

.ticket-logs-empty-cell {
  text-align: center;
  padding: 3rem 2rem !important;
  color: var(--text-secondary, #64748b);
}

.ticket-logs-empty-cell p {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
}

.ticket-logs-empty-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--primary, #0d9488);
  border: 1px solid var(--primary, #0d9488);
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ticket-logs-empty-btn:hover {
  background: var(--primary, #0d9488);
  color: #fff;
}

/* ----- Loading ----- */
.ticket-logs-loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1rem;
}

.ticket-logs-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color, #e2e8f0);
  border-top-color: var(--primary, #0d9488);
  border-radius: 50%;
  animation: ticketLogsSpin 0.8s linear infinite;
}

@keyframes ticketLogsSpin {
  to { transform: rotate(360deg); }
}

.ticket-logs-loading-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary, #64748b);
}

/* ----- Modal overlay ----- */
.ticket-logs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1000;
  padding: 1.5rem;
  animation: ticketLogsOverlayIn 0.2s ease-out;
}

@keyframes ticketLogsOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ticket-logs-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card-bg, #fff);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: ticketLogsModalIn 0.25s ease-out;
}

@keyframes ticketLogsModalIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.96) translateY(10px); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1) translateY(0); }
}

.ticket-logs-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  flex-shrink: 0;
}

.ticket-logs-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.ticket-logs-modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ticket-logs-modal-close:hover {
  background: var(--hover-bg, #f1f5f9);
  color: var(--text-primary, #0f172a);
}

.ticket-logs-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.ticket-logs-modal-loading {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary, #64748b);
}

.ticket-logs-modal-meta {
  margin-bottom: 1.5rem;
}

.ticket-logs-modal-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
}

.ticket-logs-modal-label {
  flex-shrink: 0;
  width: 100px;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
}

.ticket-logs-modal-value {
  color: var(--text-primary, #0f172a);
}

/* ----- Timeline ----- */
.ticket-logs-timeline-block {
  margin-bottom: 1.5rem;
}

.ticket-logs-timeline-title {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
}

.ticket-logs-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border-color, #e2e8f0);
  margin-left: 0.5rem;
  padding-left: 1.25rem;
}

.ticket-logs-timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
  font-size: 0.9rem;
}

.ticket-logs-timeline-item:last-child {
  padding-bottom: 0;
}

.ticket-logs-timeline-item::before {
  content: '';
  position: absolute;
  left: -1.45rem;
  top: 0.4rem;
  width: 10px;
  height: 10px;
  background: var(--primary, #0d9488);
  border-radius: 50%;
  border: 2px solid var(--card-bg, #fff);
  box-shadow: 0 0 0 1px var(--border-color, #e2e8f0);
}

.ticket-logs-timeline-date {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  margin-bottom: 0.2rem;
}

.ticket-logs-timeline-label {
  display: inline-block;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.25rem;
}

.ticket-logs-timeline-desc {
  margin: 0 0 0.2rem 0;
  color: var(--text-primary, #334155);
  line-height: 1.45;
}

.ticket-logs-timeline-user {
  font-size: 0.8rem;
  color: var(--text-secondary, #64748b);
}

.ticket-logs-timeline-empty {
  padding-left: 0;
  margin-left: 0;
  border: none;
  color: var(--text-secondary, #64748b);
}

.ticket-logs-modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .ticket-logs-page {
    padding: 1rem;
  }

  .ticket-logs-header {
    flex-direction: column;
    align-items: stretch;
  }

  .ticket-logs-header-actions {
    justify-content: flex-start;
  }

  .ticket-logs-stats {
    grid-template-columns: 1fr;
  }

  .ticket-logs-table thead {
    display: none;
  }

  .ticket-logs-table tr {
    display: block;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    padding: 1rem 0;
  }

  .ticket-logs-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border: none;
  }

  .ticket-logs-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    margin-right: 0.75rem;
    flex-shrink: 0;
  }

  .ticket-logs-col-actions {
    justify-content: flex-start;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color, #e2e8f0);
  }

  .ticket-logs-modal {
    max-height: 85vh;
  }
}

/* ================================ DARK THEME (night mode) ================================ */
body.night-mode .ticket-logs-page {
  background: rgba(58, 56, 56, 0.95);
  min-height: 100%;
}
body.night-mode .ticket-logs-breadcrumb-link {
  color: #f87171;
}
body.night-mode .ticket-logs-breadcrumb-link:hover {
  color: #fca5a5;
}
body.night-mode .ticket-logs-breadcrumb-sep,
body.night-mode .ticket-logs-breadcrumb-current {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .ticket-logs-header h1 {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .ticket-logs-subtitle {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .ticket-logs-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.25);
}
body.night-mode .ticket-logs-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .ticket-logs-btn-primary {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  box-shadow: 0 2px 8px rgba(248, 113, 113, 0.35);
}
body.night-mode .ticket-logs-stat-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .ticket-logs-stat-open {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}
body.night-mode .ticket-logs-stat-in-progress {
  background: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
}
body.night-mode .ticket-logs-stat-resolved {
  background: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}
body.night-mode .ticket-logs-stat-value,
body.night-mode .ticket-logs-stat-label {
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .ticket-logs-filter-label {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .ticket-logs-filter-btn {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}
body.night-mode .ticket-logs-filter-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
body.night-mode .ticket-logs-filter-btn.active {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff;
  border-color: #ef4444;
}
body.night-mode .ticket-logs-error {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.4);
}
body.night-mode .ticket-logs-section-title {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .ticket-logs-section-count {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .ticket-logs-table-wrap {
  background: rgba(58, 56, 56, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .ticket-logs-table thead {
  background: rgba(255, 255, 255, 0.08);
}
body.night-mode .ticket-logs-table th {
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .ticket-logs-table td {
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .ticket-logs-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}
body.night-mode .ticket-logs-col-id {
  color: #f87171;
}
body.night-mode .ticket-logs-col-date {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .ticket-logs-status-open {
  background: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
body.night-mode .ticket-logs-status-in-progress {
  background: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
}
body.night-mode .ticket-logs-status-resolved {
  background: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}
body.night-mode .ticket-logs-btn-view {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}
body.night-mode .ticket-logs-empty-cell,
body.night-mode .ticket-logs-empty-cell p {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .ticket-logs-empty-btn {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.6);
}
body.night-mode .ticket-logs-empty-btn:hover {
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}
body.night-mode .ticket-logs-loading-text {
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .ticket-logs-spinner {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #f87171;
}
body.night-mode .ticket-logs-modal {
  background: rgba(58, 56, 56, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
body.night-mode .ticket-logs-modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .ticket-logs-modal-header h2 {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .ticket-logs-modal-close {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .ticket-logs-modal-close:hover {
  color: #f87171;
  background: rgba(255, 255, 255, 0.1);
}
body.night-mode .ticket-logs-modal-loading {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .ticket-logs-modal-label {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .ticket-logs-modal-value {
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .ticket-logs-timeline-title {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .ticket-logs-timeline {
  border-left-color: rgba(255, 255, 255, 0.2);
}
body.night-mode .ticket-logs-timeline-item::before {
  background: #f87171;
  border-color: rgba(58, 56, 56, 1);
}
body.night-mode .ticket-logs-timeline-date {
  color: rgba(255, 255, 255, 0.75);
}
body.night-mode .ticket-logs-timeline-label {
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .ticket-logs-timeline-desc {
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .ticket-logs-timeline-user {
  color: rgba(255, 255, 255, 0.75);
}
body.night-mode .ticket-logs-modal-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}
