*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f6fb;
  color: #1f2937;
}

a {
  color: #3d348b;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.admin-shell {
  min-height: 100vh;
}

.admin-topbar {
  background: #252641;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 20px;
}

.admin-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-nav a {
  color: #f48c06;
  font-weight: 600;
}

.admin-user {
  color: #b2b3cf;
  font-size: 14px;
}

.admin-container {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px 40px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: #f48c06;
  color: #fff;
}

.btn-secondary {
  background: #3d348b;
  color: #fff;
}

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

.btn-outline {
  background: #fff;
  color: #3d348b;
  border: 1px solid #d1d5db;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
}

label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

textarea {
  min-height: 120px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-draft {
  background: #fef3c7;
  color: #92400e;
}

.badge-published {
  background: #dcfce7;
  color: #166534;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 600;
}

.faq-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.login-wrap {
  max-width: 420px;
  margin: 80px auto;
}

.preview-shell {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  padding: 32px;
  border-radius: 12px;
}

.preview-banner {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 16px;
  text-align: center;
  font-weight: 600;
}

.cms-content h1,
.cms-content h2,
.cms-content h3 {
  color: #2f327d;
}

.cms-content p {
  line-height: 1.7;
}

/* Page form */
.page-form-card {
  padding-bottom: 28px;
}

.page-form-hint {
  margin: -8px 0 20px;
  color: #6b7280;
  font-size: 14px;
}

.page-settings-row {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

/* Locale sidebar layout (page editor) */
.locale-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  margin-top: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  min-height: 480px;
  background: #fff;
}

.locale-sidebar {
  background: #f8fafc;
  border-right: 1px solid #e5e7eb;
  padding: 16px 12px;
}

.locale-sidebar-head {
  padding: 0 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 12px;
}

.locale-sidebar-title {
  display: block;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.locale-sidebar-count {
  font-size: 12px;
  color: #9ca3af;
}

.locale-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.locale-sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: #374151;
  transition: background 0.15s, border-color 0.15s;
}

.locale-sidebar-btn:hover {
  background: #fff;
  border-color: #d1d5db;
}

.locale-sidebar-btn.is-active {
  background: #3d348b;
  border-color: #3d348b;
  color: #fff;
  box-shadow: 0 4px 12px rgba(61, 52, 139, 0.25);
}

.locale-sidebar-btn-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.locale-sidebar-btn-label {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.locale-sidebar-btn-code {
  font-size: 11px;
  opacity: 0.7;
}

.locale-sidebar-btn-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #6b7280;
}

.locale-sidebar-btn.is-filled .locale-sidebar-btn-badge {
  background: #dcfce7;
  color: #166534;
}

.locale-sidebar-btn.is-active .locale-sidebar-btn-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.locale-sidebar-btn.is-active.is-filled .locale-sidebar-btn-badge {
  background: rgba(134, 239, 172, 0.35);
  color: #ecfdf5;
}

.locale-main {
  padding: 20px 24px;
  min-width: 0;
}

.locale-panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f3f4f6;
}

.locale-panel-head h3 {
  margin: 0;
  font-size: 20px;
  color: #2f327d;
}

.locale-panel-code {
  font-size: 12px;
  font-weight: 700;
  color: #9ca3af;
  letter-spacing: 0.08em;
}

.locale-copy-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: #fff8ef;
  border: 1px solid #fde6c8;
  border-radius: 10px;
}

.locale-copy-bar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: #4b5563;
  min-width: 200px;
}

.locale-copy-bar-text strong {
  font-size: 14px;
  color: #2f327d;
}

.locale-copy-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.locale-copy-bar select {
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
}

.locale-copy-status {
  font-size: 12px;
  color: #059669;
  font-weight: 600;
}

.locale-copy-status.is-error {
  color: #dc2626;
}

.locale-panel {
  animation: fadeIn 0.2s ease;
}

.locale-panel[hidden] {
  display: none !important;
}

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

  .locale-sidebar {
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
  }

  .locale-sidebar-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .locale-sidebar-btn {
    width: auto;
    flex: 1 1 auto;
    min-width: 120px;
  }
}

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

.form-section {
  margin-bottom: 20px;
}

.form-section-title {
  margin: 0 0 12px;
  font-size: 16px;
  color: #2f327d;
}

.form-section-collapsible {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.form-section-collapsible summary {
  padding: 14px 16px;
  font-weight: 600;
  cursor: pointer;
  background: #f9fafb;
  list-style: none;
}

.form-section-collapsible summary::-webkit-details-marker {
  display: none;
}

.form-section-collapsible[open] summary {
  border-bottom: 1px solid #e5e7eb;
}

.form-section-body {
  padding: 16px;
}

.checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 500 !important;
  margin-top: 12px !important;
}

.checkbox-label input {
  width: auto;
}

.rich-editor-wrap {
  margin-bottom: 8px;
}

.quill-host {
  min-height: 280px;
  background: #fff;
  border-radius: 0 0 8px 8px;
}

.ql-toolbar.ql-snow {
  border-radius: 8px 8px 0 0;
  border-color: #d1d5db;
}

.ql-container.ql-snow {
  border-color: #d1d5db;
  border-radius: 0 0 8px 8px;
  font: inherit;
  font-size: 15px;
}

.actions-sticky {
  position: sticky;
  bottom: 0;
  background: linear-gradient(transparent, #fff 24%);
  padding-top: 24px;
  margin-top: 8px;
}

/* Repeaters (nav + footer) */
.locale-picker-form {
  margin-bottom: 0;
}

.locale-picker-form select {
  max-width: 280px;
}

.field-hint {
  font-weight: 400;
  color: #9ca3af;
  font-size: 12px;
}

.repeater-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.repeater-item {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  background: #fafafa;
}

.link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.link-row-compact {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 10px 12px;
}

.link-row-compact .form-row {
  margin: 0;
}

.footer-section-item {
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 18px;
}

.footer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.nested-repeater {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #e5e7eb;
}

.nested-repeater-label {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
  font-size: 14px;
  color: #374151;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}
