/* ===========================
   BlogIn - Stylesheet
   =========================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-primary: #6C63FF;
  --color-primary-dark: #5A52D5;
  --color-secondary: #FF6584;
  --color-bg: #F7F8FC;
  --color-surface: #FFFFFF;
  --color-text: #2D3436;
  --color-text-light: #636E72;
  --color-border: #DFE6E9;
  --color-success: #00B894;
  --color-danger: #D63031;
  --color-warning: #FDCB6E;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --color-bg: #121212;
  --color-surface: #1E1E1E;
  --color-text: #E0E0E0;
  --color-text-light: #A0A0A0;
  --color-border: #333333;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .badge--success {
  background: rgba(0, 184, 148, 0.2);
  color: #55E6C1;
}

[data-theme="dark"] .badge--warning {
  background: rgba(225, 112, 85, 0.2);
  color: #FAB1A0;
}

[data-theme="dark"] .toast {
  border: 1px solid var(--color-border);
}

[data-theme="dark"] #editor {
  background: var(--color-surface);
  color: var(--color-text);
}

[data-theme="dark"] ::placeholder {
  color: var(--color-text-light);
  opacity: 0.7;
}

[data-theme="dark"] .tox-tinymce {
  border-color: var(--color-border) !important;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Header --- */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header__logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.header__logo span {
  color: var(--color-primary);
}

.header__nav {
  display: flex;
  gap: 1.5rem;
}

.header__nav a {
  color: var(--color-text-light);
  font-weight: 500;
  transition: color var(--transition);
}

.header__nav a:hover {
  color: var(--color-primary);
}

/* --- Footer --- */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.875rem;
  margin-top: 3rem;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero h1 span {
  color: var(--color-primary);
}

.hero p {
  color: var(--color-text-light);
  font-size: 1.125rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-align: center;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

.btn--outline {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}

.btn--outline:hover {
  background: var(--color-primary);
  color: #fff;
}

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

.btn--success:hover {
  background: #00A884;
  color: #fff;
}

.btn--warning {
  background: var(--color-warning);
  color: #333;
}

.btn--warning:hover {
  background: #F0B429;
  color: #333;
}

.btn--danger {
  background: var(--color-danger);
  color: #fff;
}

.btn--danger:hover {
  background: #C0392B;
  color: #fff;
}

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

.btn--full {
  width: 100%;
}

/* --- Search --- */
.search-section {
  margin-bottom: 2rem;
}

.search-form {
  display: flex;
  gap: 0.75rem;
  max-width: 500px;
  margin: 0 auto;
}

.search-input {
  flex: 1;
  padding: 0.6rem 1rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

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

/* --- Filters --- */
.filter-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.75rem;
  scrollbar-width: none;
}

.filter-chips:hover {
  scrollbar-width: thin;
}

.filter-chips::-webkit-scrollbar {
  height: 4px;
  display: none;
}

.filter-chips:hover::-webkit-scrollbar {
  display: block;
}

.filter-chips::-webkit-scrollbar-track {
  background: transparent;
}

.filter-chips::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.filter-chips::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-light);
}

.filter-chips--overflowing {
  mask-image: linear-gradient(to right, #000 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 85%, transparent 100%);
  cursor: grab;
}

.filter-chips--overflowing.filter-chips--scrolled-end {
  mask-image: none;
  -webkit-mask-image: none;
}

.filter-chips--overflowing .filter-chip {
  flex: 0 0 auto;
}

.filter-chip {
  flex: 1;
  white-space: nowrap;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-light);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-align: center;
}

.filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

.filter-chip--active:hover {
  background: var(--color-primary-dark, var(--color-primary));
  color: #fff;
}

.filter-select {
  flex: 0 0 auto;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}

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

/* --- Posts Grid --- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.post-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.post-card__title {
  font-size: 1.25rem;
  font-weight: 600;
}

.post-card__title a {
  color: var(--color-text);
}

.post-card__title a:hover {
  color: var(--color-primary);
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-card__date {
  color: var(--color-text-light);
  font-size: 0.85rem;
}

.post-card__category {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(108, 99, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.no-posts {
  text-align: center;
  color: var(--color-text-light);
  padding: 2rem;
  grid-column: 1 / -1;
}

/* --- Post Layout (grid artigo + TOC) --- */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3rem;
  max-width: 1100px;
  margin: 2rem auto;
  align-items: start;
}

/* --- Post Full --- */
.post-full {
  min-width: 0; /* evita overflow no grid */
}

.post-full__header {
  margin-bottom: 2rem;
}

.post-full__header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.post-full__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-full__date {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

.post-full__edited {
  font-size: 0.75rem;
  color: var(--color-text-light);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}

.post-full__category {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(108, 99, 255, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.post-full__content {
  line-height: 1.8;
  margin-bottom: 2rem;
  color: var(--color-text);
}

/* Override theme colors from TinyMCE — colored text is preserved */
/* Defense-in-depth: JS in post.ejs handles this more reliably via luminance check */
.post-full__content *[style*="color: rgb(255, 255, 255)"],
.post-full__content *[style*="color: rgb(255,255,255)"],
.post-full__content *[style*="color: #ffffff"],
.post-full__content *[style*="color: #fff;"],
.post-full__content *[style*="color: white"],
.post-full__content *[style*="color: #f8f8f2"],
.post-full__content *[style*="color: rgb(248, 248, 242)"],
.post-full__content *[style*="color: rgb(0, 0, 0)"],
.post-full__content *[style*="color: rgb(0,0,0)"],
.post-full__content *[style*="color: #000000"],
.post-full__content *[style*="color: #000;"],
.post-full__content *[style*="color: black"] {
  color: var(--color-text) !important;
}

.post-full__content h2,
.post-full__content h3 {
  margin: 1.5rem 0 0.75rem;
}

.post-full__content p {
  margin-bottom: 1rem;
}

.post-full__content ul,
.post-full__content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.post-full__content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.post-full__content table td,
.post-full__content table th {
  border: 1px solid var(--color-border);
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
}

.post-full__content table tr:first-child td {
  font-weight: 600;
  background: rgba(108, 99, 255, 0.08);
}

[data-theme="dark"] .post-full__content table tr:first-child td {
  background: rgba(108, 99, 255, 0.15);
}

.post-full__content table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .post-full__content table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 768px) {
  .post-full__content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --- Post TOC Sidebar --- */
.post-toc {
  position: sticky;
  top: 5.5rem;
  font-size: 1.1rem;
  border-left: 2px solid var(--color-border);
  padding-left: 1rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}

.post-toc__title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
  margin-bottom: 0.75rem;
}

.post-toc__list,
.post-toc__children {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.post-toc__children {
  padding-left: 0.875rem;
  margin-top: 0.1rem;
}

.post-toc__item {
  line-height: 1.4;
}

.post-toc__row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.post-toc__toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--color-text-light);
  flex-shrink: 0;
  width: 1rem;
  line-height: 1;
  font-size: 0.8em;
  opacity: 0.8;
  transition: transform 0.2s ease;
  transform-origin: center;
  transform: rotate(0deg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.post-toc__toggle[aria-expanded="true"] {
  transform: rotate(90deg);
}

.post-toc__link {
  display: block;
  padding: 0.25rem 0.375rem;
  border-radius: 4px;
  color: var(--color-text-light);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
  font-size: 1rem;
  border-left: 2px solid transparent;
  flex: 1;
  min-width: 0;
}

.post-toc__link:hover {
  color: var(--color-text);
  background: rgba(108, 99, 255, 0.06);
}

.post-toc__link--active {
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 600;
}

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

  .post-toc {
    display: none;
  }
}

/* --- Newsletter --- */
.newsletter-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 3rem;
}

.newsletter-section h2 {
  margin-bottom: 0.5rem;
}

.newsletter-section p {
  color: var(--color-text-light);
  margin-bottom: 1.25rem;
}

.newsletter-form {
  display: flex;
  gap: 0.75rem;
  max-width: 400px;
  margin: 0 auto;
}

.newsletter-input {
  flex: 1;
  padding: 0.6rem 1rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.newsletter-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* --- Auth --- */
.auth-section {
  max-width: 420px;
  margin: 3rem auto;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

.auth-section h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* --- Forms --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
  padding: 0.7rem 1rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

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

.post-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

.form-group--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.form-group--checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.post-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* --- Admin --- */
.admin-section {
  margin-top: 2rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.admin-table th,
.admin-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.admin-table th {
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--color-text-light);
}

.admin-table__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.admin-table__actions form {
  display: inline;
}

/* --- Admin Tabs --- */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.5rem;
  margin-top: 1.5rem;
}

.admin-tabs__tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: var(--color-text-light);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.admin-tabs__tab:hover {
  color: var(--color-primary);
}

.admin-tabs__tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* --- Settings --- */
.settings-form {
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.form-hint {
  display: block;
  margin-top: 0.3rem;
  color: var(--color-text-light);
  font-size: 0.8rem;
}

.category-add-form {
  margin-bottom: 1rem;
}

.form-group--inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.form-group--inline input {
  flex: 1;
  max-width: 300px;
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-list__item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.category-list__display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.category-list__actions {
  display: flex;
  gap: 0.25rem;
}

.category-list__edit-form {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.5rem;
}

.category-list__edit-form input {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--color-bg);
  color: var(--color-text);
}

/* --- Badges --- */
.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge--success {
  background: #E8F8F5;
  color: var(--color-success);
}

.badge--warning {
  background: #FFF9E6;
  color: #E17055;
}

/* --- Toasts --- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  animation: slideInRight 0.3s ease forwards;
}

.toast__content {
  flex: 1;
  font-weight: 500;
  font-size: 0.95rem;
}

.toast__icon {
  display: flex;
  align-items: center;
}

.toast__close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.toast__close:hover {
  color: var(--color-text);
}

.toast--success {
  background-color: var(--color-success);
  color: #fff;
  border: none !important;
}
.toast--success .toast__icon,
.toast--success .toast__close {
  color: #fff;
}

.toast--error {
  background-color: var(--color-danger);
  color: #fff;
  border: none !important;
}
.toast--error .toast__icon,
.toast--error .toast__close {
  color: #fff;
}

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

/* --- Error Pages --- */
.error-section {
  text-align: center;
  padding: 4rem 0;
}

.error-section h1 {
  font-size: 4rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.error-section p {
  color: var(--color-text-light);
  margin-bottom: 2rem;
  font-size: 1.125rem;
}

/* --- TinyMCE Editor --- */
.tox-tinymce {
  border-radius: 0 0 var(--radius) var(--radius) !important;
  min-height: 300px;
}

/* --- Legacy Quill content compatibility --- */
.post-full__content .ql-align-center { text-align: center; }
.post-full__content .ql-align-right { text-align: right; }
.post-full__content .ql-align-justify { text-align: justify; }
.post-full__content .ql-indent-1 { padding-left: 3em; }
.post-full__content .ql-indent-2 { padding-left: 6em; }
.post-full__content .ql-indent-3 { padding-left: 9em; }
.post-full__content .ql-font-serif { font-family: Georgia, serif; }
.post-full__content .ql-font-monospace { font-family: monospace; }
.post-full__content .ql-size-small { font-size: 0.75em; }
.post-full__content .ql-size-large { font-size: 1.5em; }
.post-full__content .ql-size-huge { font-size: 2.5em; }
.post-full__content pre.ql-syntax {
  background: #23241f;
  color: #f8f8f2;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

/* --- FAB (Floating Action Buttons) --- */
.fab-group {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 100;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: background 0.2s, transform 0.2s;
  text-decoration: none;
}

.fab:hover {
  transform: scale(1.05);
}

.fab--primary {
  background: var(--color-primary);
  color: #fff;
}

.fab--primary:hover {
  background: var(--color-primary-dark);
}

.fab--outline {
  background: var(--color-surface);
  color: var(--color-text-light);
  border: 2px solid var(--color-border);
}

.fab--outline:hover {
  border-color: var(--color-text-light);
  color: var(--color-text);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .filter-section {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .filter-select {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    background-color: var(--color-bg);
    border-radius: var(--radius);
  }

  .filter-chips {
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .search-form,
  .newsletter-form {
    flex-direction: column;
  }

  .admin-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .admin-table {
    font-size: 0.85rem;
  }

  .form-actions {
    flex-direction: column;
  }
}

/* --- DataTables Overrides --- */
.dt-search input, .dt-length select {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

[data-theme="dark"] div.dt-container .dt-search input,
[data-theme="dark"] div.dt-container .dt-length select {
  background-color: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

[data-theme="dark"] div.dt-container .dt-paging .dt-paging-button {
  color: var(--color-text) !important;
}

[data-theme="dark"] div.dt-container .dt-paging .dt-paging-button.current {
  background: var(--color-primary) !important;
  color: #fff !important;
  border-color: var(--color-primary) !important;
}

[data-theme="dark"] div.dt-container .dt-paging .dt-paging-button:not(.current):hover {
  background: var(--color-surface) !important;
  color: var(--color-primary) !important;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  color: var(--color-text);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-light);
  cursor: pointer;
  transition: color var(--transition);
}

.btn-close:hover {
  color: var(--color-danger);
}

.modal-body {
  padding: 1.5rem;
  color: var(--color-text);
}

.modal-body p {
  margin-bottom: 0.5rem;
}

.text-danger {
  color: var(--color-danger);
}

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

/* ===== Multi-select dropdown ===== */

.multi-select {
  position: relative;
}

.multi-select__control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 2.75rem;
  transition: border-color var(--transition);
}

.multi-select__control:hover {
  border-color: var(--color-primary);
}

.multi-select__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
}

.multi-select__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  background-color: var(--color-primary);
  color: #fff;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8rem;
  font-weight: 500;
}

.multi-select__tag-remove {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  opacity: 0.8;
}

.multi-select__tag-remove:hover {
  opacity: 1;
}

.multi-select__placeholder {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.multi-select__arrow {
  flex-shrink: 0;
  opacity: 0.5;
}

.multi-select__counter {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.multi-select__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
}

.multi-select__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color var(--transition);
}

.multi-select__option:hover {
  background-color: var(--color-bg);
}

.multi-select__option--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.multi-select__option--disabled:hover {
  background-color: transparent;
}

.multi-select__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-primary);
}

.multi-select__check--empty {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 3px;
}
