/**
 * BLOG ADMIN CSS - INFINITY CONSTRUTORA
 * OBSIDIAN VAULT v4.0 — Blog Management
 */

/* ============================================================
   BLOG STATS GRID
   ============================================================ */

.blog-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  animation: fadeIn 0.4s ease both;
}

@media (max-width: 640px) {
  .blog-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}

.blog-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.22s var(--ease);
  animation: slideUp 0.4s var(--ease) both;
}

.blog-stat-card:nth-child(1) { animation-delay: 0.04s; }
.blog-stat-card:nth-child(2) { animation-delay: 0.08s; }
.blog-stat-card:nth-child(3) { animation-delay: 0.12s; }
.blog-stat-card:nth-child(4) { animation-delay: 0.16s; }

.blog-stat-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.blog-stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring);
}

.blog-stat-card:hover .blog-stat-icon { transform: scale(1.1); }

.blog-stat-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }

.blog-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
  animation: countUp 0.5s var(--ease) both;
}

.blog-stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */

.blog-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  color: var(--text-secondary);
  white-space: nowrap;
}

.blog-toggle-label:hover {
  border-color: var(--border-gold);
  background: var(--gold-dim);
  color: var(--text-primary);
}

.blog-toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
}

.blog-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.blog-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  transition: background 0.25s var(--ease);
  cursor: pointer;
}

.blog-toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.25s var(--ease), background 0.25s;
}

.blog-toggle-switch input:checked + .blog-toggle-slider {
  background: var(--status-success);
}

.blog-toggle-switch input:checked + .blog-toggle-slider::before {
  transform: translateX(16px);
  background: #fff;
}

/* ============================================================
   FILTER SELECT GROUP
   ============================================================ */

.filter-select-group {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.filter-select {
  padding: 0.5rem 1.875rem 0.5rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%238B8B99' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 10px;
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--border-gold);
  color: var(--text-primary);
  outline: none;
}

/* ============================================================
   BLOG STATUS BADGES
   ============================================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 99px;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.status-publicado {
  background: var(--status-success-dim);
  color: var(--status-success);
}
.status-badge.status-publicado::before {
  background: var(--status-success);
  animation: dotPulse 2s ease-in-out infinite;
}

.status-badge.status-rascunho {
  background: rgba(139, 139, 153, 0.12);
  color: var(--text-muted);
}
.status-badge.status-rascunho::before { background: var(--text-muted); }

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ============================================================
   CATEGORY BADGE
   ============================================================ */

.categoria-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 99px;
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--border-gold);
  transition: all 0.18s var(--ease);
  white-space: nowrap;
}

.categoria-badge:hover {
  background: var(--gold);
  color: #000;
  transform: translateY(-1px);
}

/* ============================================================
   VIEWS COUNT
   ============================================================ */

.views-count {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.views-count i { color: var(--status-info); }

/* ============================================================
   QUILL EDITOR (dark)
   ============================================================ */

.ql-toolbar.ql-snow {
  background: var(--bg-surface);
  border: 1px solid var(--border) !important;
  border-bottom: 1px solid var(--border-soft) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 0.5rem;
}

.ql-toolbar.ql-snow .ql-formats { margin-right: 0.625rem; }

.ql-toolbar.ql-snow .ql-stroke { stroke: var(--text-secondary); }
.ql-toolbar.ql-snow .ql-fill  { fill:  var(--text-secondary); }
.ql-toolbar.ql-snow .ql-picker-label { color: var(--text-secondary); }

.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--gold); }
.ql-toolbar.ql-snow button:hover .ql-fill { fill: var(--gold); }
.ql-toolbar.ql-snow button:hover { color: var(--gold); }

.ql-container.ql-snow {
  background: var(--bg-input);
  border: 1px solid var(--border) !important;
  border-top: none !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.ql-editor {
  min-height: 280px;
  color: var(--text-primary);
  line-height: 1.7;
}

.ql-editor.ql-blank::before {
  color: var(--text-muted);
  font-style: normal;
}

/* ============================================================
   POST TAGS
   ============================================================ */

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.post-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: 99px;
  border: 1px solid var(--border);
  transition: all 0.18s var(--ease);
}

.post-tag:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--border-gold);
}

/* ============================================================
   CHAR COUNTER
   ============================================================ */

.form-help.counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.char-count { font-weight: 700; color: var(--gold); }
.char-count.exceeded { color: var(--status-danger); }

/* ============================================================
   UPLOAD PREVIEW
   ============================================================ */

.upload-preview-item img {
  max-height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
}

/* ============================================================
   CONTENT PREVIEW
   ============================================================ */

.content-preview {
  padding: 1rem 1.125rem;
  background: var(--bg-surface);
  border-left: 2px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 0.875rem;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  animation: fadeIn 0.3s ease both;
}

/* ============================================================
   TABLE OVERRIDES (blog)
   ============================================================ */

.admin-table tbody tr:hover { background: var(--bg-elevated); }
.table-action-btn { transition: all 0.18s var(--ease); }
.table-action-btn:hover { color: var(--gold); transform: translateY(-1px); }
.table-action-btn:active { transform: translateY(0); }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 2rem;
  text-align: center;
  gap: 0.875rem;
}

.empty-state-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  opacity: 0.45;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.empty-state-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.6;
}

/* ============================================================
   BTN DANGER (local override for specificity)
   ============================================================ */

.btn-danger {
  background: var(--status-danger);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

/* ============================================================
   LOCAL KEYFRAMES
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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