/* ============================================================
   NewsForge — App-specific styles
   Extends TAE design system for admin workspace
   ============================================================ */


/* --- Login page --- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--tae-grey-light);
}

.login-card {
  background: var(--tae-white);
  border-radius: 8px;
  padding: var(--tae-space-10);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.login-header {
  text-align: center;
  margin-bottom: var(--tae-space-8);
}

.login-title {
  font-family: var(--tae-font-heading);
  font-size: 1.6rem;
  color: var(--tae-blue-deep);
  margin-bottom: var(--tae-space-2);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--tae-space-4);
}

.login-btn {
  width: 100%;
  margin-top: var(--tae-space-2);
}


/* --- Forms --- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--tae-space-1);
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tae-black);
}

.form-input {
  font-family: var(--tae-font-body);
  font-size: 0.9375rem;
  padding: var(--tae-space-3) var(--tae-space-4);
  border: 1px solid var(--tae-grey-border);
  border-radius: 4px;
  background: var(--tae-white);
  color: var(--tae-black);
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--tae-blue);
  box-shadow: 0 0 0 3px rgba(29, 164, 255, 0.12);
}

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


/* --- Alerts --- */

.alert {
  font-size: 0.875rem;
  padding: var(--tae-space-3) var(--tae-space-4);
  border-radius: 4px;
  margin-bottom: var(--tae-space-4);
}

.alert--error {
  background: #fef2f2;
  color: var(--tae-error);
  border: 1px solid #fecaca;
}

.alert--success {
  background: #f0fdf4;
  color: var(--tae-success);
  border: 1px solid #bbf7d0;
}


/* --- App wordmark --- */

.app-wordmark {
  font-family: var(--tae-font-heading);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--tae-blue-deep);
  letter-spacing: -0.01em;
}


/* --- Nav user --- */

.site-nav__user {
  font-size: 0.875rem;
  color: var(--tae-grey-mid);
}


/* --- Issue table --- */

.issue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.issue-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tae-grey-mid);
  padding: var(--tae-space-3) var(--tae-space-4);
  border-bottom: 2px solid var(--tae-grey-border);
}

.issue-table td {
  padding: var(--tae-space-3) var(--tae-space-4);
  border-bottom: 1px solid var(--tae-grey-border);
  vertical-align: middle;
}

.issue-table tbody tr:hover {
  background: var(--tae-grey-soft);
}


/* --- Status badges --- */

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 12px;
}

.status-badge--draft {
  background: var(--tae-grey-light);
  color: var(--tae-grey-mid);
}

.status-badge--in_progress {
  background: #dbeafe;
  color: var(--tae-blue-deep);
}

.status-badge--completed {
  background: #f0fdf4;
  color: var(--tae-success);
}

.status-badge--sent {
  background: #ecfdf5;
  color: #065f46;
}


/* --- Empty state --- */

.empty-state {
  text-align: center;
  padding: var(--tae-space-16) var(--tae-space-8);
  color: var(--tae-grey-mid);
}

.empty-state p {
  font-size: 1rem;
}


/* --- Issue layout --- */

.issue-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--tae-space-8);
  align-items: start;
}

@media (max-width: 980px) {
  .issue-layout {
    grid-template-columns: 1fr;
  }
}

/* --- URL queue --- */

.url-add-form textarea {
  resize: vertical;
}

.url-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.url-item {
  padding: var(--tae-space-3) var(--tae-space-4);
  border: 1px solid var(--tae-grey-border);
  border-radius: 4px;
  margin-bottom: var(--tae-space-2);
  transition: background 0.15s ease;
}

.url-item:hover {
  background: var(--tae-grey-soft);
}

.url-item--selected {
  border-color: var(--tae-blue);
  background: rgba(29, 164, 255, 0.04);
}

.url-item__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tae-space-3);
}

.url-item__link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--tae-black);
}

.url-item__label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.url-item__url {
  display: block;
  font-size: 0.75rem;
  color: var(--tae-grey-mid);
  overflow-y: auto;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-item__meta {
  display: flex;
  align-items: center;
  gap: var(--tae-space-2);
  flex-shrink: 0;
}


/* --- Status dots --- */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot--success { background: var(--tae-success); }
.status-dot--error { background: var(--tae-error); }
.status-dot--pending { background: var(--tae-grey-mid); }
.status-dot--fetching { background: var(--tae-blue); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}


/* --- Small button variant --- */

.btn--small {
  font-size: 0.75rem;
  padding: 0.3em 0.8em;
}


/* --- Reading pane --- */

.reading-pane {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.reading-pane__header {
  padding-bottom: var(--tae-space-4);
  border-bottom: 1px solid var(--tae-grey-border);
  margin-bottom: var(--tae-space-4);
}

.reading-pane__content {
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.reading-pane__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  border: 1px dashed var(--tae-grey-border);
  border-radius: 8px;
}


/* --- Story cards --- */

.story-card {
  border: 1px solid var(--tae-grey-border);
  border-radius: 4px;
  padding: var(--tae-space-4);
  margin-bottom: var(--tae-space-3);
}

.story-card__header {
  display: flex;
  align-items: center;
  gap: var(--tae-space-3);
  margin-bottom: var(--tae-space-2);
}

.story-card__order {
  font-size: 0.75rem;
  font-weight: 700;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--tae-grey-light);
  color: var(--tae-black);
  flex-shrink: 0;
}

.story-card__classifier {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--tae-blue-deep);
}

.story-card__angle {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--tae-black);
}

.story-card__urls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tae-space-1);
  margin-top: var(--tae-space-2);
}

.story-card__url-tag {
  font-size: 0.6875rem;
  background: var(--tae-grey-light);
  padding: 1px 8px;
  border-radius: 10px;
  color: var(--tae-grey-mid);
}


/* --- Add story form --- */

.add-story-form {
  border: 1px dashed var(--tae-grey-border);
  border-radius: 8px;
  padding: var(--tae-space-6);
  background: var(--tae-grey-soft);
}


/* --- Reverse brief --- */

.reverse-brief-content {
  font-size: 0.875rem;
  line-height: 1.6;
  padding: var(--tae-space-6);
  background: var(--tae-grey-soft);
  border-radius: 8px;
  border-left: 3px solid var(--tae-blue);
}


/* --- Draft cards --- */

.draft-card {
  border: 1px solid var(--tae-grey-border);
  border-radius: 8px;
  padding: var(--tae-space-6);
  margin-bottom: var(--tae-space-6);
  transition: box-shadow 0.15s ease;
}

.draft-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.draft-card__header {
  display: flex;
  align-items: center;
  gap: var(--tae-space-3);
  margin-bottom: var(--tae-space-4);
}

.draft-card__handle {
  cursor: grab;
  color: var(--tae-grey-mid);
  font-size: 1.2rem;
  user-select: none;
}

.draft-card__handle:active {
  cursor: grabbing;
}

.draft-heading {
  font-family: var(--tae-font-heading);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: var(--tae-space-3);
  cursor: text;
}

.draft-body {
  font-size: 0.875rem;
  line-height: 1.65;
  white-space: pre-wrap;
  cursor: text;
}

.draft-card__actions {
  display: flex;
  gap: var(--tae-space-3);
  margin-top: var(--tae-space-4);
  padding-top: var(--tae-space-3);
  border-top: 1px solid var(--tae-grey-border);
}

.draft-card__empty {
  padding: var(--tae-space-4) 0;
}

.draft-edit-area {
  font-size: 0.875rem;
  line-height: 1.65;
  min-height: 200px;
  font-family: var(--tae-font-body);
}

/* SortableJS ghost */
.sortable-ghost {
  opacity: 0.3;
}


/* --- Export preview --- */

.export-preview {
  border: 1px solid var(--tae-grey-border);
  border-radius: 8px;
  padding: var(--tae-space-8);
  background: var(--tae-white);
}

.export-story {
  margin-bottom: var(--tae-space-8);
}

.export-story:last-child {
  margin-bottom: 0;
}

.export-story__heading {
  font-family: var(--tae-font-heading);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: var(--tae-space-3);
}

.export-story__body {
  font-size: 0.875rem;
  line-height: 1.65;
  white-space: pre-wrap;
}


/* --- Proof report --- */

.proof-report {
  font-size: 0.875rem;
  line-height: 1.65;
  padding: var(--tae-space-6);
  background: var(--tae-grey-soft);
  border-radius: 8px;
  border-left: 3px solid var(--tae-success);
}

/* --- Full-width textareas --- */

.url-add-form textarea,
.login-form textarea {
  width: 100%;
}

.url-add-form,
form:has(textarea[name="brief"]) {
  display: flex;
  flex-direction: column;
}

/* --- Warning/amber status dot --- */

.status-dot--warning {
  background: var(--tae-warning);
  animation: pulse 1s infinite;
}

/* --- Draft edit area full width --- */

.draft-edit-area {
  width: 100% !important;
  min-height: 100px;
  resize: vertical;
}

/* Match edit area to draft body appearance */
.draft-edit-area {
  font-size: 0.875rem !important;
  line-height: 1.65 !important;
  font-family: var(--tae-font-body) !important;
  white-space: pre-wrap;
  overflow-y: auto;
}
