/* ============================================
   Unlimited Studios - BookStack Custom Theme
   Colors: #009245, #4CAF50 (greens)
   Fonts: Exo (headings), Inter (body)
   ============================================ */

/* --- CSS Variable Overrides --- */
:root {
  --color-primary: #009245;
  --color-primary-light: rgba(0, 146, 69, 0.15);
  --color-link: #009245;
  --color-bookshelf: #2E7D32;
  --color-book: #4CAF50;
  --color-chapter: #388E3C;
  --color-page: #009245;
  --color-page-draft: #66BB6A;
  --color-positive: #4CAF50;
  --font-body: 'Inter', sans-serif;
}

:root.dark-mode {
  --color-primary: #4CAF50;
  --color-primary-light: rgba(76, 175, 80, 0.15);
  --color-link: #66BB6A;
  --color-bookshelf: #66BB6A;
  --color-book: #4CAF50;
  --color-chapter: #66BB6A;
  --color-page: #66BB6A;
  --color-page-draft: #81C784;
  --color-positive: #4CAF50;
}

/* --- Typography --- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

h1, h2, h3, h4, h5, h6,
.list-heading,
.card h1, .card h2, .card h3,
.entity-list-item-name,
.shelf-name, .book-name {
  font-family: 'Exo', 'Inter', sans-serif;
  font-weight: 700;
}

.logo-text {
  font-family: 'Exo', sans-serif;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* --- Header --- */
header#header {
  background: linear-gradient(135deg, #009245 0%, #4CAF50 50%, #66BB6A 100%) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

header#header .logo:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

header#header .logo-image {
  height: 38px;
}

header#header .links a {
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.3s ease;
}

header#header .links a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* --- Buttons --- */
.button,
button[type="submit"].button,
a.button,
input[type="submit"].button {
  border-radius: 25px !important;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  text-transform: none;
}

.button.primary,
.button[type="submit"] {
  background: linear-gradient(135deg, #009245 0%, #4CAF50 100%) !important;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 146, 69, 0.3);
}

.button.primary:hover,
.button[type="submit"]:hover {
  background: linear-gradient(135deg, #00833d 0%, #45a049 100%) !important;
  box-shadow: 0 6px 20px rgba(0, 146, 69, 0.4);
  transform: translateY(-2px);
}

/* Outline/secondary buttons */
.button.outline {
  border: 2px solid #009245;
  color: #009245;
  border-radius: 25px !important;
}

.button.outline:hover {
  background: rgba(0, 146, 69, 0.1);
}

/* --- Cards --- */
.card {
  border-radius: 8px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: none;
}

.card:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.content-wrap.card {
  border-radius: 8px !important;
}

/* --- Entity List Items (pages, books, chapters, shelves) --- */
.entity-list-item {
  border-radius: 8px;
  transition: all 0.3s ease;
}

.entity-list-item:hover {
  background: rgba(0, 146, 69, 0.05);
}

.entity-list-item .entity-list-item-name {
  font-weight: 600;
}

/* Entity icons - shelf, book, chapter, page */
.entity-list-item .icon-list-item {
  transition: transform 0.3s ease;
}

.entity-list-item:hover .icon-list-item {
  transform: scale(1.1);
}

/* --- Search Bar --- */
header .search-box input {
  border-radius: 25px !important;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
}

header .search-box input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

header .search-box input:focus {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* --- Form Inputs --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
textarea,
select {
  border-radius: 8px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  font-family: 'Inter', sans-serif;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: #009245;
  box-shadow: 0 0 0 3px rgba(0, 146, 69, 0.15);
}

/* --- Footer --- */
footer {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%) !important;
  color: #b0b0b0;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(76, 175, 80, 0.2);
}

footer a {
  color: #b0b0b0 !important;
  transition: all 0.3s ease;
}

footer a:hover {
  color: #4CAF50 !important;
}

/* --- Custom Footer (via theme override) --- */
.us-footer {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
  color: #ffffff;
  padding: 2rem 0 0;
}

.us-footer-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.us-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.us-footer-brand img {
  height: 35px;
  width: 35px;
}

.us-footer-brand span {
  color: #4CAF50;
  font-family: 'Exo', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
}

.us-footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.us-footer-links a {
  color: #b0b0b0;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.us-footer-links a:hover {
  color: #4CAF50;
}

.us-footer-bottom {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem 2rem;
  border-top: 1px solid rgba(76, 175, 80, 0.2);
  text-align: center;
}

.us-footer-bottom p {
  color: #888;
  font-size: 0.85rem;
  margin: 0;
}

.us-footer-bottom .powered-badge {
  display: inline-block;
  background: rgba(76, 175, 80, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.2);
  margin-top: 0.5rem;
}

/* --- Sidebar / Navigation --- */
.tri-layout-left-contents,
.tri-layout-right-contents {
  border-radius: 8px;
}

/* --- Breadcrumbs --- */
.breadcrumb-listing a {
  transition: color 0.3s ease;
}

.breadcrumb-listing a:hover {
  color: #009245;
}

/* --- Page Content --- */
.page-content {
  font-family: 'Inter', sans-serif;
  line-height: 1.7;
}

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4 {
  font-family: 'Exo', sans-serif;
  font-weight: 700;
}

/* --- Tags --- */
.tag-item {
  border-radius: 20px;
  transition: all 0.3s ease;
}

/* --- Shelves Grid --- */
.grid-card {
  border-radius: 8px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: hidden;
}

.grid-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* --- Back to Top --- */
.back-to-top .inner {
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%) !important;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  transition: all 0.3s ease;
}

.back-to-top .inner:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

/* --- Notifications --- */
.notification.pos {
  background: #4CAF50;
  border-radius: 8px;
}

.notification.neg {
  border-radius: 8px;
}

.notification.warning {
  border-radius: 8px;
}

/* --- Login Page --- */
#login-form .button {
  width: 100%;
  padding: 12px 24px;
  font-size: 1rem;
  background: linear-gradient(135deg, #009245 0%, #4CAF50 100%) !important;
  border-radius: 25px !important;
  box-shadow: 0 4px 15px rgba(0, 146, 69, 0.3);
}

#login-form .button:hover {
  box-shadow: 0 6px 20px rgba(0, 146, 69, 0.4);
  transform: translateY(-2px);
}

/* --- Custom scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #4CAF50;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #009245;
}

.dark-mode ::-webkit-scrollbar-track {
  background: #2d2d2d;
}

/* --- Selection Color --- */
::selection {
  background: rgba(76, 175, 80, 0.3);
  color: inherit;
}

/* --- Smooth transitions globally --- */
a, .button, .card, input, textarea, select {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Ambient Bubble Background Animation --- */
/* Adapted from main website hero, toned down for wiki readability */

body {
  position: relative;
}

body::before,
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background-image:
    /* Large bubbles */
    radial-gradient(circle at 15% 40%, rgba(76, 175, 80, 0.18) 20px, rgba(76, 175, 80, 0.09) 22px, transparent 25px),
    radial-gradient(circle at 85% 30%, rgba(0, 146, 69, 0.15) 18px, rgba(0, 146, 69, 0.07) 20px, transparent 23px),
    radial-gradient(circle at 60% 70%, rgba(76, 175, 80, 0.20) 24px, rgba(76, 175, 80, 0.10) 26px, transparent 29px),
    radial-gradient(circle at 30% 85%, rgba(102, 187, 106, 0.12) 14px, rgba(102, 187, 106, 0.05) 16px, transparent 19px),
    radial-gradient(circle at 70% 15%, rgba(0, 146, 69, 0.17) 20px, rgba(0, 146, 69, 0.08) 22px, transparent 25px),
    radial-gradient(circle at 5% 75%, rgba(76, 175, 80, 0.14) 16px, rgba(76, 175, 80, 0.06) 18px, transparent 21px),
    radial-gradient(circle at 95% 55%, rgba(56, 142, 60, 0.19) 22px, rgba(56, 142, 60, 0.09) 24px, transparent 27px),
    radial-gradient(circle at 45% 5%, rgba(76, 175, 80, 0.15) 18px, rgba(76, 175, 80, 0.07) 20px, transparent 23px),
    /* Medium bubbles */
    radial-gradient(circle at 25% 60%, rgba(76, 175, 80, 0.12) 10px, rgba(76, 175, 80, 0.05) 12px, transparent 15px),
    radial-gradient(circle at 75% 50%, rgba(0, 146, 69, 0.14) 12px, rgba(0, 146, 69, 0.06) 14px, transparent 17px),
    radial-gradient(circle at 45% 20%, rgba(76, 175, 80, 0.10) 8px, rgba(76, 175, 80, 0.04) 10px, transparent 13px),
    radial-gradient(circle at 65% 80%, rgba(102, 187, 106, 0.13) 11px, rgba(102, 187, 106, 0.06) 13px, transparent 16px),
    radial-gradient(circle at 35% 45%, rgba(76, 175, 80, 0.10) 9px, rgba(76, 175, 80, 0.04) 11px, transparent 14px),
    radial-gradient(circle at 55% 35%, rgba(0, 146, 69, 0.12) 13px, rgba(0, 146, 69, 0.05) 15px, transparent 18px),
    /* Small bubbles */
    radial-gradient(circle at 10% 10%, rgba(76, 175, 80, 0.10) 5px, transparent 7px),
    radial-gradient(circle at 90% 80%, rgba(76, 175, 80, 0.10) 5px, transparent 7px),
    radial-gradient(circle at 50% 90%, rgba(0, 146, 69, 0.08) 4px, transparent 6px),
    radial-gradient(circle at 30% 30%, rgba(76, 175, 80, 0.10) 5px, transparent 7px),
    radial-gradient(circle at 70% 60%, rgba(102, 187, 106, 0.12) 6px, transparent 8px),
    radial-gradient(circle at 20% 50%, rgba(76, 175, 80, 0.08) 3px, transparent 5px),
    radial-gradient(circle at 80% 20%, rgba(0, 146, 69, 0.12) 7px, transparent 9px),
    radial-gradient(circle at 40% 80%, rgba(76, 175, 80, 0.09) 4px, transparent 6px);
  background-size: 100% 100%;
  animation: wikiBubblesRise 30s linear infinite;
}

body::after {
  background-image:
    /* Second layer for depth */
    radial-gradient(circle at 20% 80%, rgba(76, 175, 80, 0.15) 15px, rgba(76, 175, 80, 0.07) 17px, transparent 20px),
    radial-gradient(circle at 80% 60%, rgba(0, 146, 69, 0.12) 19px, rgba(0, 146, 69, 0.05) 21px, transparent 24px),
    radial-gradient(circle at 40% 40%, rgba(76, 175, 80, 0.10) 11px, transparent 14px),
    radial-gradient(circle at 65% 25%, rgba(102, 187, 106, 0.10) 9px, transparent 12px),
    radial-gradient(circle at 10% 30%, rgba(76, 175, 80, 0.13) 12px, rgba(76, 175, 80, 0.06) 14px, transparent 17px),
    radial-gradient(circle at 90% 70%, rgba(0, 146, 69, 0.15) 16px, rgba(0, 146, 69, 0.07) 18px, transparent 21px),
    radial-gradient(circle at 55% 85%, rgba(76, 175, 80, 0.10) 10px, rgba(76, 175, 80, 0.04) 12px, transparent 15px),
    radial-gradient(circle at 75% 5%, rgba(56, 142, 60, 0.13) 14px, rgba(56, 142, 60, 0.06) 16px, transparent 19px),
    /* Smaller depth bubbles */
    radial-gradient(circle at 45% 65%, rgba(76, 175, 80, 0.10) 8px, transparent 11px),
    radial-gradient(circle at 15% 55%, rgba(0, 146, 69, 0.12) 10px, transparent 13px),
    radial-gradient(circle at 85% 35%, rgba(76, 175, 80, 0.08) 7px, transparent 10px),
    radial-gradient(circle at 30% 75%, rgba(102, 187, 106, 0.12) 12px, transparent 15px),
    radial-gradient(circle at 50% 50%, rgba(76, 175, 80, 0.10) 10px, rgba(76, 175, 80, 0.04) 12px, transparent 15px),
    radial-gradient(circle at 8% 40%, rgba(0, 146, 69, 0.09) 7px, transparent 9px),
    radial-gradient(circle at 92% 90%, rgba(76, 175, 80, 0.08) 4px, transparent 6px);
  background-size: 110% 110%;
  animation: wikiBubblesRise 38s linear infinite reverse;
  animation-delay: -8s;
}

@keyframes wikiBubblesRise {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    transform: translateY(80vh) translateX(-15px) scale(1);
    opacity: 1;
  }
  25% {
    transform: translateY(55vh) translateX(15px) scale(1.05);
  }
  50% {
    transform: translateY(25vh) translateX(-10px) scale(1);
  }
  75% {
    transform: translateY(5vh) translateX(18px) scale(0.95);
  }
  90% {
    transform: translateY(-10vh) translateX(0) scale(0.85);
    opacity: 1;
  }
  100% {
    transform: translateY(-15vh) translateX(0) scale(0);
    opacity: 0;
  }
}

/* Light mode: even stronger bubbles since light bg washes them out */
html:not(.dark-mode) body::before,
html:not(.dark-mode) body::after {
  opacity: 1.5;
}

/* --- Remove dotted border on page navigation target --- */
:target,
.page-content :target,
.page-content :target * {
  outline: none !important;
  box-shadow: none !important;
}

/* --- Header Dropdown Fix --- */
header#header .dropdown-container {
  position: relative;
}

header#header .dropdown-menu {
  top: 100% !important;
  margin-top: 8px !important;
  right: 0 !important;
  left: auto !important;
}

/* --- Dark mode adjustments --- */
.dark-mode .card {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dark-mode .card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.dark-mode header#header {
  background: linear-gradient(135deg, #1a5e30 0%, #2E7D32 50%, #388E3C 100%) !important;
}

.dark-mode .grid-card:hover {
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.15);
}

/* --- Homepage Landing (Old Content, New Theme) --- */
.ups-home {
  max-width: 980px;
  margin: 0 auto;
}

.ups-home-shell {
  padding: 1.25rem 1.25rem 1.5rem;
}

.ups-home-hero {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0.8rem;
  backdrop-filter: none;
}

.ups-home-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 0.9rem;
}

.ups-home-logo {
  width: min(340px, 68%);
  max-width: 340px;
  height: auto;
  display: block;
}

.ups-home-title {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  line-height: 1.2;
}

.ups-home-subtitle {
  margin: 0;
  font-size: 1.02rem;
}

.ups-home-intro {
  margin: 1rem 0;
  display: grid;
  gap: 0.85rem;
}

.ups-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.ups-project-card {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  text-decoration: none !important;
  border-radius: 14px;
  border: 1px solid rgba(0, 146, 69, 0.28);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  padding: 1.05rem 1.1rem;
  color: inherit;
  height: 168px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ups-project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #009245, #66bb6a);
}

.ups-home .ups-project-card,
.ups-home .ups-project-card:visited,
.ups-home .ups-project-card:hover {
  text-decoration: none !important;
  color: inherit !important;
}

.ups-project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 146, 69, 0.56);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
}

.ups-project-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  line-height: 1.25;
}

.ups-project-card p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.88;
  line-height: 1.45;
}

.dark-mode .ups-project-card {
  background: rgba(9, 18, 13, 0.9);
  border-color: rgba(102, 187, 106, 0.38);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
  .ups-home-title {
    font-size: 1.5rem;
  }

  .ups-project-grid {
    grid-template-columns: 1fr;
  }

  .ups-project-card {
    height: 156px;
  }
}

/* --- Floating Dark/Light Toggle --- */
.ups-floating-theme-toggle {
  position: fixed;
  right: 24px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 1001;
}

.ups-theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
  min-width: 120px;
  padding: 0 0.8rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #009245 0%, #4caf50 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.ups-theme-toggle-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
}

.ups-theme-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ups-theme-toggle-icon svg {
  margin: 0;
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.ups-theme-toggle-text {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.ups-theme-toggle-icon-light {
  display: none;
}

.dark-mode .ups-theme-toggle-icon-dark {
  display: none;
}

.dark-mode .ups-theme-toggle-icon-light {
  display: flex;
}

.dark-mode .ups-theme-toggle-btn {
  background: linear-gradient(135deg, #1a5e30 0%, #2e7d32 100%);
}

@media (max-width: 768px) {
  .ups-floating-theme-toggle {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .ups-theme-toggle-btn {
    height: 40px;
    min-width: 110px;
    padding: 0 0.7rem;
  }
}

/* --- Editor Quick Create (Book Tree) --- */
.ups-booktree-quick-create {
  display: grid;
  gap: 0.35rem;
}

.ups-booktree-quick-link {
  border-radius: 8px;
  padding: 0.32rem 0.5rem;
  background: rgba(0, 146, 69, 0.08);
  border: 1px solid rgba(0, 146, 69, 0.18);
  font-size: 0.86rem;
}

.ups-booktree-quick-link:hover {
  background: rgba(0, 146, 69, 0.14);
  border-color: rgba(0, 146, 69, 0.34);
}

.dark-mode .ups-booktree-quick-link {
  background: rgba(102, 187, 106, 0.12);
  border-color: rgba(102, 187, 106, 0.3);
}

.dark-mode .ups-booktree-quick-link:hover {
  background: rgba(102, 187, 106, 0.18);
}

/* --- Quick Article Builder (Editor) --- */
.ups-article-builder {
  margin-bottom: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(0, 146, 69, 0.18);
  border-radius: 10px !important;
  position: relative;
  z-index: 40;
  overflow: visible;
  background: rgba(20, 24, 22, 0.96);
}

.ups-article-builder h4 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.ups-article-builder-sub {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  opacity: 0.82;
  line-height: 1.35;
}

.ups-article-builder-section + .ups-article-builder-section {
  margin-top: 0.7rem;
}

.ups-article-builder-label {
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.ups-article-builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: stretch;
}

.ups-article-builder .button.outline.small {
  border-radius: 8px !important;
  width: 100%;
  min-height: 36px;
  height: 36px;
  line-height: 1;
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  box-sizing: border-box;
}

.dark-mode .ups-article-builder {
  border-color: rgba(102, 187, 106, 0.3);
}

html:not(.dark-mode) .ups-article-builder {
  background: rgba(255, 255, 255, 0.96);
}

.page-editor .page-editor-page-area-wrap > .relative.flex-fill > .ups-article-builder {
  margin-left: 24px;
  width: calc(100% - 24px);
}

@media (max-width: 1100px) {
  .page-editor .page-editor-page-area-wrap > .relative.flex-fill > .ups-article-builder {
    margin-left: 0;
    width: 100%;
  }

  .ups-article-builder-grid {
    grid-template-columns: 1fr;
  }
}

.ups-builder-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(12, 20, 15, 0.65);
  backdrop-filter: blur(2px);
}

.ups-builder-modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1rem;
  border: 1px solid rgba(0, 146, 69, 0.25);
  border-radius: 12px !important;
}

.ups-builder-modal-title {
  margin: 0;
  font-size: 1.1rem;
}

.ups-builder-modal-sub {
  margin: 0.25rem 0 0.85rem;
  opacity: 0.85;
  font-size: 0.9rem;
}

.ups-builder-modal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.ups-builder-modal-field {
  display: grid;
  gap: 0.25rem;
}

.ups-builder-modal-field-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.8;
}

.ups-builder-modal-field textarea,
.ups-builder-modal-field input,
.ups-builder-modal-field select {
  width: 100%;
  border-radius: 8px;
}

.ups-builder-modal-field textarea {
  min-height: 80px;
  resize: vertical;
}

.ups-builder-modal-actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.dark-mode .ups-builder-modal {
  border-color: rgba(102, 187, 106, 0.35);
}

@media (max-width: 900px) {
  .ups-builder-modal-fields {
    grid-template-columns: 1fr;
  }
}

/* --- Generated Side Details Card --- */
.page-content .ups-side-infobox,
.page-content aside,
.page-editor .edit-area aside {
  float: right;
  position: relative;
  z-index: 30;
  width: min(360px, 45%);
  margin: 0 0 1rem 1rem;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 146, 69, 0.35);
  background: rgba(7, 29, 16, 0.72);
}

.page-content .ups-side-infobox-media,
.page-content aside > div:first-child,
.page-editor .edit-area aside > div:first-child {
  margin-bottom: 0.7rem;
}

.page-content .ups-side-infobox-image,
.page-content aside img:first-child,
.page-editor .edit-area aside img:first-child {
  width: 100%;
  border-radius: 10px;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.page-content .ups-side-infobox-add-image {
  display: none !important;
}

.page-content .ups-side-infobox-media-empty {
  display: none !important;
}

.page-editor .edit-area .ups-side-infobox-media-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  aspect-ratio: 4 / 3;
  border: 1px dashed rgba(210, 230, 218, 0.45);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.page-editor .edit-area .ups-side-infobox-media-empty .ups-side-infobox-add-image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.2rem 0.55rem;
  border: 1px dashed rgba(210, 230, 218, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(233, 244, 238, 0.9);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.page-editor .edit-area .ups-side-infobox-media-empty .ups-side-infobox-add-image:hover {
  border-color: rgba(210, 230, 218, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

.page-content .ups-side-infobox-image-placeholder,
.page-content aside > div:first-child:not(:has(img)),
.page-editor .edit-area aside > div:first-child:not(:has(img)) {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.76);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.page-content .ups-side-infobox hr,
.page-content aside hr,
.page-editor .edit-area aside hr {
  border-color: rgba(255, 255, 255, 0.18);
  margin: 0.4rem 0 0.7rem;
}

.page-content .ups-side-infobox-title,
.page-content aside h3,
.page-editor .edit-area aside h3 {
  margin: 0 0 0.45rem;
  font-size: 1.1rem !important;
  line-height: 1.2;
}

.page-content .ups-side-infobox-section,
.page-content aside h4,
.page-editor .edit-area aside h4 {
  margin: 0.8rem 0 0.45rem;
  font-size: 1rem !important;
  line-height: 1.2;
}

.page-content .ups-side-infobox-table,
.page-content aside table,
.page-editor .edit-area aside table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.page-content .ups-side-infobox-table th,
.page-content .ups-side-infobox-table td,
.page-content aside table th,
.page-content aside table td,
.page-editor .edit-area aside table th,
.page-editor .edit-area aside table td {
  padding: 0.22rem 0;
  vertical-align: top;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.page-content .ups-side-infobox-table th,
.page-content .ups-side-infobox-table td,
.page-content aside table th,
.page-content aside table td {
  border: 0 !important;
}

.page-editor .edit-area .ups-side-infobox-table th,
.page-editor .edit-area .ups-side-infobox-table td,
.page-editor .edit-area aside table th,
.page-editor .edit-area aside table td {
  border: 1px solid rgba(210, 230, 218, 0.35) !important;
  padding: 0.22rem 0.35rem;
}

.page-content .ups-side-infobox-table th,
.page-content aside table th,
.page-editor .edit-area aside table th {
  width: 40%;
  text-transform: uppercase;
  font-size: 0.84rem;
  font-weight: 700;
  opacity: 0.88;
}

.page-content .ups-side-infobox-table td,
.page-content aside table td,
.page-editor .edit-area aside table td {
  font-size: 0.94rem;
}

.page-content aside table td:first-child,
.page-editor .edit-area aside table td:first-child {
  width: 40%;
  text-transform: uppercase;
  font-size: 0.84rem;
  font-weight: 700;
  opacity: 0.88;
}

.page-content aside table td:nth-child(2),
.page-editor .edit-area aside table td:nth-child(2) {
  width: 60%;
  text-transform: none;
  font-size: 0.94rem;
  font-weight: 400;
  opacity: 1;
}

html:not(.dark-mode) .page-content .ups-side-infobox,
html:not(.dark-mode) .page-content aside,
html:not(.dark-mode) .page-editor .edit-area aside {
  background: rgba(11, 71, 32, 0.08);
}

@media (max-width: 900px) {
  .page-content .ups-side-infobox,
  .page-content aside,
  .page-editor .edit-area aside {
    float: none;
    width: 100%;
    margin: 0 0 1rem;
  }
}
