/* --- Admin & Auth Additions --- */
.auth-status-text {
  font-family: var(--font-family-sans);
  font-weight: 500;
  letter-spacing: 0.3px;
}

#login-error {
  animation: fadeIn var(--transition-fast) forwards;
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .admin-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.admin-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.admin-card:hover {
  border-color: var(--border-hover);
}

.admin-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-family: var(--font-family-serif);
  font-size: 1.25rem;
  color: var(--secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.admin-card form input, 
.admin-card form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-body);
  font-family: inherit;
  transition: all var(--transition-fast);
}

.admin-card form input:focus, 
.admin-card form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

#table-users, #table-forum-reports {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

#table-users th, #table-forum-reports th {
  padding: 12px 10px;
  color: var(--secondary);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

#table-users td, #table-forum-reports td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

#table-users tbody tr:hover, #table-forum-reports tbody tr:hover {
  background-color: rgba(107, 29, 36, 0.02);
}

/* --- ACTIVITY TIMELINE --- */
.activity-timeline-wrapper {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}

.activity-timeline-wrapper::-webkit-scrollbar {
  width: 5px;
}

.activity-timeline-wrapper::-webkit-scrollbar-thumb {
  background: rgba(107, 29, 36, 0.15);
  border-radius: 3px;
}

.activity-timeline {
  position: relative;
  padding-left: 28px;
}

.activity-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), rgba(107, 29, 36, 0.1));
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  padding: 10px 0 10px 16px;
  border-bottom: 1px solid var(--border-color);
  animation: fadeIn 0.2s ease forwards;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.timeline-action-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #ffffff;
}

.action-login { background-color: var(--teal); }
.action-user_created { background-color: var(--emerald); }
.action-user_deleted { background-color: var(--danger); }
.action-role_changed { background-color: var(--gold); color: #1a1e24; }
.action-password_reset { background-color: #6b46c1; }
.action-sighting_created { background-color: #2f855a; }
.action-sighting_updated { background-color: #2b6cb0; }
.action-sighting_deleted { background-color: var(--danger); }

.timeline-user {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.timeline-details {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.timeline-details code {
  font-size: 0.75rem;
  background-color: rgba(0, 0, 0, 0.04);
  padding: 1px 4px;
  border-radius: 2px;
  color: var(--secondary);
}

.timeline-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
}

.timeline-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ============================================= */
/* ======= DARK MODE OVERRIDES (ADMIN) ========= */
/* ============================================= */

[data-theme="dark"] #table-users tbody tr:hover, [data-theme="dark"] #table-forum-reports tbody tr:hover {
  background-color: rgba(180, 70, 80, 0.04);
}

[data-theme="dark"] .admin-card form input,
[data-theme="dark"] .admin-card form select {
  background-color: var(--bg-body);
  color: var(--text-main);
}

[data-theme="dark"] .timeline-details code {
  background-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .timeline-item::before {
  border-color: var(--bg-surface);
}

[data-theme="dark"] .activity-timeline-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

/* --- Admin Restructuring & Sub-tabs --- */
.admin-tab-nav {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
  padding-bottom: 0;
  flex-wrap: wrap;
}

.admin-tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-family: var(--font-family-sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-tab-btn:hover {
  color: var(--primary);
}

.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: rgba(107, 29, 36, 0.04);
}

.admin-sub-pane {
  display: none;
  animation: fadeIn var(--transition-fast) forwards;
}

.admin-sub-pane.active {
  display: block;
}

[data-theme="dark"] .admin-tab-btn.active {
  background-color: rgba(180, 70, 80, 0.04);
}

/* --- Support Tickets Chat & Interface --- */
.ticket-system-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  min-height: 520px;
  align-items: stretch;
}

.ticket-list-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-list-wrapper {
  overflow-y: auto;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.ticket-list-wrapper::-webkit-scrollbar {
  width: 4px;
}

.ticket-list-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(107, 29, 36, 0.1);
  border-radius: 2px;
}

[data-theme="dark"] .ticket-list-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.08);
}

.ticket-item {
  padding: 12px 14px;
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.ticket-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.ticket-item.active {
  border-color: var(--primary);
  background-color: rgba(107, 29, 36, 0.03);
}

[data-theme="dark"] .ticket-item.active {
  background-color: rgba(180, 70, 80, 0.03);
}

.ticket-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ticket-item-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.ticket-status-badge.status-open {
  background-color: rgba(40, 167, 69, 0.12);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.2);
}

.ticket-status-badge.status-closed {
  background-color: rgba(108, 117, 125, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(108, 117, 125, 0.2);
}

.ticket-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Chat Message Logs */
.ticket-chat-card {
  display: flex;
  flex-direction: column;
  height: 520px;
  max-height: 520px;
  text-align: left;
}

.ticket-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  gap: 8px;
  font-size: 0.88rem;
  padding: 40px;
  text-align: center;
}

.ticket-chat-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ticket-chat-header-title {
  font-family: var(--font-family-serif);
  font-size: 1.1rem;
  color: var(--secondary);
  margin: 0;
}

.ticket-messages-log {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.ticket-messages-log::-webkit-scrollbar {
  width: 4px;
}

.ticket-messages-log::-webkit-scrollbar-thumb {
  background-color: rgba(107, 29, 36, 0.1);
  border-radius: 2px;
}

[data-theme="dark"] .ticket-messages-log::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.08);
}

.chat-message-bubble {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-message-bubble.incoming {
  align-self: flex-start;
}

.chat-message-bubble.outgoing {
  align-self: flex-end;
}

.message-sender {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chat-message-bubble.outgoing .message-sender {
  text-align: right;
}

.message-text {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-line;
}

.chat-message-bubble.incoming .message-text {
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.chat-message-bubble.outgoing .message-text {
  background-color: var(--primary);
  color: #ffffff;
}

.message-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.chat-message-bubble.outgoing .message-time {
  text-align: right;
}

/* Chat Input Bar */
.ticket-chat-input-bar {
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  align-items: flex-end;
}

.ticket-chat-input-bar textarea {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-body);
  color: var(--text-color);
  font-family: inherit;
  font-size: 0.85rem;
  resize: none;
  height: 42px;
  transition: all var(--transition-fast);
}

.ticket-chat-input-bar textarea:focus {
  outline: none;
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .ticket-system-container {
    grid-template-columns: 1fr;
  }
}


