:root {
  --bg-primary: #edf2ff;
  --bg-secondary: #ffffff;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #3b82f6;
  --card-bg: #ffffff;
  --card-bg-light: #f1f5f9;
  --border-color: rgba(15, 23, 42, 0.12);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --success: #10b981;
  --warning: #f59e0b;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: #f0f4ff;
  background-image:
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(71, 219, 232, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(37, 99, 235, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(71, 219, 232, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem 3rem;
  gap: 2rem;
}

body.login-page {
  padding-top: 1.5rem;
}

.app-header {
  width: min(1200px, 100%);
  margin: 0 auto;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.detail-line {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.logo-image {
  height: 54px;
  width: auto;
}

.logo-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.15px;
}

.logo-subtitle {
  font-size: 0.8rem;
  color: #74dbe8;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-actions .nav-btn {
  background: transparent;
  color: #1e283e;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}

.nav-actions .nav-btn:hover,
.nav-actions .nav-btn.active {
  background: rgba(37, 99, 235, 0.08) !important;
  color: #2563eb !important;
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: none;
  transform: none;
}

.nav-actions .nav-btn-logout {
  background: #e71708;
  color: #f1f0ef;
}

.nav-actions .nav-btn-logout:hover {
  background: #f5130b !important;
  color: #fff !important;
}

.page-content {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-page .page-content {
  flex: 1;
  min-height: calc(100vh - 220px);
  justify-content: center;
}

.table-card {
  width: 100%;
  background: #fff;
  border-radius: 24px;
  padding: 1.5rem 1.5rem 2.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}


.table-card__header {
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-card__header h1 {
  margin: 0;
  font-size: 1rem;
}

.table-card__header p {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 1 rem;
}

.link-cell {
  text-align: center;
}

.timestamp-cell {
  color: var(--text-secondary);
  min-width: 160px;
}

/* Intro text */
.intro-text {
  text-align: center;
  max-width: 1000px;
  margin: 0 auto 2.5rem;
  font-size: 1.25rem;
  color: #101010;
  line-height: 1.6;
  font-weight: 500;
  animation: fadeInDown 0.8s ease-out;
}

.intro-text .highlight {
  color: var(--accent);
  font-weight: 700;
  position: relative;
  display: inline-block;
  padding: 0 4px;
}

.intro-text .highlight::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 100%;
  height: 8px;
  background: rgba(37, 99, 235, 0.08);
  z-index: -1;
  border-radius: 4px;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Upload Card */
.upload-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  width: 440px;
  text-align: center;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 20px 50px -12px rgba(15, 23, 42, 0.15);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin-bottom: 2rem;
}

.upload-card:hover {
  transform: translateY(-10px) scale(1.01);
  box-shadow: 0 30px 60px -12px rgba(15, 23, 42, 0.2);
  border-color: rgba(37, 99, 235, 0.3);
}

h1 {
  margin-bottom: 2rem;
  font-size: 1.85rem;
  font-weight: 735;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

/* Drop Area */
#dropArea {
  border: 2px dashed rgba(15, 23, 42, 0.15);
  border-radius: 14px;
  padding: 2.2rem 1rem;
  margin-bottom: 1.3rem;
  background: var(--card-bg-light);
  transition: all 0.3s ease;
}

#dropArea.dragover {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--accent);
}

input[type="file"] {
  display: none;
}

#fileLabel {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.2s ease;
}

#fileLabel:hover {
  transform: scale(1.05);
  background: var(--accent-hover);
  box-shadow: 0 4px 25px rgba(59, 130, 246, 0.4);
}

#fileList {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Buttons */
button {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

button:hover:enabled {
  transform: translateY(-2px);
  background: var(--accent-hover);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#message {
  margin-top: 1rem;
  font-weight: 500;
  min-height: 1.2em;
  color: var(--accent);
}

/* Info Section */
.info-section {
  display: flex;
  gap: 1.5rem;
  width: min(1000px, 100%);
  margin-top: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.info-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 1.5rem;
  flex: 1;
  min-width: 280px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.info-card:hover {
  transform: translateY(-5px);
  background: #fff;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.1);
  border-color: var(--accent-light);
}

.info-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
}

.info-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.info-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Loader */
.loader {
  border: 4px solid rgba(37, 99, 235, 0.15);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  animation: spin 1s linear infinite;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 10;
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes spin-simple {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.refresh-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  color: var(--accent);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.refresh-all-btn:hover:enabled {
  background: var(--bg-primary);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

.refresh-all-btn:active:enabled {
  transform: translateY(0);
}

.refresh-all-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.refresh-all-btn.is-refreshing .refresh-icon {
  display: inline-block;
  animation: spin-simple 1s linear infinite;
}

.refresh-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* Table */
table.dataTable {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border-color);
  margin-top: 2.5rem !important;
  width: 100% !important;
  overflow: hidden;
}

table.dataTable th {
  background: #eff4ff;
  color: var(--accent);
  font-weight: 600;
  text-transform: none !important;
  letter-spacing: 0.5px;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

table.dataTable td {
  color: var(--text-primary);
  padding: 0.9rem 1.2rem;
  line-height: 1.4;
  font-size: 0.92rem;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.dataTables_wrapper .dataTables_scroll {
  border-radius: 14px;
  overflow: hidden;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-primary) !important;
  border-radius: 6px;
  transition: background 0.3s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: rgba(37, 99, 235, 0.1) !important;
  color: var(--accent) !important;
}

.wrap-cell {
  white-space: normal;
}

.document-cell {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.filename-cell {
  font-weight: 600;
  color: var(--text-primary);
}

.table-link {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.35rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  word-wrap: break-word;
  transition: all 0.25s ease;
}

.table-link::before {
  content: "⇗";
  font-size: 0.85rem;
}

.table-link:hover {
  background: rgba(37, 99, 235, 0.18);
  color: #0f172a;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.2);
}

.status-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  color: var(--warning);
  font-weight: 600;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: rgba(245, 158, 11, 0.15);
  letter-spacing: 0.5px;
}

.dataTables_wrapper .dataTables_length select {
  background: #fff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 12px;
  padding-right: 2rem;
}

.dataTables_wrapper .dataTables_filter input {
  background: #fff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 0.4rem 0.6rem 0.4rem 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M15.5 14h-.79l-.28-.27A6 6 0 1 0 14 15.5l.27.28v.79l5 5l1.5-1.5zm-6 0a4.5 4.5 0 1 1 0-9a4.5 4.5 0 0 1 0 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
  background-size: 16px;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
  border-color: var(--accent);
}

.dataTables_wrapper .dataTables_length select option {
  background: #fff;
  color: var(--text-primary);
  padding: 0.5rem;
}

table.dataTable tbody tr:nth-child(even) {
  background: #f8fbff;
}

.dataTables_wrapper .dataTables_length label {
  color: var(--text-secondary);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_filter label {
  color: var(--text-secondary);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_info {
  color: rgba(71, 85, 105, 0.9);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.5;
  background: transparent !important;
}

.download-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  min-width: 110px;
  /* prevents shrinking */
  text-align: center;
  white-space: nowrap;
}

.download-btn:hover {
  transform: translateY(-2px);
  background: var(--accent-hover);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.download-btn:active {
  transform: scale(0.95);
}


.table-card .dataTables_length {
  margin-bottom: 10px !important;
}


.table-card .dataTables_filter {
  margin-bottom: 10px !important;
}


.message-text {
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.muted {
  color: #94a3b8;
}

.details-toggle {
  background: none !important;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.details-toggle:hover {
  text-decoration: underline;
}

.details-panel {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.85rem;
  margin-top: 0.75rem;
}

.details-panel.full-width {
  margin: 0;
  border-radius: 0 0 12px 12px;
  border-top: none;
}

.details-open {
  border-bottom: none;
}

table.dataTable>tbody>tr.child td {
  padding: 0 !important;
  background: transparent !important;
}

.details-open+tr.child .details-panel {
  border-top: 1px solid #e2e8f0;
}

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

.details-table thead th {
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  padding-bottom: 0.6rem;
}

.details-table tbody td {
  padding: 0.55rem 0;
  border-top: 1px solid #e2e8f0;
  vertical-align: top;
  color: var(--text-primary);
}

.details-table tbody tr:first-child td {
  border-top: none;
}

/* Prevent wrapping on metadata columns */
/* Prevent wrapping on metadata columns */
.details-table th:nth-child(1),
.details-table td:nth-child(1),
/* Task */
.details-table th:nth-child(2),
.details-table td:nth-child(2),
/* Completed at */
.details-table th:nth-child(3),
.details-table td:nth-child(3),
/* Status */
.details-table th:nth-child(4),
.details-table td:nth-child(4)

/* Time Taken */
  {
  white-space: nowrap;
  width: 1%;
  /* Shrink to fit content */
  padding-right: 1.5rem;
}

/* Description column takes remaining space */
.details-table th:nth-child(5),
.details-table td:nth-child(5) {
  width: auto;
}

.detail-line {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.detail-label {
  font-weight: 600;
  color: var(--text-primary);
}

.detail-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
}

.detail-status-success {
  background: #dcfce7;
  color: #166534;
}

.detail-status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.detail-status-partial {
  background: #fef9c3;
  color: #854d0e;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-success {
  background: #dcfce7;
  color: #166534;
}

.status-partial {
  background: #fef9c3;
  color: #854d0e;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-unknown {
  background: #e2e8f0;
  color: #475569;
}

.status-processing {
  background: #dbeafe;
  color: #1e40af;
}

.status-pending {
  background: #f1f5f9;
  color: #64748b;
}

.details-loading,
.details-error,
.details-empty {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.detail-status-unknown {
  background: #e2e8f0;
  color: #475569;
}

.detail-status-processing {
  background: #dbeafe;
  color: #1e40af;
}

.detail-status-pending {
  background: #f1f5f9;
  color: #64748b;
}

.details-error {
  color: #dc2626;
}

@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .nav-actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 1024px) {
  .upload-card {
    width: 90%;
  }

  table.dataTable {
    width: 100% !important;
  }

  table.dataTable th,
  table.dataTable td {
    padding: 0.75rem 0.9rem;
  }
}

@media (max-width: 640px) {
  body {
    padding: 2rem 0.5rem;
  }

  .nav-actions {
    gap: 0.5rem;
  }

  .nav-btn {
    flex: 1 1 100%;
    text-align: center;
  }

  .upload-card {
    padding: 2rem 1.5rem;
  }

  .table-link {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
  }

  table.dataTable td {
    font-size: 0.85rem;
  }
}

/* Action Buttons Container in Table */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  width: 100%;
}

.refresh-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  margin-left: auto;
}

.refresh-btn:hover:enabled {
  background: var(--bg-primary);
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(15deg);
}

.refresh-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  animation: spin 1s linear infinite;
}

/* Small Refresh Button for Details Table */
.refresh-btn-small {
  margin-left: 0;
  padding: 0;
  font-size: 0.9rem;
  background: transparent !important;
  border: none !important;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transform: translateY(1px);
  transition: color 0.2s ease, transform 0.2s ease;
  box-shadow: none !important;
}

.refresh-btn-small:hover:enabled {
  color: var(--accent);
  transform: translateY(1px) rotate(45deg);
}

.refresh-btn-small:active:enabled {
  transform: translateY(1px) scale(0.9);
}

.refresh-btn-small:disabled {
  opacity: 0.6;
  animation: spin-simple 1s linear infinite;
}