/* Global resets handled by Bootstrap */
html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 280px;
    background-color: var(--bs-tertiary-bg);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
}

.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.app-header {
    height: 60px;
    background-color: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.app-title {
    font-weight: 700;
}

.app-content {
    flex: 1 1 auto;
    padding: 1.75rem 1.75rem 3rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Sidebar */
.sidebar-brand {
    display: block;
    padding: 1.25rem 1.5rem;
    color: var(--bs-body-color);
    text-decoration: none;
    border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-brand-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link,
.sidebar-heading-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--bs-border-radius);
    font-size: 0.925rem;
}

.sidebar-link {
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.sidebar-link i {
    font-size: 1.05rem;
}

.sidebar-link:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.sidebar-link.active {
    background-color: var(--bs-primary);
    color: #ffffff !important;
    font-weight: 600;
}

.sidebar-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 1.2rem;
    margin-right: -0.25rem;
    cursor: pointer;
}

.sidebar-link .sidebar-chevron i,
.sidebar-heading-item .sidebar-chevron i {
    font-size: 0.8rem;
}

.sidebar-heading-item.sidebar-collapsible {
    pointer-events: auto;
    cursor: pointer;
}

.sidebar-heading-item {
    color: var(--bs-body-color);
    font-weight: 700;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.sidebar-divider {
    border-top: 1px solid var(--bs-border-color);
    margin: 0.5rem 0.25rem;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    margin-left: 0.4rem;
    opacity: 0.85;
}

.sidebar-indent-0 { padding-left: 0.75rem !important; }
.sidebar-indent-1 { padding-left: 1.75rem !important; }
.sidebar-indent-2 { padding-left: 2.5rem !important; }
.sidebar-indent-3 { padding-left: 3.25rem !important; }
.sidebar-indent-4 { padding-left: 4rem !important; }

@media (max-width: 991.98px) {
    .app-sidebar {
        display: none;
        position: fixed;
        height: 100%;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    }

    .app-sidebar.show {
        display: flex;
    }
}

/* Post Styling mapped to BlogwtStyles */
.post-tile {
    cursor: pointer;
}

.post-tile-header h2 {
    font-weight: 700;
}

.tag-chip {
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.page-form .form-group {
    margin-bottom: 1rem;
}

.page-form .form-group > label {
    display: block;
    margin-bottom: 0.5rem;
}

.icon-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
}

.icon-picker-dialog {
    max-width: 25rem;
}

.icon-picker-dialog .modal-content {
    border: 0;
    border-radius: 1.75rem;
    background: var(--bs-body-bg);
    box-shadow: var(--bs-box-shadow-lg);
}

.icon-picker-title {
    padding: 1.5rem 1.5rem 1rem;
    font-size: 1.5rem;
    line-height: 2rem;
}

.icon-picker-body {
    padding: 0 1rem;
}

.icon-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem 1.5rem;
}

.icon-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 4.5rem;
    padding: 0.5rem 0.25rem;
    border: 0;
    border-radius: 1rem;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s;
}

.icon-picker-item:hover {
    background: var(--bs-secondary-bg);
}

.icon-picker-item:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.icon-picker-item.selected {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.icon-picker-item i {
    font-size: 1.5rem;
}

.search-picker-dialog {
    max-width: 28rem;
}

.search-picker-dialog .modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 3rem);
    overflow: hidden;
    border: 0;
    border-radius: 1.75rem;
    background: var(--bs-body-bg);
    box-shadow: var(--bs-box-shadow-lg);
}

.search-picker-dialog .icon-picker-title,
.search-picker-dialog .icon-picker-actions {
    flex: none;
}

.search-picker-field {
    flex: none;
    width: auto;
    margin: 0 1.5rem 0.75rem;
}

.search-picker-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 0.75rem 0.75rem;
}

.search-picker-item {
    display: block;
    width: 100%;
    padding: 0.625rem 1rem;
    border: 0;
    border-radius: 1rem;
    background: transparent;
    color: var(--bs-body-color);
    text-align: left;
    transition: background-color 0.15s;
}

.search-picker-item:hover {
    background: var(--bs-secondary-bg);
}

.search-picker-item:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.search-picker-item-title {
    display: block;
    line-height: 1.4;
}

.search-picker-item-slug {
    display: block;
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
}

.search-picker-empty {
    padding: 1.5rem;
    color: var(--bs-secondary-color);
    text-align: center;
}

.archive-post-link {
    cursor: pointer;
    color: var(--bs-link-color);
}

.archive-post-link:hover {
    text-decoration: underline;
}

/* Author info */
.post-author {
    font-size: 0.875rem;
}

.post-author .avatar {
    border: 1px solid var(--bs-border-color);
}

/* Footer Styling */
.app-footer {
    background: transparent;
    border-top: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
}

/* Custom States */
.loading, .error, .empty,
.loading-state, .success-state, .error-state,
.unknown, .placeholder-screen {
    text-align: center;
    padding: 4rem 2rem;
    width: 100%;
}

/* Sizes follow the embedding theme's font size and line width */
.spinner-tiny {
    --bs-spinner-width: calc(var(--embed-font-size, 1rem) * 1.25);
    --bs-spinner-height: calc(var(--embed-font-size, 1rem) * 1.25);
    --bs-spinner-border-width: calc(var(--embed-line-width, 1px) * 2);
}

.spinner-small {
    --bs-spinner-width: calc(var(--embed-font-size, 1rem) * 2);
    --bs-spinner-height: calc(var(--embed-font-size, 1rem) * 2);
    --bs-spinner-border-width: calc(var(--embed-line-width, 1px) * 3);
}

.spinner-large {
    --bs-spinner-width: calc(var(--embed-font-size, 1rem) * 4);
    --bs-spinner-height: calc(var(--embed-font-size, 1rem) * 4);
    --bs-spinner-border-width: calc(var(--embed-line-width, 1px) * 5);
}

.loading .spinner-large,
.loading-state .spinner-large {
    display: block;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error/Empty state icons */
.error-icon, .empty-icon {
    display: block;
    margin: 0 auto 1.5rem;
    font-size: 4rem;
    opacity: 0.5;
}

/* Post Content Images */
.post-content img {
    max-width: none;
    height: auto;
    display: block;
}

.post-content p,
.post-content figure {
    overflow-x: auto;
}

.hero-logo {
    max-height: 200px;
}

/* User pages */
.user-page {
    max-width: 760px;
    margin: 0 auto;
}

.user-avatar {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border: 1px solid var(--bs-border-color);
}

.user-card {
    position: relative;
}

.user-card .overlay-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border-radius: inherit;
    background: color-mix(in srgb, var(--bs-body-bg) 80%, transparent);
}

.user-card .remove-tag {
    opacity: 0.6;
}

.user-card .tag-chip:hover .remove-tag {
    opacity: 1;
}

.user-section + .user-section {
    margin-top: 1.5rem;
}

.user-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    object-fit: cover;
}

.app-content.app-content-bleed {
    max-width: none;
    padding: 0;
}

/* Willshex theme: after the Blogwt rules so it wins where they overlap */
:root {
  --app-logo-will: #ffffff;
  --font-mono: 'Noto Sans Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --app-sidebar-width: 280px;
  --app-header-height: 60px;
  --app-primary: #06d8a0;
  --app-primary-hover: #05b888;
  --app-primary-glow: rgba(6, 216, 160, 0.35);
  --app-secondary: #ff6f00;
  --app-secondary-hover: #e66400;
  --app-secondary-glow: rgba(255, 111, 0, 0.35);
  --app-tertiary: #3f37c9;
  --app-tertiary-hover: #322ca0;
  --app-tertiary-glow: rgba(63, 55, 201, 0.35);

  --app-bg: #080f19;
  --app-surface: #0f1a2a;
  --app-sidebar-bg: #0b1320;
  --app-card-bg: #0f1a2a;
  --app-border: #1e2f47;
  --app-text: #dde1e4;
  --app-text-muted: #8599ac;

  /* Bootstrap 5 theme overrides to match brand colors */
  --bs-primary: #06d8a0;
  --bs-primary-rgb: 6, 216, 160;
  --bs-primary-hover: #05b888;
  --bs-secondary: #ff6f00;
  --bs-secondary-rgb: 255, 111, 0;
  --bs-tertiary: #3f37c9;
  --bs-tertiary-rgb: 63, 55, 201;
  --bs-link-color: #06d8a0;
  --bs-link-hover-color: #05b888;
  --bs-link-color-rgb: 6, 216, 160;
  --bs-focus-ring-color: rgba(6, 216, 160, 0.35);

  /* Bootstrap 5 text and background system variables (Dark Mode) */
  --bs-body-color: #dde1e4;
  --bs-body-color-rgb: 221, 225, 228;
  --bs-body-bg: #080f19;
  --bs-body-bg-rgb: 8, 15, 25;
  --bs-secondary-color: #8599ac;
  --bs-secondary-color-rgb: 133, 153, 172;
  --bs-tertiary-color: #8599ac;
  --bs-border-color: #1e2f47;

  /* Generic / embedding / triangles token compatibility */
  --primary-color: #06d8a0;
  --primary-hover: #05b888;
  --accent-primary: #06d8a0;
  --accent-primary-hover: #05b888;
  --accent-light: rgba(6, 216, 160, 0.15);
  --bg-color: #080f19;
  --card-bg: #0f1a2a;
  --sidebar-bg: #0b1320;
  --border-color: #1e2f47;
  --text-main: #dde1e4;
  --text-muted: #8599ac;
}

[data-bs-theme="dark"] {
  --bs-link-color: #06d8a0;
  --bs-link-color-rgb: 6, 216, 160;
  --bs-link-hover-color: #05b888;
  --bs-link-hover-color-rgb: 5, 184, 136;
}

[data-bs-theme="light"] {
  --app-logo-will: #555753;
  --app-primary: #059669;
  --app-primary-hover: #047857;
  --app-primary-glow: rgba(5, 150, 105, 0.25);
  --app-secondary: #d95d00;
  --app-secondary-hover: #b44d00;
  --app-secondary-glow: rgba(217, 93, 0, 0.25);
  --app-tertiary: #4338ca;
  --app-tertiary-hover: #3730a3;
  --app-tertiary-glow: rgba(67, 56, 202, 0.25);

  --app-bg: #f8fafc;
  --app-surface: #ffffff;
  --app-sidebar-bg: #f1f5f9;
  --app-card-bg: #ffffff;
  --app-border: #e2e8f0;
  --app-text: #0f172a;
  --app-text-muted: #64748b;

  /* Bootstrap 5 theme overrides for light mode */
  --bs-primary: #059669;
  --bs-primary-rgb: 5, 150, 105;
  --bs-primary-hover: #047857;
  --bs-secondary: #d95d00;
  --bs-secondary-rgb: 217, 93, 0;
  --bs-tertiary: #4338ca;
  --bs-tertiary-rgb: 67, 56, 202;
  --bs-link-color: #059669;
  --bs-link-hover-color: #047857;
  --bs-link-color-rgb: 5, 150, 105;
  --bs-focus-ring-color: rgba(5, 150, 105, 0.25);

  /* Bootstrap 5 text and background system variables (Light Mode) */
  --bs-body-color: #0f172a;
  --bs-body-color-rgb: 15, 23, 42;
  --bs-body-bg: #f8fafc;
  --bs-body-bg-rgb: 248, 250, 252;
  --bs-secondary-color: #64748b;
  --bs-secondary-color-rgb: 100, 116, 139;
  --bs-tertiary-color: #64748b;
  --bs-border-color: #e2e8f0;

  /* Generic / embedding / triangles token compatibility */
  --primary-color: #059669;
  --primary-hover: #047857;
  --accent-primary: #059669;
  --accent-primary-hover: #047857;
  --accent-light: rgba(5, 150, 105, 0.15);
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --sidebar-bg: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--app-bg);
  color: var(--app-text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .font-display, .sidebar-brand {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

code, pre, .font-monospace {
  font-family: var(--font-mono) !important;
  font-variant-ligatures: none !important;
  font-feature-settings: "liga" 0, "calt" 0 !important;
}

.password-font {
  font-family: var(--font-mono) !important;
  font-variant-ligatures: none !important;
  font-feature-settings: "liga" 0, "calt" 0 !important;
}

/* Precision developer scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--app-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--app-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--app-primary);
}

::selection {
  background-color: var(--app-primary);
  color: #080f19;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--app-sidebar-width);
  background-color: var(--app-sidebar-bg);
  border-right: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow-y: auto;
}

.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.app-header {
  height: var(--app-header-height);
  background-color: var(--app-sidebar-bg);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 900;
}

.app-content {
  flex-grow: 1;
  padding: 1.75rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.app-content.app-content-bleed {
  padding: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.app-content.app-content-bleed > * {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Keep the flex chain intact through the embedded module theme wrapper */
.app-content.app-content-bleed > .embedding-theme-scope > * {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Sidebar Elements */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--app-text);
  text-decoration: none;
  border-bottom: 1px solid var(--app-border);
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted);
  padding: 0.75rem 0.75rem 0.25rem;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  color: var(--app-text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.925rem;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
}

.sidebar-indent-0 {
  padding-left: 0.75rem !important;
}

.sidebar-indent-1 {
  padding-left: 1.75rem !important;
}

.sidebar-indent-2 {
  padding-left: 2.5rem !important;
}

.sidebar-indent-3 {
  padding-left: 3.25rem !important;
}

.sidebar-indent-4 {
  padding-left: 4rem !important;
}

.sidebar-group {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--app-text);
}

.sidebar-leaf {
  font-size: 0.925rem;
  font-weight: 500;
}

.sidebar-heading-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  background: transparent !important;
}

.sidebar-heading-item:hover,
.sidebar-heading-item:focus,
.sidebar-heading-item:active {
  background: transparent !important;
  color: inherit !important;
}

.sidebar-divider {
  border-top: 1px solid var(--app-border);
  margin: 0.5rem 0.25rem;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: var(--app-secondary);
  margin-left: 0.4rem;
  opacity: 0.85;
}

.sidebar-link i {
  font-size: 1.05rem;
}

.sidebar-link:hover {
  background-color: var(--accent-light);
  color: var(--app-primary);
}

.sidebar-link.active {
  background-color: var(--app-primary);
  color: #080f19 !important;
  font-weight: 600;
  box-shadow: 0 0 15px -3px rgba(6, 216, 160, 0.45);
}

.sidebar-link.active .sidebar-subtitle {
  color: #080f19 !important;
  opacity: 0.8;
}

[data-bs-theme="light"] .sidebar-link.active {
  color: #ffffff !important;
  box-shadow: 0 2px 8px -1px rgba(5, 150, 105, 0.35);
}

[data-bs-theme="light"] .sidebar-link.active .sidebar-subtitle {
  color: #ffffff !important;
  opacity: 0.9;
}

.btn-primary {
  background-color: var(--app-primary) !important;
  border-color: var(--app-primary) !important;
  color: #080f19 !important;
  font-weight: 600;
}

[data-bs-theme="light"] .btn-primary {
  color: #ffffff !important;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--app-primary-hover) !important;
  border-color: var(--app-primary-hover) !important;
  color: #080f19 !important;
}

[data-bs-theme="light"] .btn-primary:hover,
[data-bs-theme="light"] .btn-primary:focus {
  color: #ffffff !important;
}

.btn-outline-primary {
  color: var(--app-primary) !important;
  border-color: var(--app-primary) !important;
}

.btn-outline-primary:hover {
  background-color: var(--app-primary) !important;
  color: #080f19 !important;
}

[data-bs-theme="light"] .btn-outline-primary:hover {
  color: #ffffff !important;
}

.btn-secondary {
  background-color: var(--app-secondary) !important;
  border-color: var(--app-secondary) !important;
  color: #ffffff !important;
  font-weight: 600;
}

.btn-secondary:hover, .btn-secondary:focus {
  background-color: var(--app-secondary-hover) !important;
  border-color: var(--app-secondary-hover) !important;
  color: #ffffff !important;
}

.btn-outline-secondary {
  color: var(--app-secondary) !important;
  border-color: var(--app-secondary) !important;
}

.btn-outline-secondary:hover {
  background-color: var(--app-secondary) !important;
  color: #ffffff !important;
}

.btn-toggled {
  color: var(--app-primary) !important;
  background-color: rgba(var(--bs-primary-rgb), 0.15) !important;
  border-color: rgba(var(--bs-primary-rgb), 0.3) !important;
  font-weight: 600;
}

.btn-toggled:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.25) !important;
}

/* Primary utilities respecting Bootstrap opacity classes (e.g. bg-opacity-10) */
.text-primary {
  color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity, 1)) !important;
}

.bg-primary {
  background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity, 1)) !important;
}

.border-primary {
  border-color: rgba(var(--bs-primary-rgb), var(--bs-border-opacity, 1)) !important;
}

/* Secondary background & border utilities */
.bg-secondary {
  background-color: rgba(var(--bs-secondary-rgb), var(--bs-bg-opacity, 1)) !important;
}

.border-secondary {
  border-color: rgba(var(--bs-secondary-rgb), var(--bs-border-opacity, 1)) !important;
}

/* Secondary and muted text mapping to brand Muted Slate (preventing fluorescent orange text) */
.text-secondary,
.text-body-secondary,
.text-muted {
  color: var(--app-text-muted) !important;
}

.text-body {
  color: var(--app-text) !important;
}

.text-secondary-emphasis {
  color: var(--app-text) !important;
}

/* Explicit brand accent text utility when Electric Amber text is desired */
.text-amber,
.text-brand-secondary,
.text-accent-secondary {
  color: var(--app-secondary) !important;
}

/* Cards */
.card {
  background-color: var(--app-card-bg);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--app-border);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

/* Canvas Styles */
.experiment-canvas {
  background-color: #0d1117;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  display: block;
  max-width: 100%;
}

/* JSON Tree Viewer */
.json-tree {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
}

.json-key {
  color: #9cdcfe;
  font-weight: 500;
}

.json-string {
  color: #ce9178;
}

.json-number {
  color: #b5cea8;
}

.json-boolean {
  color: #569cd6;
}

.json-null {
  color: #808080;
}

.json-toggle {
  cursor: pointer;
  user-select: none;
  margin-right: 0.25rem;
  color: var(--app-text-muted);
}

.json-toggle:hover {
  color: var(--app-primary);
}

/* Custom password strength colors */
.strength-0 { width: 10%; background-color: #ef4444; }
.strength-1 { width: 25%; background-color: #f97316; }
.strength-2 { width: 50%; background-color: #eab308; }
.strength-3 { width: 75%; background-color: #84cc16; }
.strength-4 { width: 90%; background-color: #22c55e; }
.strength-5 { width: 100%; background-color: #10b981; }

/* Responsive */
@media (max-width: 991.98px) {
  .app-sidebar {
    display: none;
    position: fixed;
    height: 100%;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5);
  }
  .app-sidebar.show {
    display: flex;
  }
}


/* Canvas Viewport */
.generator-canvas-area {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  overflow: hidden;
  min-height: 0;
}

.interactive-viewer-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.interactive-viewer-viewport.is-dragging {
  cursor: grabbing;
}

.interactive-viewer-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  will-change: transform;
}

.interactive-viewer-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 850;
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
}

.interactive-viewer-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.15s ease;
}

.interactive-viewer-btn:hover {
  background: rgba(128, 128, 128, 0.15);
}

.interactive-viewer-scale-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 48px;
  text-align: center;
  cursor: pointer;
  padding: 0 4px;
  user-select: none;
}

.interactive-viewer-scale-text:hover {
  color: var(--text-main);
}

.generated-image-container {
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.generated-image {
  max-width: 90%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Floating Action / Download Button */
.btn-fab-download {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 850;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  font-size: 1.25rem;
}

/* Pinned to the page's bottom-left, clear of the sidebar */
.btn-fab-page {
  position: fixed;
  left: calc(var(--app-sidebar-width) + 24px);
}

@media (max-width: 991.98px) {
  .btn-fab-page {
    left: 24px;
  }
}

/* Reference image overlay */
.reference-overlay {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 800;
  background-color: #000000;
}

.reference-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Swatches grid */
.swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
  margin: 1rem 0;
}

.swatch-card {
  height: 48px;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 2px;
}

.swatch-card.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--bs-primary);
}

.swatch-remove-btn {
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.swatch-remove-btn i {
  display: block;
  line-height: 1;
}

.swatch-remove-btn .bi::before {
  vertical-align: 0;
}

.swatch-add-card {
  height: 48px;
  border-radius: 6px;
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}

.swatch-add-card:hover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

/* Cards & Welcome */
.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.sample-card {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  aspect-ratio: 4 / 3;
}

.sample-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.sample-card:hover img {
  transform: scale(1.05);
}

/* Palette Picker Colored Range Sliders (matching Flutter activeColor) */
.form-range-colored {
  accent-color: var(--slider-color);
}

.form-range-red {
  --slider-color: #f44336;
  --slider-inactive: rgba(244, 67, 54, 0.25);
}

.form-range-green {
  --slider-color: #4caf50;
  --slider-inactive: rgba(76, 175, 80, 0.25);
}

.form-range-blue {
  --slider-color: #2196f3;
  --slider-inactive: rgba(33, 150, 243, 0.25);
}

.form-range-colored::-webkit-slider-runnable-track {
  background: linear-gradient(to right,
      var(--slider-color) 0%,
      var(--slider-color) var(--slider-pct, 50%),
      var(--slider-inactive) var(--slider-pct, 50%),
      var(--slider-inactive) 100%) !important;
  border-radius: 1rem;
  height: 0.5rem;
}

.form-range-colored::-moz-range-track {
  background: var(--slider-inactive) !important;
  border-radius: 1rem;
  height: 0.5rem;
}

.form-range-colored::-moz-range-progress {
  background-color: var(--slider-color) !important;
  border-radius: 1rem;
  height: 0.5rem;
}

.form-range-colored::-webkit-slider-thumb {
  background-color: var(--slider-color) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
  border: none !important;
}

.form-range-colored::-moz-range-thumb {
  background-color: var(--slider-color) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
  border: none !important;
}

.form-range-colored:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem var(--slider-inactive) !important;
}

.form-range-colored:focus::-moz-range-thumb {
  box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem var(--slider-inactive) !important;
}

.bi-flask::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22 fill=%22none%22 stroke=%22black%22 stroke-width=%221.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M5.8 1.5h4.4M6.8 1.5v4.6L2.6 12.9a1 1 0 0 0 .9 1.6h9a1 1 0 0 0 .9-1.6L9.2 6.1V1.5%22/%3E%3Cpath d=%22M4.4 10h7.2%22/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22 fill=%22none%22 stroke=%22black%22 stroke-width=%221.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M5.8 1.5h4.4M6.8 1.5v4.6L2.6 12.9a1 1 0 0 0 .9 1.6h9a1 1 0 0 0 .9-1.6L9.2 6.1V1.5%22/%3E%3Cpath d=%22M4.4 10h7.2%22/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Style guide */
.sg-card {
  background: var(--app-card-bg);
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
}

.sg-inset {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
}

.sg-kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sg-mono {
  font-family: var(--font-mono);
}

.sg-muted {
  color: var(--app-text-muted);
}

.sg-accent-mint {
  color: var(--app-primary);
}

.sg-accent-amber {
  color: var(--app-secondary);
}

.sg-accent-indigo {
  color: var(--app-tertiary);
}

.sg-accent-neutral {
  color: var(--app-text);
}

.sg-tint-mint {
  background: var(--app-primary-glow);
  border: 1px solid var(--app-primary);
}

.sg-tint-amber {
  background: var(--app-secondary-glow);
  border: 1px solid var(--app-secondary);
}

.sg-tint-indigo {
  background: var(--app-tertiary-glow);
  border: 1px solid var(--app-tertiary);
}

.sg-tint-neutral {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
}

.sg-section-head {
  border-bottom: 1px solid var(--app-border);
}

.sg-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 0.375rem;
  color: var(--app-text-muted);
}

.sg-badge {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: rgba(8, 15, 25, 0.8);
  color: #ffffff;
  width: max-content;
}

.sg-swatch {
  height: 6rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom: 1px solid var(--app-border);
}

.sg-copy {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  background: var(--app-bg);
  border: 0;
  border-radius: 0.25rem;
  color: var(--app-text);
}

.sg-copy:hover {
  background: var(--app-border);
}

.sg-logo-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 2rem;
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  transition: background-color 0.2s, border-color 0.2s;
}

.sg-logo svg {
  display: block;
  width: 100%;
  max-width: 780px;
  height: auto;
}

.sg-reticle {
  position: relative;
  width: 11rem;
  height: 11rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sg-reticle > i {
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border: 0 solid var(--app-primary);
}

.sg-reticle > i.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.sg-reticle > i.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.sg-reticle > i.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.sg-reticle > i.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.sg-reticle > span {
  position: absolute;
  padding: 0 0.25rem;
  background: var(--app-bg);
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.05em;
}

.sg-avatar-disc {
  width: 8rem;
  height: 8rem;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--app-card-bg);
  border: 1px solid var(--app-border);
}

.sg-avatar-disc img {
  height: 100%;
  width: auto;
}

.sg-playground {
  min-height: 140px;
  width: 100%;
  resize: vertical;
  padding: 1.5rem;
  background: var(--app-bg);
  color: var(--app-text);
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  line-height: 1.3;
}

.sg-toast {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1080;
  padding: 0.625rem 1rem;
  background: var(--app-surface);
  border: 1px solid var(--app-primary);
  border-radius: 0.5rem;
  color: var(--app-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Hue slider */
.form-range-hue::-webkit-slider-runnable-track {
  height: 0.5rem;
  border-radius: 1rem;
  background: linear-gradient(to right,
      hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%),
      hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%),
      hsl(360, 100%, 50%));
}

.form-range-hue::-moz-range-track {
  height: 0.5rem;
  border-radius: 1rem;
  background: linear-gradient(to right,
      hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%),
      hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%),
      hsl(360, 100%, 50%));
}

.form-range-hue::-webkit-slider-thumb {
  background-color: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.form-range-hue::-moz-range-thumb {
  background-color: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.form-range-hue:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 0.25rem var(--app-primary-glow);
}

.form-range-hue:focus::-moz-range-thumb {
  box-shadow: 0 0 0 0.25rem var(--app-primary-glow);
}

/* Colour swatches */
.colour-swatch {
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid var(--app-border);
}

/* Gallery */
.gallery-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  background: var(--app-bg);
  border: 2px solid var(--app-border);
  overflow: hidden;
  cursor: pointer;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb:hover {
  border-color: var(--app-text-muted);
}

.gallery-thumb.selected {
  border-color: var(--app-primary);
}

.gallery-thumb-pad {
  aspect-ratio: 1;
}

.gallery-full {
  position: relative;
  max-width: 100%;
}

.gallery-full img {
  object-fit: contain;
  display: block;
}

.gallery-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Home */
.home-logo svg {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 0 auto;
}

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

.resource-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
}

.resource-preview-mini {
    height: 200px;
    background: var(--bs-secondary-bg);
}

.resource-preview-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.resource-info {
    padding: 0.75rem 1rem 1rem;
}

.resource-info h3 {
    margin: 0;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-info p {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.texture-picker-dialog.icon-picker-dialog {
  max-width: 40rem;
}

.palette-picker-dialog.icon-picker-dialog {
  max-width: 31rem;
}

.texture-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.25rem;
}

.texture-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  padding: 0.375rem;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  color: var(--bs-secondary-color);
  font-size: 0.7rem;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s;
}

.texture-picker-item span {
  width: 100%;
  overflow-wrap: anywhere;
}

.texture-picker-item img,
.texture-picker-none {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.75rem;
  object-fit: cover;
}

.texture-picker-none {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.texture-picker-item:hover {
  background: var(--bs-secondary-bg);
}

.texture-picker-item:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.texture-picker-item.selected {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
}
