@charset "UTF-8";
/* ============================================================
   KRONIKZ — iOS-style redesign layer
   Loaded after style.css / enhanced-canvas-styles.css so it
   refines the existing components into an Apple-app feel.
   Preserves all existing IDs / behavior.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Dark (default) */
  --ios-bg: #0b0712;
  --ios-bg-glow: radial-gradient(120% 80% at 50% -10%, rgba(139, 92, 246, 0.28), transparent 60%);
  --ios-surface: rgba(28, 28, 32, 0.72);
  --ios-surface-2: rgba(48, 48, 54, 0.66);
  --ios-surface-3: rgba(72, 72, 80, 0.55);
  --ios-elevated: rgba(58, 58, 66, 0.92);
  --ios-separator: rgba(255, 255, 255, 0.09);
  --ios-hairline: rgba(255, 255, 255, 0.14);

  --ios-label: rgba(255, 255, 255, 0.98);
  --ios-label-2: rgba(235, 235, 245, 0.62);
  --ios-label-3: rgba(235, 235, 245, 0.34);

  --ios-tint: #b39df6;
  --ios-tint-strong: #8b5cf6;
  --ios-gradient: linear-gradient(135deg, #8b5cf6, #ec4899);
  --ios-on-tint: #ffffff;
  --ios-green: #34c759;
  --ios-fill: rgba(118, 118, 128, 0.24);
  --ios-fill-2: rgba(118, 118, 128, 0.18);

  --ios-radius-card: 22px;
  --ios-radius-group: 16px;
  --ios-radius-control: 12px;
  --ios-radius-chip: 14px;

  --ios-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px rgba(0, 0, 0, 0.4);
  --ios-spring: cubic-bezier(0.22, 1, 0.36, 1);

  --ios-tabbar-h: 58px;
  --ios-formatbar-h: 46px;
}

[data-bs-theme="light"] {
  --ios-bg: #f2f2f7;
  --ios-bg-glow: radial-gradient(120% 80% at 50% -10%, rgba(139, 92, 246, 0.12), transparent 60%);
  --ios-surface: rgba(255, 255, 255, 0.82);
  --ios-surface-2: rgba(255, 255, 255, 0.92);
  --ios-surface-3: rgba(120, 120, 128, 0.12);
  --ios-elevated: #ffffff;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --ios-hairline: rgba(60, 60, 67, 0.18);

  --ios-label: #1c1c1e;
  --ios-label-2: rgba(60, 60, 67, 0.6);
  --ios-label-3: rgba(60, 60, 67, 0.3);

  --ios-tint: #7c3aed;
  --ios-tint-strong: #7c3aed;
  --ios-on-tint: #ffffff;
  --ios-fill: rgba(118, 118, 128, 0.12);
  --ios-fill-2: rgba(118, 118, 128, 0.08);

  --ios-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* ---------- Base ---------- */
body {
  font-family: var(--ios-font);
  background: var(--ios-bg-glow), var(--ios-bg) !important;
  background-attachment: fixed;
  color: var(--ios-label);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-bs-theme="light"] body {
  background: var(--ios-bg-glow), var(--ios-bg) !important;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
}

/* Tame the global `* { transition: all }` so layout feels crisp, not laggy */
* {
  transition: background-color 0.25s var(--ios-spring),
    color 0.25s var(--ios-spring), border-color 0.25s var(--ios-spring),
    box-shadow 0.25s var(--ios-spring), transform 0.2s var(--ios-spring),
    opacity 0.25s var(--ios-spring) !important;
}

/* ---------- Navigation bar (header) ---------- */
.glass-header {
  background: var(--ios-surface) !important;
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  border-bottom: 0.5px solid var(--ios-hairline) !important;
  padding-top: calc(0.5rem + env(safe-area-inset-top)) !important;
}

.glass-header .text-gradient,
h1.text-gradient {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  border-radius: 11px;
}

/* ---------- Theme toggle: iOS-style switch ---------- */
button.theme-toggle {
  background: var(--ios-fill);
}
.theme-toggle.light {
  background: var(--ios-green);
}
.theme-slider {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ---------- Help button ---------- */
#helpBtn.btn {
  border-radius: 980px;
  border: 0.5px solid var(--ios-hairline);
  background: var(--ios-fill);
  color: var(--ios-label);
  padding: 0.35rem 0.75rem;
  font-weight: 600;
}
#helpBtn.btn:hover {
  background: var(--ios-fill-2);
}

/* ---------- Cards / materials ---------- */
.glass-card {
  background: var(--ios-surface) !important;
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border: 0.5px solid var(--ios-hairline) !important;
  border-radius: var(--ios-radius-card) !important;
  box-shadow: var(--ios-shadow) !important;
}

/* ---------- Format / size picker ---------- */
.format-bar {
  margin-bottom: 1rem;
}
.format-bar-track {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0.15rem 0.5rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.format-bar-track::-webkit-scrollbar {
  display: none;
}
.format-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--ios-radius-chip);
  border: 0.5px solid var(--ios-hairline);
  background: var(--ios-surface-2);
  color: var(--ios-label-2);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--ios-font);
}
.format-chip:hover {
  background: var(--ios-surface-3);
  color: var(--ios-label);
}
.format-chip:active {
  transform: scale(0.96);
}
.format-chip.is-active {
  background: var(--ios-gradient);
  border-color: transparent;
  color: var(--ios-on-tint);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}
.format-chip-icon {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  flex: 0 0 auto;
  opacity: 0.95;
}
.ratio-1-1  { width: 16px; height: 16px; }
.ratio-9-16 { width: 11px; height: 18px; }
.ratio-3-1  { width: 22px; height: 8px; }
.ratio-4-5  { width: 15px; height: 18px; }
.ratio-16-9 { width: 20px; height: 12px; }
.ratio-fb   { width: 22px; height: 9px; }
.format-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  text-align: left;
}
.format-chip-name {
  font-size: 0.82rem;
  font-weight: 600;
}
.format-chip-dim {
  font-size: 0.66rem;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}
.format-bar-status {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--ios-label-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* The frame hugs the canvas; size snaps so it never lags behind the aspect
   change (a max-width transition would briefly mismatch when widening). */
#canvasContainer {
  transition: none !important;
  margin-inline: auto;
}

/* Fabric.js wraps the <canvas> in its OWN div.canvas-container, which otherwise
   inherits the frame's padding/max-width/background. Because Fabric's canvases
   are absolutely positioned, that inherited 16px padding shoves them outside the
   frame (the mobile overflow). Neutralize the inner wrapper — only the outer
   #canvasContainer is the visible frame. */
#canvasContainer > .canvas-container {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: hidden;
}

/* ---------- Segmented control (main tabs) — desktop ---------- */
.glass-tabs {
  background: var(--ios-fill) !important;
  border-radius: var(--ios-radius-control);
  padding: 3px;
  gap: 2px;
}
.glass-tabs .nav-link {
  border-radius: 9px;
  color: var(--ios-label-2);
  padding: 0.5rem 0.4rem;
}
.glass-tabs .nav-link:hover {
  background: transparent;
  color: var(--ios-label);
}
.glass-tabs .nav-link.active {
  background: var(--ios-elevated) !important;
  color: var(--ios-tint) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28), 0 0 0 0.5px var(--ios-hairline) !important;
}
.glass-tabs .nav-link span {
  font-size: 0.72rem;
  font-weight: 600;
}

/* ---------- Sub-tabs & gender selector ---------- */
.glass-sub-tabs {
  background: var(--ios-fill-2) !important;
  border-radius: 10px;
}
.glass-sub-tabs .nav-link.active,
.gender-btn.active {
  background: var(--ios-gradient) !important;
  color: #fff !important;
}
.gender-selector {
  background: var(--ios-fill-2) !important;
  border-radius: 12px;
}

/* ---------- iOS grouped list rows (effects / text toggles) ---------- */
.tab-pane h6 {
  color: var(--ios-label-2);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding-left: 0.15rem;
}
.form-check.form-switch {
  background: var(--ios-surface-2);
  border: 0.5px solid var(--ios-hairline);
  border-radius: var(--ios-radius-control);
  padding: 0.7rem 0.85rem 0.7rem 3.4rem;
  margin-bottom: 0.5rem;
  min-height: 48px;
  display: flex;
  align-items: center;
}
.form-check.form-switch .form-check-label {
  color: var(--ios-label);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ---------- iOS switch ---------- */
.form-switch .form-check-input {
  width: 51px !important;
  height: 31px !important;
  margin-left: -2.85rem;
  margin-top: 0;
  background-color: var(--ios-fill) !important;
  background-image: none !important;
  border: none !important;
  border-radius: 999px !important;
  cursor: pointer;
  box-shadow: none !important;
  transition: background-color 0.25s var(--ios-spring) !important;
}
.form-switch .form-check-input:checked {
  background-color: var(--ios-green) !important;
  border-color: var(--ios-green) !important;
}
.form-switch .form-check-input:focus {
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25) !important;
}
.form-switch .form-check-input::before {
  content: "";
  display: block;
  width: 27px;
  height: 27px;
  margin: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translateX(0);
  transition: transform 0.28s var(--ios-spring);
}
.form-switch .form-check-input:checked::before {
  transform: translateX(20px);
}

/* ---------- iOS sliders ---------- */
.form-range,
.glass-range {
  height: 28px;
}
.form-range::-webkit-slider-runnable-track,
.glass-range::-webkit-slider-runnable-track {
  background: var(--ios-fill) !important;
  height: 5px !important;
  border-radius: 3px;
}
.form-range::-moz-range-track,
.glass-range::-moz-range-track {
  background: var(--ios-fill) !important;
  height: 5px !important;
  border-radius: 3px;
}
.form-range::-webkit-slider-thumb,
.glass-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px !important;
  height: 26px !important;
  margin-top: -10px;
  background: #fff !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(0, 0, 0, 0.05) !important;
}
.form-range::-moz-range-thumb,
.glass-range::-moz-range-thumb {
  width: 26px !important;
  height: 26px !important;
  background: #fff !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

/* ---------- Inputs / selects ---------- */
.glass-input,
.glass-select,
.form-control,
.form-select {
  background: var(--ios-surface-2) !important;
  border: 0.5px solid var(--ios-hairline) !important;
  border-radius: var(--ios-radius-control) !important;
  color: var(--ios-label) !important;
  min-height: 44px;
  font-size: 0.95rem;
}
.glass-input:focus,
.glass-select:focus,
.form-control:focus,
.form-select:focus {
  border-color: var(--ios-tint-strong) !important;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.22) !important;
}
.form-label {
  color: var(--ios-label-2);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.glass-color,
.form-control-color {
  border-radius: 10px !important;
  border: 0.5px solid var(--ios-hairline) !important;
}

/* ---------- Buttons ---------- */
/* Primary filled (Add Text, etc.) */
.glass-button-primary {
  border-radius: var(--ios-radius-control) !important;
  min-height: 50px;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  background: var(--ios-gradient) !important;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35) !important;
}
.glass-button-primary:active {
  transform: scale(0.98);
}

/* Plain / toolbar glass buttons */
.glass-button {
  background: var(--ios-surface-2) !important;
  border: 0.5px solid var(--ios-hairline) !important;
  border-radius: var(--ios-radius-control) !important;
  color: var(--ios-label) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.glass-button i {
  color: var(--ios-tint);
}
.glass-button span {
  color: var(--ios-label-2);
}
.glass-button:hover {
  background: var(--ios-surface-3) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}
.glass-button:active {
  transform: scale(0.96);
}

/* ---------- Accordions → iOS inset grouped lists ---------- */
.glass-accordion .accordion-item {
  background: var(--ios-surface-2) !important;
  border: 0.5px solid var(--ios-hairline) !important;
  border-radius: var(--ios-radius-group) !important;
}
.glass-accordion .accordion-button {
  background: transparent !important;
  color: var(--ios-label) !important;
  font-weight: 600;
  font-size: 0.95rem;
}
.glass-accordion .accordion-button:not(.collapsed) {
  color: var(--ios-tint) !important;
}

/* ---------- Drag zones ---------- */
.glass-drag-zone {
  border: 1.5px dashed var(--ios-hairline) !important;
  border-radius: var(--ios-radius-group);
  background: var(--ios-surface-2) !important;
}
.glass-drag-zone:hover,
.glass-drag-zone.drag-over {
  border-color: var(--ios-tint-strong) !important;
  background: rgba(139, 92, 246, 0.12) !important;
}

/* ---------- Thumbnails ---------- */
.thumbnail {
  border-radius: 12px;
}

/* ---------- Inspector sheet (offcanvas) ---------- */
.ios-sheet,
#controlsOffcanvas {
  background: var(--ios-surface) !important;
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-left: 0.5px solid var(--ios-hairline) !important;
  border-radius: var(--ios-radius-card) 0 0 var(--ios-radius-card) !important;
}
#controlsOffcanvas .offcanvas-header {
  background: transparent !important;
  border-bottom: 0.5px solid var(--ios-separator) !important;
}
#controlsOffcanvas .offcanvas-title {
  font-weight: 700;
  color: var(--ios-label);
}

/* ---------- Notifications → iOS toast ---------- */
.notification {
  border-radius: 16px !important;
  background: var(--ios-elevated) !important;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 0.5px solid var(--ios-hairline) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45) !important;
}
.notification-content {
  color: var(--ios-label) !important;
  font-weight: 600;
}

/* ---------- Footer ---------- */
.app-credit {
  color: var(--ios-label-2);
  font-size: 0.78rem;
}
.app-credit a {
  color: var(--ios-tint);
}

/* ---------- Focus visibility (iOS tint) ---------- */
a:focus-visible,
button:focus-visible,
.nav-link:focus-visible,
.format-chip:focus-visible,
.glass-button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--ios-tint) !important;
  outline-offset: 2px !important;
}

/* ============================================================
   MOBILE: iOS tab-bar layout (< lg / 992px)
   ============================================================ */
@media (max-width: 991.98px) {
  body {
    /* leave room for the tab bar + the pinned format strip above it */
    padding-bottom: calc(
      var(--ios-tabbar-h) + var(--ios-formatbar-h) + env(safe-area-inset-bottom) + 8px
    );
  }

  /* On mobile the navigation lives in a dedicated bottom tab bar (.ios-tabbar,
     appended to <body> by ios-features.js). Hide the in-card segmented tabs;
     they can't be fixed here because the .glass-card's backdrop-filter creates
     a containing block. */
  #mainTabs {
    display: none !important;
  }

  /* The in-card format chips are replaced by the pinned .ios-formatbar strip. */
  #formatBar {
    display: none !important;
  }
}

/* iOS format strip — pinned just above the bottom tab bar (built in JS) */
.ios-formatbar {
  display: none;
}
@media (max-width: 991.98px) {
  .ios-formatbar {
    display: flex;
    gap: 0.4rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--ios-tabbar-h) + env(safe-area-inset-bottom));
    z-index: 1029;
    height: var(--ios-formatbar-h);
    align-items: center;
    padding: 0 0.6rem;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--ios-surface);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    backdrop-filter: saturate(180%) blur(28px);
    border-top: 0.5px solid var(--ios-separator);
    scroll-snap-type: x proximity;
  }
  .ios-formatbar::-webkit-scrollbar {
    display: none;
  }
  .ios-formatbar__chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 0.5px solid var(--ios-hairline);
    background: var(--ios-surface-2);
    color: var(--ios-label-2);
    font-family: var(--ios-font);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  .ios-formatbar__chip:active {
    transform: scale(0.95);
  }
  .ios-formatbar__chip.is-active {
    background: var(--ios-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
  }
}

/* iOS UITabBar — fixed to the viewport, built in ios-features.js */
.ios-tabbar {
  display: none;
}
@media (max-width: 991.98px) {
  .ios-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--ios-surface);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    backdrop-filter: saturate(180%) blur(28px);
    border-top: 0.5px solid var(--ios-hairline);
  }
  .ios-tabbar__btn {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 46px;
    padding: 2px;
    border: none;
    background: transparent;
    color: var(--ios-label-2);
    font-family: var(--ios-font);
    cursor: pointer;
  }
  .ios-tabbar__btn svg {
    width: 24px;
    height: 24px;
  }
  .ios-tabbar__btn span {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  .ios-tabbar__btn.is-active {
    color: var(--ios-tint);
  }
  .ios-tabbar__btn:active {
    transform: scale(0.92);
  }
}

/* Very small phones: tighten the format chips */
@media (max-width: 575.98px) {
  .format-chip-dim {
    display: none;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
  .canvas-container {
    transition: none !important;
  }
}
