/* ============================================================
   AETERNA Admin — Additional Styles
   Uses CSS variables from style.css for dark mode compatibility
   ============================================================ */

/* ── Layout ── */
.admin-main {
  flex: 1;
  padding-bottom: 3rem;
}

.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

/* ── Admin Header / Nav ── */
.admin-header {
  background: var(--surface);
  border-bottom: 0.5px solid var(--divider);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 56px;
}

.admin-brand {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-shrink: 0;
}

.admin-logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.admin-brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-nav {
  display: flex;
  gap: 0.125rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar { display: none; }

.admin-nav-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: all 0.15s;
}

.admin-nav-link:hover {
  background: var(--surface-low);
  color: var(--primary);
}

.admin-nav-link.active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 600;
}

.admin-user-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.admin-user-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.admin-logout-btn {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--error);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  background: var(--error-container);
  transition: opacity 0.15s;
}

.admin-logout-btn:hover { opacity: 0.85; }

/* ── Login Page ── */
.admin-login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--surface-low);
}

.login-screen {
  width: 100%;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border: 0.5px solid var(--divider);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  text-align: center;
}

.login-card .lock-icon {
  width: 56px;
  height: 56px;
  background: var(--primary-container);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--primary);
}

.login-card h2 {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.login-card input {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.925rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  margin-bottom: 1rem;
  text-align: center;
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-container);
}

.login-card button {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.925rem;
  font-weight: 700;
  font-family: var(--font);
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

.login-card button:hover { opacity: 0.9; }

.login-error {
  color: var(--error);
  font-size: 0.8rem;
  display: none;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  background: var(--error-container);
  padding: 0.5rem;
  border-radius: 8px;
}

/* ── Stats ── */
.stats-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--divider);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  flex: 1;
  min-width: 130px;
  text-align: center;
}

.stat-card .stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--hint);
  margin-top: 0.15rem;
}

.stat-card.danger .stat-num { color: var(--error); }
.stat-card.warning .stat-num { color: var(--warning); }

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.dash-card {
  background: var(--surface);
  border: 0.5px solid var(--divider);
  border-radius: 16px;
  padding: 1.25rem;
}

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

.dash-card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.dash-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

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

.dash-empty {
  color: var(--hint);
  font-size: 0.85rem;
  padding: 1.5rem 0;
  text-align: center;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--divider);
}

.dash-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--surface-low);
  color: var(--text);
}

.dash-table tr:last-child td { border-bottom: none; }
.dash-table .row-unread td { font-weight: 600; }

/* ── Quick Actions ── */
.quick-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.qa-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--primary);
  background: var(--primary-container);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.15s;
}

.qa-btn:hover {
  background: var(--primary);
  color: white;
}

/* ── Controls Bar ── */
.controls-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.search-form input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.search-form input:focus { border-color: var(--primary); }

/* ── Filter Chips ── */
.filter-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid var(--divider);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.filter-chip:hover:not(.active) { background: var(--surface-low); }

/* ── Feedback List ── */
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.feedback-item {
  background: var(--surface);
  border: 0.5px solid var(--divider);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.feedback-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.feedback-item.unread {
  border-left: 3px solid var(--primary);
}

.fi-row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.fi-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }

.fi-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.fi-subject {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fi-date {
  font-size: 0.72rem;
  color: var(--hint);
  white-space: nowrap;
}

.fi-row3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--hint);
}

/* ── Type Badges ── */
.type-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  white-space: nowrap;
}

.type-Issue { background: #FFF3E0; color: #E65100; }
.type-Request { background: #E3F2FD; color: #1565C0; }
.type-Suggestion { background: #E8F5E9; color: #2E7D32; }
.type-BugReport { background: #FFEBEE; color: #C62828; }
.type-Review { background: #F3E5F5; color: #6A1B9A; }
.type-General { background: var(--surface-low); color: var(--text-secondary); }

/* ── Urgency Badge ── */
.urgency-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 100px;
}

.urgency-low { background: #E8F5E9; color: #2E7D32; }
.urgency-medium { background: #FFF3E0; color: #E65100; }
.urgency-high { background: #FFEBEE; color: #C62828; }
.urgency-urgent { background: #FCE4EC; color: #880E4F; }

/* ── Status Indicators ── */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.status-dot.unread { background: var(--primary); }
.status-dot.read { background: var(--success); }
.status-dot.replied { background: var(--tertiary); }

.status-green { color: var(--success); font-weight: 600; font-size: 0.8rem; }
.status-amber { color: var(--warning); font-weight: 600; font-size: 0.8rem; }
.status-gray { color: var(--hint); font-weight: 600; font-size: 0.8rem; }

.source-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.source-website { background: var(--primary-container); color: var(--primary); }
.source-play_store { background: #E8F5E9; color: #2E7D32; }

/* ── Status Row Highlight ── */
.row-unread td:first-child {
  position: relative;
}

.row-unread td:first-child::before {
  content: '';
  position: absolute;
  left: -0.5rem;
  top: 25%;
  height: 50%;
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
}

/* ── Buttons ── */
.btn {
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-container); }
.btn-danger { background: var(--error-container); color: var(--on-error-container); }
.btn-danger:hover { opacity: 0.85; }
.btn-success { background: #E8F5E9; color: #2E7D32; }
.btn-success:hover { opacity: 0.85; }

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  border: 0.5px solid var(--divider);
}

.admin-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.7rem 0.75rem;
  background: var(--surface-low);
  border-bottom: 1px solid var(--divider);
}

.admin-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--surface-low);
  color: var(--text);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover { background: var(--surface-low); }

.cell-muted { color: var(--hint); }
.cell-preview { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-actions { white-space: nowrap; display: flex; gap: 0.35rem; align-items: center; flex-wrap: nowrap; }
.cell-badge { font-size: 0.6rem; background: var(--primary-container); color: var(--primary); padding: 0.1rem 0.3rem; border-radius: 4px; margin-left: 0.3rem; vertical-align: middle; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--hint);
}

.empty-icon {
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

/* ── Toast / Messages ── */
.admin-toast {
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.admin-toast.success {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}

.admin-toast.error {
  background: var(--error-container);
  color: var(--on-error-container);
  border: 1px solid var(--error);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: var(--surface);
  border-radius: 20px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  position: relative;
}

.modal-lg { max-width: 580px; }

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--hint);
  line-height: 1;
}

.modal-loading {
  text-align: center;
  padding: 2rem;
  color: var(--hint);
}

/* ── Detail Modal ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

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

.detail-field { font-size: 0.85rem; }

.df-label {
  color: var(--hint);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 0.1rem;
}

.df-value {
  color: var(--text);
  word-break: break-word;
}

.detail-msg {
  background: var(--bg);
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

.detail-screenshot {
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  border: 1px solid var(--divider);
  margin-bottom: 1rem;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reply-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--divider);
}

.reply-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.reply-section textarea {
  width: 100%;
  padding: 0.65rem;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  resize: vertical;
  margin-bottom: 0.5rem;
}

.reply-section textarea:focus {
  border-color: var(--primary);
}

/* ── Settings ── */
.settings-section {
  background: var(--surface);
  border: 0.5px solid var(--divider);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--divider);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.settings-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.settings-field input[type="text"],
.settings-field input[type="number"],
.settings-field textarea,
.settings-field select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.settings-field input:focus,
.settings-field textarea:focus,
.settings-field select:focus { border-color: var(--primary); }

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-picker-wrap input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: none;
}

.color-hex-input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-family: monospace;
}

.color-hex-input:focus { border-color: var(--primary); }

/* ── Toggle Switch ── */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
}

.toggle-label input { display: none; }

.toggle-slider {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-label input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(18px);
}

/* ── Image Setting ── */
.image-setting {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.setting-preview {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--divider);
}

.image-setting input[type="file"] {
  font-size: 0.82rem;
  font-family: var(--font);
  color: var(--text);
}

/* ── Form Actions ── */
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--divider);
}

/* ── Blog Post Form ── */
.post-form .form-group {
  margin-bottom: 1rem;
}

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

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

@media (max-width: 600px) {
  .form-row, .form-row.three-col { grid-template-columns: 1fr; }
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.field-hint {
  font-weight: 400;
  color: var(--hint);
  font-size: 0.75rem;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--primary); }

.code-input {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ── Stars ── */
.stars { white-space: nowrap; }

/* Firebase Admin additions */
.admin-login-page .login-screen { min-height: 100vh; }
.admin-loading { display:flex; align-items:center; justify-content:center; min-height:60vh; }
.admin-loading .spinner { width:32px; height:32px; border:3px solid var(--surface-low); border-top-color:var(--primary); border-radius:50%; animation:spin 0.6s linear infinite; }
.post-form-section { display:none; }
.post-form-section.show { display:block; }
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:200; align-items:center; justify-content:center; padding:1rem; }
.modal-overlay.show { display:flex; }
.modal-content { background:var(--surface); border-radius:20px; width:100%; max-width:580px; max-height:85vh; overflow-y:auto; padding:1.75rem; box-shadow:0 12px 40px rgba(0,0,0,0.15); }
