/* ==========================================================================
   Nexorin - Admin Backoffice Dedicated Luxury Light Theme Styling
   File: css/admin.css
   Brand: Nexorin (Where Science Meets the Art of Beauty)
   Matching Theme with index.html (Clean White, Tiffany Blue, Graphite Gray)
   ========================================================================== */

:root {
  /* Brand Color Tokens (Aligned with index.html & Brand Guidelines) */
  --admin-bg: #f8fafc;
  --admin-surface: #ffffff;
  --admin-surface-card: #ffffff;
  --admin-border: rgba(0, 0, 0, 0.08);
  --admin-border-focus: #0ABAB5;
  --admin-accent: #0ABAB5;
  --admin-accent-hover: #089c98;
  --admin-accent-glow: rgba(10, 186, 181, 0.2);
  --admin-text-main: #4B5563;
  --admin-text-heading: #1F2937;
  --admin-text-muted: #6B7280;
  --admin-danger: #ef4444;
  --admin-success: #10b981;
  --admin-ai-gradient: linear-gradient(135deg, #0ABAB5 0%, #0284c7 100%);
  --admin-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --admin-shadow-md: 0 6px 20px rgba(0, 0, 0, 0.05);
  --admin-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.06);
}

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  font-family: 'Prompt', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Admin Top Header (Matching index.html sticky navbar)
   ========================================================================== */
.admin-navbar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 28px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.admin-nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}

.admin-brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.admin-brand-text {
  display: flex;
  flex-direction: column;
}

.admin-brand-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--admin-text-heading);
}

.admin-brand-badge {
  font-size: 0.72rem;
  color: var(--admin-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-view-site {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--admin-text-heading);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--admin-shadow-sm);
  transition: all 0.25s ease;
}

.btn-view-site:hover {
  background: rgba(10, 186, 181, 0.08);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  transform: translateY(-1px);
  box-shadow: var(--admin-shadow-md);
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.admin-main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 24px 80px;
  width: 100%;
  box-sizing: border-box;
  flex: 1;
}

/* ==========================================================================
   Stats Overview (Clean White Luxury Cards)
   ========================================================================== */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.admin-stat-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--admin-shadow-sm);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.admin-stat-card:hover {
  border-color: rgba(10, 186, 181, 0.5);
  box-shadow: var(--admin-shadow-md);
  transform: translateY(-2px);
}

.admin-stat-info h4 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  color: var(--admin-text-muted);
  font-weight: 500;
}

.admin-stat-number {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--admin-text-heading);
  font-family: 'Montserrat', sans-serif;
}

.admin-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(10, 186, 181, 0.1);
  color: var(--admin-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Layout Grid: Form (Left) & List (Right)
   ========================================================================== */
.admin-layout-grid {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 32px;
  align-items: start;
}

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

/* Form Card Container */
.admin-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--admin-shadow-md);
}

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

.admin-card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--admin-text-heading);
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-card-title svg {
  color: var(--admin-accent);
}

/* AI Auto-Translate Quick Action */
.ai-translate-box {
  background: linear-gradient(135deg, rgba(10, 186, 181, 0.08) 0%, rgba(59, 130, 246, 0.05) 100%);
  border: 1px dashed rgba(10, 186, 181, 0.4);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-translate-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--admin-text-heading);
}

.ai-translate-icon {
  color: var(--admin-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-ai-translate {
  background: var(--admin-ai-gradient);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(10, 186, 181, 0.25);
}

.btn-ai-translate:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 14px var(--admin-accent-glow);
  transform: translateY(-1px);
}

.btn-ai-translate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.5);
}

/* ==========================================================================
   Form Fields (Clean White Theme)
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--admin-text-heading);
}

.form-label .required {
  color: var(--admin-danger);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--admin-text-heading);
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #9ca3af;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px var(--admin-accent-glow);
}

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

.form-help {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--admin-text-muted);
}

/* Image Upload & Preview */
.image-preview-box {
  width: 100%;
  height: 180px;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  margin-top: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.image-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--admin-text-muted);
  font-size: 0.85rem;
}

.file-input-wrapper {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: var(--admin-text-heading);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--admin-shadow-sm);
  transition: all 0.2s ease;
}

.custom-file-btn:hover {
  background: rgba(10, 186, 181, 0.08);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.custom-file-btn input[type="file"] {
  display: none;
}

/* ==========================================================================
   Form Actions
   ========================================================================== */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.btn-submit {
  flex: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--admin-accent);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10, 186, 181, 0.3);
  transition: all 0.2s ease;
}

.btn-submit:hover {
  background: var(--admin-accent-hover);
  box-shadow: 0 6px 18px var(--admin-accent-glow);
  transform: translateY(-1px);
}

.btn-reset {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f3f4f6;
  color: var(--admin-text-heading);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 13px 16px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

/* ==========================================================================
   Table Toolbar & Filter
   ========================================================================== */
.admin-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.admin-filter-tabs {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.admin-filter-btn {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  padding: 6px 14px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-filter-btn.active {
  background: var(--admin-accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(10, 186, 181, 0.3);
}

.admin-search-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.admin-search-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  color: var(--admin-text-heading);
  font-size: 0.85rem;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.admin-search-input:focus {
  outline: none;
  border-color: var(--admin-accent);
}

.admin-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-muted);
}

/* ==========================================================================
   Table Styling (Clean White & Slate)
   ========================================================================== */
.admin-table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: #ffffff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: #f8fafc;
  color: var(--admin-text-muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.admin-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: middle;
  background: #ffffff;
}

.admin-table-row:hover td {
  background: #f8fafc;
}

.admin-thumb-wrapper {
  width: 68px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.admin-table-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-article-title-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 320px;
}

.admin-title-th {
  font-weight: 600;
  color: var(--admin-text-heading);
  line-height: 1.4;
}

.admin-title-en {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  font-family: 'Montserrat', sans-serif;
}

.admin-category-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(10, 186, 181, 0.1);
  color: #089c98;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-published {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.status-draft {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.admin-date-text {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  margin-top: 4px;
  display: block;
}

/* Action Buttons in Table */
.admin-action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  background: #ffffff;
  color: var(--admin-text-heading);
  font-family: inherit;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: var(--admin-shadow-sm);
  transition: all 0.2s ease;
}

.btn-preview {
  color: #089c98;
}

.btn-preview:hover {
  background: rgba(10, 186, 181, 0.1);
  border-color: var(--admin-accent);
}

.btn-edit {
  color: #2563eb;
}

.btn-edit:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: #3b82f6;
}

.btn-delete {
  color: #dc2626;
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--admin-danger);
}

/* Empty state */
.empty-state-box {
  padding: 48px 24px;
  text-align: center;
  color: var(--admin-text-muted);
}

.empty-state-box svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: all 0.25s ease;
  max-width: 420px;
  line-height: 1.45;
}

.admin-toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.admin-toast.toast-success {
  border-color: var(--admin-accent);
  background: #064e4b;
  color: #ccfbf1;
}

.admin-toast.toast-info {
  border-color: #3b82f6;
  background: #1e3a8a;
  color: #dbeafe;
}

.admin-toast.toast-error {
  border-color: var(--admin-danger);
  background: #450a0a;
  color: #fecaca;
}

/* ==========================================================================
   AI Translation Key Configuration & Buttons
   ========================================================================== */
.ai-translate-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-config-ai {
  background: rgba(255, 255, 255, 0.9);
  color: var(--admin-text-main);
  border: 1px solid rgba(10, 186, 181, 0.35);
  border-radius: 8px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-config-ai:hover {
  background: #ffffff;
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  box-shadow: 0 2px 8px rgba(10, 186, 181, 0.18);
  transform: translateY(-1px);
}

.ai-key-mini-badge {
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 2px;
}

.ai-key-mini-badge.configured {
  color: #059669;
}

.ai-key-mini-badge.missing {
  color: #d97706;
}

/* ==========================================================================
   Settings Modal Dialog (Luxury Theme)
   ========================================================================== */
.settings-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.settings-modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 580px;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.settings-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}

.settings-modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-modal-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(10, 186, 181, 0.1);
  color: var(--admin-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--admin-text-heading);
  margin: 0;
}

.settings-modal-subtitle {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  margin: 2px 0 0 0;
}

.settings-modal-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.settings-modal-close:hover {
  background: #f1f5f9;
  color: var(--admin-text-heading);
}

.settings-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.settings-field-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.2s;
}

.settings-field-card.highlight-field {
  background: linear-gradient(135deg, rgba(10, 186, 181, 0.04) 0%, rgba(59, 130, 246, 0.03) 100%);
  border: 1.5px solid rgba(10, 186, 181, 0.4);
}

.settings-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.settings-help-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.settings-help-link:hover {
  text-decoration: underline;
}

.settings-field-desc {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.settings-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.settings-input-wrap .form-input {
  width: 100%;
  padding-right: 44px;
}

.btn-toggle-visibility {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--admin-text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-status-badge {
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 6px;
}

.key-status-badge.active {
  color: #059669;
}

.key-status-badge.inactive {
  color: #d97706;
}

.settings-modal-footer {
  padding: 16px 24px;
  background: #fafbfc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

