:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
}

/* Base Styles */
html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-50);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  padding: 2rem 0;
  min-height: calc(100vh - 140px);
}

/* Navigation */
.main-nav {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1rem 0;
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--gray-900);
}

.nav-logo {
  height: 40px; /* Adjust the height as needed */
  margin-right: 0.5rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
}

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

.nav-links a {
  text-decoration: none;
  color: var(--gray-700);
}

.nav-search {
  max-width: 500px;
  width: 100%;
}

.nav-search input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  background: white;
  font-size: 0.875rem;
}

.nav-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Cards */
.artifacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.artifact-card {
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.artifact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.artifact-thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
}

.artifact-info {
  padding: 1rem;
}

/* Forms */
form div {
  margin-bottom: 1rem;
}

input[type="text"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  font-size: 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: var(--primary);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid currentColor;
  color: var(--primary);
}

/* Media Display */
.media-display {
  margin: 2rem 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.plyr {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Responsive Media */
.media-display img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 0.375rem;
}

/* Optional: Add a subtle shadow and hover effect */
.media-display img:not(.artifact-thumbnail) {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-display img:not(.artifact-thumbnail):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .media-display img:not(.artifact-thumbnail) {
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .nav-content {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .brand {
    text-align: center;
  }

  .nav-search {
    width: 100%;
    max-width: 600px;
  }

  .nav-links {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 1.5rem;
  }
}

/* Admin Info */
.admin-info {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--gray-100);
  border-radius: 0.375rem;
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 0.375rem;
  margin: 1rem 0;
}

.alert-warning {
  background: #fef3c7;
  color: var(--warning);
  border: 1px solid #fcd34d;
}

/* Page Header */
.page-header {
  margin-bottom: 2rem;
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .page-header {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

/* Search */
.search-form {
  position: relative;
  max-width: 500px;
}

.search-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  background: white;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Type Icons */
.artifact-type-icon {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 1.5rem;
  text-transform: uppercase;
}

/* Pagination */
.pagination-container {
  margin: 2rem 0;
  display: flex;
  justify-content: center;
}

.pagination {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
}

.page-item {
  display: inline-block;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  text-decoration: none;
  transition: all 0.2s;
}

.page-link:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.page-item.disabled .page-link {
  background: var(--gray-50);
  color: var(--gray-400);
  pointer-events: none;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-50: #18181b;
    --gray-100: #27272a;
    --gray-200: #3f3f46;
    --gray-300: #52525b;
    --gray-600: #a1a1aa;
    --gray-700: #d4d4d8;
    --gray-800: #e4e4e7;
    --gray-900: #fafafa;
  }

  input[type="text"],
  input[type="search"],
  select,
  textarea {
    color: var(--gray-700);
    background: var(--gray-100);
  }

  input[type="text"]::placeholder,
  input[type="search"]::placeholder {
    color: var(--gray-600);
  }

  body {
    background: var(--gray-50);
    color: var(--gray-800);
  }

  .main-nav,
  .artifact-card,
  .media-display {
    background: var(--gray-100);
  }

  input, select, textarea {
    background: var(--gray-100);
    color: var(--gray-800);
  }

    .page-link {
      color: #fff;
      /* Make the page numbers white/bright for better visibility */
    }

  .page-link:hover {
    color: var(--gray-100);
    background-color: var(--gray-700);
  }
}

/* Form Styles */
.artifact-form {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-section {
  display: grid;
  gap: 1rem;
}

.form-section.full-width {
  grid-column: 1 / -1;
}

.form-group {
  display: grid;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  color: var(--gray-700);
}

.map-picker {
  height: 300px;
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.file-preview {
  margin-top: 1rem;
  max-width: 100%;
}

.file-preview img,
.file-preview video,
.file-preview audio {
  max-width: 100%;
  border-radius: 0.375rem;
}

.form-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .artifact-form {
    background: var(--gray-100);
  }
}

/* Plyr customization */
.plyr {
  border-radius: 0.375rem;
  overflow: hidden;
}

/* Article layout */
.artifact {
  max-width: 800px;
  margin: 0 auto;
}

.artifact-content {
  margin: 1rem 0;
  line-height: 1.6;
}

/* Footer */
.main-footer {
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 4rem 0 2rem;
  margin-top: 4rem;
  font-size: 0.875rem;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  margin-bottom: 2rem;
}

.footer-brand h2 {
  color: var(--gray-900);
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}

.footer-brand p {
  color: var(--gray-600);
  margin: 0;
  font-size: 0.875rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2rem;
}

.footer-section h3 {
  color: var(--gray-900);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 1rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: 0.75rem;
}

.footer-section a {
  color: var(--gray-600);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-section a:hover {
  color: var(--gray-900);
  text-decoration: none;
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  color: var(--gray-600);
  font-size: 0.75rem;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .main-footer {
    background: var(--gray-100);
    border-color: var(--gray-200);
  }

  .footer-brand h2,
  .footer-section h3 {
    color: var(--gray-800);
  }

  .footer-section a:hover {
    color: var(--gray-800);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer-links {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

/* Base Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--gray-900);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Artifact Show Page */
.artifact-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
}

.artifact-header h1 {
  margin: 0;
}

.admin-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.admin-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #b91c1c;
  text-decoration: none;
}

.artifact-caption {
  font-size: 1.125rem;
  color: var(--gray-600);
  margin-bottom: 2rem;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .artifact-caption {
    color: var(--gray-400);
  }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .artifact-header {
    flex-direction: column;
    gap: 1rem;
  }

  .admin-actions {
    width: 100%;
  }

  .admin-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

.responsive-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 0.375rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.responsive-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.artifact-media {
  position: relative;
  height: 200px;
  background: var(--gray-100);
  overflow: hidden;
}

/* Add styles for embedded thumbnails */
.artifact-media.embed-preview {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.artifact-media.embed-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s;
}

.artifact-media.embed-preview:hover::before {
  background: rgba(0, 0, 0, 0.5);
}

.artifact-media.embed-preview .media-icon {
  position: relative;
  z-index: 1;
}

.media-placeholder {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--gray-400);
  transition: all 0.2s ease;
}

.media-placeholder:hover {
  background: var(--gray-200);
  color: var(--primary);
}

.media-placeholder .media-icon {
  transform: scale(1.2);
  transition: transform 0.2s ease;
}

.media-placeholder:hover .media-icon {
  transform: scale(1.3);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .media-placeholder {
    background: var(--gray-800);
    color: var(--gray-600);
  }

  .media-placeholder:hover {
    background: var(--gray-700);
    color: var(--primary);
  }
}

.media-icon {
  transition: transform 0.2s;
}

.artifact-card:hover .media-icon {
  transform: scale(1.1);
}

/* Authentication Forms */
.auth-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  font-size: 1.5rem;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field label {
  font-weight: 500;
  color: var(--gray-700);
}

.form-field input {
  padding: 0.625rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-submit {
  margin-top: 1rem;
}

.auth-submit button {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auth-submit button:hover {
  background: var(--primary-dark);
}

.auth-links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
}

.auth-links a {
  color: var(--primary);
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* Flash Messages */
.flash {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 0.375rem;
  text-align: center;
}

.flash.notice {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.flash.alert {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .auth-container {
    background: var(--gray-50);
  }

  .form-field label {
    color: var(--gray-800);
  }

  .form-field input {
    background: white;
  }

  .flash.notice {
    background: #1e40af1a;
  }

  .flash.alert {
    background: #b91c1c1a;
  }
}

/* Local player styling */
.plyr--audio.plyr--local {
  background: transparent;
}

.plyr--local .plyr__controls {
  padding: 0;
  background: transparent;
  border: none;
}

.plyr--local .plyr__control--overlaid {
  background: var(--primary);
}

.plyr--local .plyr__control--overlaid:hover {
  background: var(--primary-dark);
}

/* Hide all controls except play button */
.plyr--local .plyr__controls > *:not(.plyr__control--overlaid) {
  display: none;
}

/* Embedded Media */
.embedded-media {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  background: var(--gray-100);
  border-radius: 0.5rem;
  overflow: hidden;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.embedded-media iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .embedded-media {
    background: var(--gray-200);
  }

  .embedded-media iframe {
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .embedded-media {
    margin: 1rem auto;
  }
}

/* Find and update any auth-specific input styles */
.auth-container input[type="email"],
.auth-container input[type="password"] {
  background: var(--gray-100); /* Use theme variable instead of white */
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

@media (prefers-color-scheme: dark) {
  .auth-container input[type="email"],
  .auth-container input[type="password"] {
    background: var(--gray-100);
    color: #fff;
    border-color: var(--gray-300);
  }
}