/* Admin Shared Styles */

/* Admin Container */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.admin-edit-container,
.edit-dossier-container,
.edit-post-container,
.edit-link-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Admin Header */
.admin-header,
.edit-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.admin-header h1,
.edit-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem 0;
}

.admin-header .count {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0;
}

.slug-display {
  color: #6b7280;
  font-size: 0.95rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  margin: 0;
}

/* Messages */
.success-message {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.success-message p {
  color: #166534;
  margin: 0;
  font-weight: 500;
}

.error-message,
.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.error-message p,
.error-box p {
  color: #991b1b;
  margin: 0;
}

/* Links */
.back-link {
  color: var(--color-link, #3b82f6);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

/* Forms */
.edit-form {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  color: #111827;
  transition: all 0.2s;
  font-family: inherit;
}

.form-textarea {
  resize: vertical;
  min-height: 200px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-link, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.url-input {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
}

.metadata-grid dd.tags-list {
  font-family: inherit;
  word-break: break-word;
}

.form-checkbox {
  margin-right: 0.5rem;
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.form-group label:has(.form-checkbox) {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.help-text {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.4;
}

/* Metadata Box */
.metadata-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.metadata-box h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.metadata-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem 1.5rem;
  font-size: 0.875rem;
}

.metadata-grid dt {
  color: #6b7280;
  font-weight: 500;
}

.metadata-grid dd {
  color: #111827;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  margin: 0;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-save {
  padding: 0.625rem 1.5rem;
  background: var(--color-link, #3b82f6);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-save:hover {
  background: var(--color-link-hover, #2563eb);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-cancel,
.btn-preview {
  padding: 0.625rem 1.5rem;
  background: #f3f4f6;
  color: #374151;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}

.btn-cancel:hover {
  background: #e5e7eb;
}

.btn-preview {
  background: #f9fafb;
  border: 1px solid #d1d5db;
}

.btn-preview:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.btn-delete {
  padding: 0.625rem 1.5rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
  font-family: inherit;
}

.btn-delete:hover {
  background: #dc2626;
}

/* Admin List Pages */
.admin-list-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.admin-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.admin-list-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem 0;
}

.admin-list-header .count {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0;
}

.btn-create {
  padding: 0.625rem 1.25rem;
  background: var(--color-link, #3b82f6);
  color: white;
  border-radius: 0.5rem;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-create:hover {
  background: var(--color-link-hover, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-button {
  padding: 0.625rem 1.25rem;
  background: #f3f4f6;
  color: #374151;
  border-radius: 0.5rem;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.back-button:hover {
  background: #e5e7eb;
  transform: translateX(-2px);
}

/* List Styles */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-card {
  display: block;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  text-decoration: none;
  transition: all 0.2s;
  color: inherit;
}

.admin-card:hover {
  border-color: var(--color-link, #3b82f6);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.admin-card-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.admin-card-info {
  flex: 1;
  min-width: 0;
}

.admin-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: #111827;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.admin-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.admin-card-action {
  flex-shrink: 0;
}

.admin-card-action span {
  color: var(--color-link, #3b82f6);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Search Section */
.search-section {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.95rem;
}

.tag-filter {
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  min-width: 150px;
}

/* Articles Box (used in dossier edit pages) */
.articles-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.articles-box h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.articles-box .articles-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
}

.articles-box .articles-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.articles-box .articles-list li:last-child {
  border-bottom: none;
}

.article-link {
  color: var(--color-link, #3b82f6);
  text-decoration: none;
  font-size: 0.875rem;
}

.article-link:hover {
  text-decoration: underline;
}

.more-articles {
  color: #6b7280;
  font-style: italic;
}

/* Parent Info Box (used in post edit pages) */
.parent-info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.parent-info-box h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e40af;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
}

.parent-info-box p {
  color: #1e3a8a;
  margin: 0 0 0.5rem 0;
}

.parent-link {
  color: var(--color-link, #3b82f6);
  text-decoration: none;
  font-size: 0.875rem;
}

.parent-link:hover {
  text-decoration: underline;
}

/* Test Link Button */
.btn-test {
  padding: 0.625rem 1.5rem;
  background: #f9fafb;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}

.btn-test:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* Submissions-specific styles */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-btn:hover {
  background: #f9fafb;
}

.filter-btn.active {
  background: var(--color-link, #9e722e);
  color: white;
  border-color: var(--color-link, #9e722e);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 0.5rem;
}

.submission-card {
  display: block;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.submission-card:hover {
  border-color: var(--color-link, #9e722e);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.submission-card.status-pending {
  border-left: 4px solid #f59e0b;
}

.submission-card.status-read {
  border-left: 4px solid #3b82f6;
}

.submission-card.status-archived {
  border-left: 4px solid #9ca3af;
  opacity: 0.7;
}

.submission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-read {
  background: #dbeafe;
  color: #1e40af;
}

.badge-archived {
  background: #f3f4f6;
  color: #6b7280;
}

.submission-type {
  font-size: 0.8rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.submission-name {
  font-size: 1.1rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.25rem;
}

.submission-email {
  font-size: 0.9rem;
  color: var(--color-link, #9e722e);
  margin-bottom: 0.5rem;
}

.submission-preview {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.submission-date {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Attachments-specific styles */
.upload-section {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 2rem;
  margin-bottom: 2rem;
}

.upload-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1.5rem 0;
}

.upload-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.btn-upload {
  padding: 0.625rem 1.5rem;
  background: var(--color-link, #3b82f6);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.btn-upload:hover {
  background: var(--color-link-hover, #2563eb);
}

.attachment-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.attachment-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.attachment-info {
  flex: 1;
  min-width: 0;
}

.attachment-filename {
  font-size: 1rem;
  font-weight: 500;
  color: #111827;
  margin: 0 0 0.5rem 0;
}

.attachment-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: #6b7280;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.attachment-id {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.attachment-refs {
  color: var(--color-link, #3b82f6);
  font-weight: 500;
}

.attachment-references {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.attachment-references strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #374151;
}

.attachment-references ul {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0 0;
}

.attachment-references li {
  padding: 0.25rem 0;
}

.attachment-references a {
  color: var(--color-link, #3b82f6);
  text-decoration: none;
}

.attachment-references a:hover {
  text-decoration: underline;
}

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

.btn-view {
  padding: 0.625rem 1.25rem;
  background: #f3f4f6;
  color: #374151;
  border-radius: 0.375rem;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-view:hover {
  background: #e5e7eb;
}

/* Responsive */
@media (max-width: 640px) {

  .admin-container,
  .admin-edit-container,
  .admin-list-container {
    padding: 1rem 0.75rem;
  }

  .admin-header,
  .edit-header,
  .admin-list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .admin-header>div:last-child,
  .admin-list-header>div:last-child {
    width: 100%;
    flex-direction: column;
  }

  .btn-create,
  .back-button {
    width: 100%;
    text-align: center;
  }

  .edit-form {
    padding: 1.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-delete {
    margin-left: 0;
  }

  .metadata-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .metadata-grid dt {
    font-weight: 600;
  }

  .admin-card {
    padding: 1rem;
  }

  .admin-card-content {
    gap: 1rem;
  }

  .admin-card-title {
    font-size: 0.95rem;
  }

  .admin-card-meta {
    flex-direction: column;
    gap: 0.25rem;
  }

  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .filter-btn {
    flex-shrink: 0;
  }

  .upload-form {
    flex-direction: column;
    align-items: stretch;
  }

  .attachment-content {
    flex-direction: column;
    align-items: stretch;
  }

  .attachment-actions {
    width: 100%;
    justify-content: stretch;
  }

  .btn-view,
  .btn-delete {
    flex: 1;
    text-align: center;
  }
}