/* ==========================================================================
   DAILY EXPRESS PUBLISHER - MODERN EDITORIAL DESIGN SYSTEM
   ========================================================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #162032;
  --bg-card-hover: #1c2940;
  --bg-input: #0c121e;
  
  --border-color: #233148;
  --border-focus: #e11d48;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  
  --accent-red: #e11d48;
  --accent-red-hover: #f43f5e;
  --accent-red-glow: rgba(225, 29, 72, 0.25);
  
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(225, 29, 72, 0.35);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ================= HEADER ================= */
.header-bar {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-logo b {
  color: var(--accent-red);
}

.brand-badge {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(225, 29, 72, 0.15);
  color: var(--accent-red);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
  transition: var(--transition);
}

.status-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-dot.offline {
  background-color: var(--accent-red);
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.6);
}

.btn-visit-site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition);
}

.btn-visit-site:hover {
  color: #fff;
  border-color: var(--border-color);
  background: var(--bg-card);
}

/* ================= NAVIGATION TABS ================= */
.nav-tabs-wrapper {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.nav-tabs {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-tab:hover {
  color: #fff;
}

.nav-tab.active {
  color: #fff;
  border-bottom-color: var(--accent-red);
}

.nav-tab .badge-count {
  font-size: 11px;
  background: var(--bg-card);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  color: var(--text-faint);
}

.nav-tab.active .badge-count {
  background: rgba(225, 29, 72, 0.2);
  color: var(--accent-red);
}

/* ================= MAIN CONTAINER ================= */
.main-wrapper {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
  flex: 1;
  width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= EDITOR WORKSPACE LAYOUT ================= */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1080px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.form-label span.req {
  color: var(--accent-red);
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #fff;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

.form-control::placeholder {
  color: var(--text-faint);
}

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

.input-title {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Lora', Georgia, serif;
  padding: 14px 16px;
}

/* ARTICLE TYPE TOGGLE */
.type-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.type-toggle-btn {
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.type-toggle-btn.active {
  background: var(--accent-red);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* COVER IMAGE SECTION */
.cover-uploader {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-input);
  text-align: center;
  transition: var(--transition);
  position: relative;
}

.cover-uploader.dragover {
  border-color: var(--accent-red);
  background: rgba(225, 29, 72, 0.05);
}

.cover-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.cover-tab-btn {
  flex: 1;
  padding: 7px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.cover-tab-btn.active {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--text-muted);
}

.cover-preview-box {
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #000;
  position: relative;
  display: none;
}

.cover-preview-box.show {
  display: block;
}

.cover-preview-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.cover-preview-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  padding: 10px 12px;
  font-size: 11px;
  color: #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.btn-remove-cover {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove-cover:hover {
  background: var(--accent-red);
}

/* ================= RICH TEXT EDITOR ================= */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 8px;
}

.tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

.tool-btn:hover {
  background: var(--bg-card);
  color: #fff;
  border-color: var(--border-color);
}

.tool-separator {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 4px 4px;
}

.editor-content-area {
  min-height: 380px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 18px;
  font-family: 'Lora', Georgia, serif;
  font-size: 17px;
  line-height: 1.8;
  color: #e2e8f0;
  outline: none;
  overflow-y: auto;
}

.editor-content-area:focus {
  border-color: var(--border-focus);
}

.editor-content-area p {
  margin-bottom: 1.2em;
}

.editor-content-area h2, .editor-content-area h3 {
  color: #fff;
  margin: 1.5em 0 0.5em;
  font-weight: 700;
}

.editor-content-area blockquote {
  border-left: 3px solid var(--accent-red);
  padding: 8px 16px;
  margin: 1.2em 0;
  background: rgba(225, 29, 72, 0.05);
  color: #cbd5e1;
  font-style: italic;
}

.editor-content-area img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.2em 0;
}

.editor-footer-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

/* CHAPTERS LIST (MULTI-CHAPTER) */
.chapter-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  position: relative;
}

.chapter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chapter-number {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-red);
  text-transform: uppercase;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-red-glow);
}

.btn-primary:hover {
  background: var(--accent-red-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--accent-green);
  color: #fff;
}

.btn-outline-danger {
  background: transparent;
  border-color: rgba(225, 29, 72, 0.4);
  color: #f87171;
}

.btn-outline-danger:hover {
  background: rgba(225, 29, 72, 0.15);
  border-color: var(--accent-red);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* ================= TABLE & LISTS ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pill.published {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.draft {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.lang-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ================= MODAL & LIVE PREVIEW ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.show {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 900px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* DAILY EXPRESS WEBSITE PREVIEW STYLES */
.site-preview-container {
  background: #ffffff;
  color: #17181c;
  padding: 32px 24px;
  border-radius: var(--radius-md);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.preview-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid #17181c;
  margin-bottom: 24px;
}

.preview-logo b {
  color: #c8102e;
}

.preview-meta {
  font-size: 13px;
  color: #636974;
  margin-bottom: 12px;
}

.preview-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  color: #17181c;
  margin-bottom: 20px;
}

.preview-cover-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 24px;
  display: block;
}

.preview-body-content {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  line-height: 1.75;
  color: #24292e;
}

.preview-body-content p {
  margin-bottom: 1.4em;
}

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-red);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  min-width: 300px;
  max-width: 450px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast.success {
  border-left-color: var(--accent-green);
}

.toast.error {
  border-left-color: var(--accent-red);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* SPINNER */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================= AUTHENTICATION & LOGIN SCREEN ================= */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: radial-gradient(circle at 50% 20%, #17233a 0%, #0a0e17 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(16px);
}

.login-card {
  width: 440px;
  max-width: 100%;
  background: rgba(22, 32, 50, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  animation: loginScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-gold));
}

@keyframes loginScaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.login-brand-logo b {
  color: var(--accent-red);
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.login-error-alert {
  background: rgba(225, 29, 72, 0.15);
  border: 1px solid rgba(225, 29, 72, 0.35);
  color: #ff99ab;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.2s ease;
}

.password-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrapper input {
  padding-right: 44px;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 6px;
  font-size: 15px;
  transition: var(--transition);
}

.password-toggle-btn:hover {
  color: #fff;
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.login-options-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.login-hint-box {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.6;
}

.login-hint-box code {
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* USER PROFILE IN HEADER */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-gold));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.user-name-label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-logout:hover {
  color: var(--accent-red);
  background: rgba(225, 29, 72, 0.1);
}

