* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --background: #f8fafc;
  --foreground: #0f172a;

  --card: #ffffff;
  --border: #e2e8f0;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;

  --primary: #0f172a;
  --primary-foreground: #ffffff;

  --ring: rgba(59, 130, 246, 0.35);
  --radius: 10px;
}

.theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    width: auto;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f4f4f5;
    color: #18181b;
    font-size: 16px;
}

.toggle-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;

  padding: 10px 0;

  background: transparent;
  border: none;

  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);

  cursor: pointer;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--background);
  color: var(--foreground);
  margin: 24px;
  line-height: 1.5;
}

h2 {
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 700;
}

.filters {
  width: 280px;
  min-width: 280px;

  display: flex;
  flex-direction: column;
  gap: 12px;

  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;

  position: sticky;
  top: 20px;
}

.attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.attachment-thumbnail {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: transform 0.2s;
}

.attachment-thumbnail:hover {
  transform: scale(1.05);
}

input,
select {
  height: 38px;
  padding: 8px 10px;

  border: 1px solid var(--border);
  border-radius: 8px;

  background: white;
  color: var(--foreground);

  font-size: 14px;

  outline: none;
  transition: 0.15s ease;
}

.main-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.table-container {
  flex: 1;
  min-width: 0;
}

input:focus,
select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px var(--ring);
}

button {
  height: 38px;
  padding: 0 12px;

  border-radius: 8px;
  border: 1px solid var(--border);

  background: white;
  color: var(--foreground);

  font-weight: 500;
  font-size: 14px;

  cursor: pointer;
  transition: 0.15s ease;
}

button:hover {
  background: var(--muted);
}

button:active {
  transform: scale(0.98);
}

.filters button {
  background: #0f172a;
  color: white;
  border-color: #0f172a;
}

.filters button:hover {
  background: #1e293b;
}

#give-feedback {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 38px;
  padding: 0 12px;

  border-radius: 8px;
  border: 1px solid var(--border);

  color: var(--foreground);

  text-decoration: none;
  font-size: 14px;
  font-weight: 500;

  transition: 0.15s ease;
}

#give-feedback:hover {
  background: var(--muted);
}

#give-feedback:active {
  transform: scale(0.98);
}

#export-csv {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 38px;
  padding: 0 12px;

  border-radius: 8px;
  border: 1px solid var(--border);

  background: white;
  color: var(--foreground);

  text-decoration: none;
  font-size: 14px;
  font-weight: 500;

  transition: 0.15s ease;
}

#export-csv:hover {
  background: var(--muted);
}

#export-csv:active {
  transform: scale(0.98);
}

.search-bar-and-filter-button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-bar-and-filter-button input {
  flex: 1;
}

.search-bar-and-filter-button button {
  flex-shrink: 0;
}

table {
  width: 100%;
  border-collapse: collapse;

  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  background: var(--muted);
  font-weight: 600;
}

.pagination {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.badge {
  display: inline-flex;
  align-items: center;

  padding: 3px 10px;
  border-radius: 999px;

  font-size: 12px;
  font-weight: 500;

  border: 1px solid var(--border);
  background: var(--muted);
}

.open {
  background: #eff6ff;
  color: #2563eb;
  border-color: #dbeafe;
}

.inprogress {
  background: #fefce8;
  color: #ca8a04;
  border-color: #fde68a;
}

.waiting {
  background: #f5f3ff;
  color: #7c3aed;
  border-color: #e9d5ff;
}

.resolved {
  background: #ecfdf5;
  color: #16a34a;
  border-color: #bbf7d0;
}

.closed {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

.low {
  background: #ecfdf5;
  color: #16a34a;
}

.medium {
  background: #fefce8;
  color: #ca8a04;
}

.high {
  background: #fef2f2;
  color: #dc2626;
}

.critical {
  background: #0f172a;
  color: white;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  overflow: auto;
}

.modal-content {
  background: white;
  width: min(900px, 95%);
  margin: 40px auto;

  padding: 20px;
  border-radius: var(--radius);

  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =========================
   Misc
========================= */
.view-btn {
  background: white;
  border: 1px solid var(--border);
}

.view-btn:hover {
  background: var(--muted);
}

.rating-1 {
  background: #fef2f2;
  color: #dc2626;
}

.rating-2 {
  background: #fff7ed;
  color: #ea580c;
}

.rating-3 {
  background: #fefce8;
  color: #ca8a04;
}

.rating-4 {
  background: #ecfdf5;
  color: #16a34a;
}

.rating-5 {
  background: #eff6ff;
  color: #2563eb;
}

.image-preview-modal {
  display: none;
  position: fixed;
  z-index: 99999;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);

  justify-content: center;
  align-items: center;
}

.image-preview-content {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 10px;
}

.image-preview-close {
  position: absolute;
  top: 20px;
  right: 35px;

  color: white;
  font-size: 40px;
  cursor: pointer;
  font-weight: bold;
}

.image-preview-close:hover {
  opacity: 0.8;
}

body.dark {
  --background: #0a0a0a;
  --foreground: #e5e5e5;

  --card: #111111;
  --border: #27272a;
  --muted: #1f1f23;
  --muted-foreground: #a1a1aa;

  --primary: #ffffff;
  --primary-foreground: #0a0a0a;

  --ring: rgba(59, 130, 246, 0.25);
}

body.dark table {
  background: #111;
  border-color: #27272a;
}

body.dark th {
  background: #1f1f23;
}

body.dark td {
  border-bottom: 1px solid #27272a;
}

body.dark .modal-content {
  background: #111;
  border-color: #27272a;
}

body.dark .modal {
  background: rgba(0, 0, 0, 0.7);
}

body.dark .badge {
  background: #1f1f23;
  border-color: #27272a;
  color: #e5e5e5;
}

body.dark button {
  background: #1f1f23;
  border-color: #27272a;
  color: #e5e5e5;
}

body.dark div {
  color: #e5e5e5;
}

body.dark .attachment-thumbnail {
  border-color: #27272a;
}

body.dark input,
body.dark select {
  background: #18181b;
  color: #e5e5e5;
  border-color: #27272a;
}

body {
  transition: background 0.2s ease, color 0.2s ease;
}

.card,
table,
input,
select,
button {
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body.dark #viewFeedbackButton{
  background-color: #0a0a0a;
}