/* CODE SCRIBE CLEANER: ORIGINAL SAAS UI */

:root {
    --background: #ffffff;
    --foreground: #09090b;
    --gray-50: #f9fafb;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --blue-600: #2563eb;
    --blue-700: #1d4ed8;

    --green-600: #16a34a;
    --green-700: #15803d;

    --radius: 0.5rem;
    --radius-md: calc(var(--radius) - 2px);
    --radius-sm: calc(var(--radius) - 4px);
}

/* Base Layout */
.container {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 768px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    background-color: var(--gray-50);
    color: var(--foreground);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    height: 100%;
}

/* Typography Utilities */
.antialiased {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-sans {
    font-family: 'Inter', system-ui, sans-serif;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-medium {
    font-weight: 500;
}

.text-semibold {
    font-weight: 600;
}

.text-bold {
    font-weight: 700;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

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

.text-gray-600 {
    color: var(--gray-600);
}

.text-gray-700 {
    color: var(--gray-700);
}

.text-gray-800 {
    color: var(--gray-800);
}

.text-gray-900 {
    color: var(--gray-900);
}

.text-white {
    color: #ffffff;
}

/* Layout Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1 1 0%;
}

.items-center {
    align-items: center;
}

.items-end {
    align-items: flex-end;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.min-h-screen {
    min-height: 100vh;
}

/* Needed for flex children to stretch to full viewport height */
.flex.flex-col.min-h-screen {
    height: 100vh;
}

.h-full {
    height: 100%;
}

.w-full {
    width: 100%;
}

.min-w-0 {
    min-width: 0;
}

.min-h-0 {
    min-height: 0;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.sticky {
    position: sticky;
}

.top-0 {
    top: 0;
}

.z-50 {
    z-index: 50;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.overflow-y-auto {
    overflow-y: auto;
}

.shrink-0 {
    flex-shrink: 0;
}

/* Spacing */
.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-4 {
    padding: 1rem;
}

.pl-8 {
    padding-left: 2rem;
}

.mt-0\.5 {
    margin-top: 0.125rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.pt-4 {
    padding-top: 1rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.ml-auto {
    margin-left: auto;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
}

.space-x-2>*+* {
    margin-left: 0.5rem;
}

.space-x-3>*+* {
    margin-left: 0.75rem;
}

.space-x-6>*+* {
    margin-left: 1.5rem;
}

.space-x-8>*+* {
    margin-left: 2rem;
}

.space-y-1>*+* {
    margin-top: 0.25rem;
}

.space-y-2>*+* {
    margin-top: 0.5rem;
}

.space-y-3>*+* {
    margin-top: 0.75rem;
}

.space-y-4>*+* {
    margin-top: 1rem;
}

/* Backgrounds & Borders */
.bg-white {
    background-color: #ffffff;
}

.bg-gray-50 {
    background-color: var(--gray-50);
}

.bg-blue-600 {
    background-color: var(--blue-600);
}

.border-b {
    border-bottom: 1px solid;
}

.border-t {
    border-top: 1px solid;
}

.border-r {
    border-right: 1px solid;
}

.border-gray-200 {
    border-color: var(--gray-200);
}

.border-solid {
    border-style: solid;
}

.border-none {
    border: none;
}

.outline-none {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.rounded {
    border-radius: 0.25rem;
}

.rounded-md {
    border-radius: var(--radius-md);
}

/* Logo Styling */
.logo-link {
    text-decoration: none !important;
}

.logo-link:hover {
    opacity: 0.8;
}

/* Components */
.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--blue-600);
}

.nav-link.active {
    color: var(--blue-600);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: colors 0.2s, opacity 0.2s;
    height: 2.25rem;
    padding-left: 1rem;
    padding-right: 1rem;
    cursor: pointer;
    border: none;
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-sm {
    height: 2rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-size: 0.75rem;
}

.btn-primary {
    background-color: var(--blue-600);
    color: #ffffff;
    border: 1px solid var(--blue-600);
}

.btn-primary:hover {
    background-color: var(--blue-700);
    border-color: var(--blue-700);
    color: #ffffff;
}

.btn-muted {
    background-color: var(--gray-200);
    color: var(--gray-900);
    border: 1px solid transparent;
}

.btn-muted:hover {
    background-color: var(--gray-300);
    color: var(--gray-900);
}

.btn-success {
    background-color: var(--green-600);
    color: #ffffff;
}

.btn-success:hover {
    background-color: var(--green-700);
}

.btn-secondary {
    background-color: var(--gray-600);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: var(--gray-700);
}

.btn-ghost {
    background-color: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background-color: var(--gray-200);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--gray-200);
    color: var(--foreground);
}

.btn-outline:hover {
    background-color: var(--gray-50);
}

.input {
    display: block;
    height: 2.25rem;
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    background-color: var(--background);
    color: var(--gray-900);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.find-rule .input {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

.input:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 1px var(--blue-600);
}

.input::placeholder {
    color: var(--gray-400);
}

/* Workspace */
.workspace {
    flex: 1 1 auto;
    min-height: calc(100vh - 57px);
}

.workspace.editor-workspace {
    flex: 0 0 auto;
    min-height: unset;
    align-items: stretch;
    overflow: visible;
}

.tools-row {
    display: flex;
    align-items: stretch;
    min-width: 0;
}

.tools-column {
    flex: 1 1 0;
    min-width: 0;
}

.tools-column-input {
    border-right: 1px solid var(--gray-200);
}

.tools-column-output {
    padding: 1rem;
}

.tools-column-output .sidebar-content {
    padding: 0;
}

.find-replace-actions {
    display: flex;
    justify-content: flex-end;
}

.editor-panel-footer {
    min-height: 2.75rem;
    width: 100%;
    box-sizing: border-box;
}

.editor-panel-footer--actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.editor-panel-footer-main {
    flex-wrap: wrap;
}

.editor-footer-stats {
    white-space: nowrap;
}

.editor-panel-footer-spacer {
    width: 5.5rem;
    height: 2rem;
}

.editor-panel-footer--spacer {
    min-height: 2.75rem;
}

@media (min-width: 768px) {
    .tools-column-output .sidebar.options-panel {
        position: static;
        width: 100%;
        min-width: 0;
        max-width: none;
        height: auto;
        transform: none;
        box-shadow: none;
        border: none;
        align-self: stretch;
        overflow: visible;
    }
}

.editor-main-column {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editors-row {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.tools-panel {
    flex-shrink: 0;
}

/* Sidebar */
.sidebar {
    width: 20rem;
    min-width: 20rem;
    min-height: 0;
    flex-shrink: 0;
    align-self: stretch;
    position: relative;
    z-index: 1;
}

.sidebar-content {
    padding: 1rem;
}

#options-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 1rem;
}

#options-list .option-item {
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    margin-bottom: 0;
    min-width: 0;
}

#options-list .option-item .checkbox-label {
    line-height: 1.2;
}

.option-icon {
    flex-shrink: 0;
    width: 0.875rem;
    height: 0.875rem;
    margin-top: 0;
    color: var(--gray-500);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.option-icon svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* Checkbox (Shadcn style) */
.checkbox-label {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    padding: 0;
}

.checkbox-input {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--background);
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1rem;
    height: 1rem;
    border: 1px solid var(--gray-900);
    border-radius: 0.25rem;
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
    transition: background-color 0.2s, border-color 0.2s;
}

.checkbox-input:checked {
    background-color: var(--gray-900);
    border-color: var(--gray-900);
}

.checkbox-input:checked::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    background-color: white;
}

.checkbox-input:focus-visible {
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--gray-900);
}


/* Language Switcher */
.lang-dropdown {
    position: relative;
}

.lang-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--gray-900);
    padding: 0.3rem 0.5rem;
    border: none;
    border-radius: 0.375rem;
    background-color: var(--gray-200);
    transition: background-color 0.2s;
    font: inherit;
}

.lang-dropdown-toggle:hover,
.lang-dropdown.is-open .lang-dropdown-toggle {
    background-color: var(--gray-300);
}

.lang-dropdown-chevron {
    flex-shrink: 0;
    opacity: 0.7;
    transition: transform 0.15s ease;
}

.lang-dropdown.is-open .lang-dropdown-chevron {
    transform: rotate(180deg);
}

.lang-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 10.5rem;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    z-index: 60;
}

.lang-dropdown-menu[hidden] {
    display: none;
}

.lang-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.375rem;
    color: var(--gray-900);
    text-decoration: none;
    white-space: nowrap;
}

.lang-dropdown-item:hover {
    background-color: var(--gray-100);
}

.lang-dropdown-item.is-active {
    background-color: #eff6ff;
    color: var(--blue-600);
}

.lang-dropdown-code {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.5rem;
}

.lang-dropdown-label {
    font-size: 0.8125rem;
}

/* Form & Editor specifics */
.hidden {
    display: none;
}

/* md-flex must override hidden, so no !important on hidden */
@media (min-width: 768px) {
    .md-flex.hidden {
        display: flex !important;
    }
}

/* Editor panels */
.editor-panel > .bg-gray-50.px-4.py-2 {
    min-height: 3rem;
    box-sizing: border-box;
}

.editor-panel {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.editor-panel-body {
    flex: 1 1 auto;
    min-height: 140px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-panel-body > .text-xs.font-mono,
.editor-panel-body > .text-xs.font-mono.h-full {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.editor-panel-body.editor-resizable {
    position: relative;
    flex: 1 1 auto;
    min-height: 140px;
}

.editor-panel.has-resize-handle > .editor-resize-handle,
.editor-panel-body.has-resize-handle > .editor-resize-handle {
    position: absolute;
    right: 12px;
    bottom: 4px;
    width: 20px;
    height: 20px;
    z-index: 40;
    cursor: ns-resize;
    pointer-events: auto;
    touch-action: none;
    background:
        linear-gradient(135deg, transparent 45%, var(--gray-400) 45%, var(--gray-400) 50%, transparent 50%),
        linear-gradient(135deg, transparent 60%, var(--gray-400) 60%, var(--gray-400) 65%, transparent 65%);
    opacity: 0.9;
}

.editor-panel.has-resize-handle > .editor-resize-handle::before,
.editor-panel-body.has-resize-handle > .editor-resize-handle::before {
    content: '';
    position: absolute;
    inset: -12px -8px -8px -8px;
}

.editor-panel.has-resize-handle > .editor-resize-handle:hover,
.editor-panel-body.has-resize-handle > .editor-resize-handle:hover {
    opacity: 1;
}

body.editor-resizing {
    cursor: ns-resize;
    user-select: none;
}

body.editor-resizing .editor-panel.has-resize-handle > .editor-resize-handle,
body.editor-resizing .editor-panel-body.has-resize-handle > .editor-resize-handle {
    opacity: 1;
}

.editor-panel-body.quill-host,
.editor-panel-body.editor-input-host {
    overflow: visible;
    background: var(--background);
}

.editor-input-host .CodeMirror {
    background: var(--background);
}

.editor-input-host .CodeMirror-scroll {
    padding: 1rem;
}

/* Visual editor toolbar — between panel header and editor body */
.editor-visual-toolbar .ql-toolbar.ql-snow,
.editor-panel-body > .ql-toolbar.ql-snow,
#quill-editor > .ql-toolbar.ql-snow {
    display: block !important;
    visibility: visible !important;
    flex-shrink: 0;
    min-height: 42px;
    border: none;
    border-bottom: 1px solid var(--gray-200);
    background: var(--background);
    padding: 8px;
    z-index: 2;
}

#quill-editor.ql-container.ql-snow {
    flex: 1 1 auto;
    min-height: 0;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.ql-snow .ql-tooltip {
    z-index: 1000;
}

.editor-visual-toolbar .ql-toolbar.ql-snow .ql-stroke,
.editor-panel-body > .ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--gray-700);
}

.editor-panel-body > .ql-toolbar.ql-snow .ql-stroke.ql-fill {
    fill: var(--gray-700);
}

.editor-panel-body > .ql-toolbar.ql-snow .ql-fill {
    fill: var(--gray-700);
}

.editor-panel-body > .ql-toolbar.ql-snow button:hover .ql-stroke,
.editor-panel-body > .ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: var(--blue-600);
}

.editor-panel-body > .ql-toolbar.ql-snow button:hover .ql-fill,
.editor-panel-body > .ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: var(--blue-600);
}

.editor-panel-body > .ql-toolbar.ql-snow .visual-header-select,
.editor-visual-toolbar .ql-toolbar.ql-snow .visual-header-select {
    height: 24px;
    margin-top: 0;
    padding: 2px 6px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--gray-700);
    font-size: 0.8125rem;
    cursor: pointer;
}

.editor-visual-toolbar .ql-toolbar.ql-snow button:hover .ql-stroke,
.editor-visual-toolbar .ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: var(--blue-600);
}

.editor-visual-toolbar .ql-toolbar.ql-snow button:hover .ql-fill,
.editor-visual-toolbar .ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: var(--blue-600);
}

.visual-color-picker {
    position: relative;
    display: inline-block;
}

.visual-color-picker .visual-color-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.visual-color-picker .ql-background .ql-bg-label {
    stroke: none;
}

.ql-editor .ql-align-center {
    text-align: center;
}

.ql-editor .ql-align-right {
    text-align: right;
}

.ql-editor .ql-align-justify {
    text-align: justify;
}

.ql-table-insert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    padding: 3px 5px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--gray-700);
}

.ql-table-insert:hover {
    color: var(--blue-600);
}

.ql-table-insert svg {
    pointer-events: none;
}

.seo-section [data-i18n="description-text"] h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.seo-section [data-i18n="description-text"] ul {
    list-style: disc;
    padding-left: 1.25rem;
}

.seo-section [data-i18n="description-text"] li {
    margin-bottom: 0.5rem;
}

.gap-1 {
    gap: 0.25rem;
}

.option-select-group {
    margin-bottom: 0.75rem;
}

.option-select-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.option-select {
    height: 2rem;
    font-size: 0.75rem;
}

#quill-editor .ql-editor {
    flex: 1 1 auto;
    min-height: 140px;
    padding: 1rem;
    cursor: text;
    outline: none;
}

#quill-editor .ql-editor [style],
#quill-editor .ql-editor font {
    font-family: inherit;
}

#quill-editor .ql-editor * {
    max-width: 100%;
}

#quill-editor .ql-editor.ql-blank::before {
    color: var(--gray-400);
    font-style: normal;
}

#quill-editor .ql-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
}

#quill-editor .ql-editor td,
#quill-editor .ql-editor th {
    border: 1px solid var(--gray-200);
    padding: 0.25rem 0.5rem;
    min-width: 2rem;
}

#codemirror-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#codemirror-wrapper .CodeMirror {
    flex: 1 1 auto;
    height: auto !important;
}

/* CodeMirror Overrides */
#output-textarea {
    width: 100%;
    height: 100%;
    min-height: 100px;
    border: none;
    resize: none;
}

.CodeMirror {
    height: 100% !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    font-size: 0.75rem;
    line-height: 1.5;
    background: transparent;
    color: var(--gray-800);
}

.CodeMirror-scroll {
    padding: 1rem;
}

.CodeMirror-lines {
    padding: 0;
}

.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
    padding: 0;
}

.CodeMirror-focused .CodeMirror-cursors {
    visibility: visible !important;
}

/* Tools panel max height */
.max-h-30vh {
    max-height: 30vh;
}

/* Grid Layout */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .md-flex {
        display: flex;
    }

    .md-hidden {
        display: none;
    }

    .md-grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md-flex-row {
        flex-direction: row;
    }

    .md-mt-0 {
        margin-top: 0;
    }

    .md-p-12 {
        padding: 3rem;
    }

    .md-px-12 {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

/* Font weights */
.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

/* Text sizes */
.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

/* Line height */
.leading-relaxed {
    line-height: 1.625;
}

/* Lists */
.list-disc {
    list-style-type: disc;
}

.pl-5 {
    padding-left: 1.25rem;
}

/* Sizing */
.w-8 {
    width: 2rem;
}

.h-8 {
    height: 2rem;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.px-0 {
    padding-left: 0;
    padding-right: 0;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.pr-2 {
    padding-right: 0.5rem;
}

.mr-1 {
    margin-right: 0.25rem;
}

/* Colors */
.text-red-500 {
    color: #ef4444;
}

.text-gray-500 {
    color: #6b7280;
}

.text-blue-600 {
    color: var(--blue-600);
}

.hover\:text-red-700:hover {
    color: #b91c1c;
}

.hover\:text-blue-600:hover {
    color: var(--blue-600);
}

.border-gray-300 {
    border-color: #d1d5db;
}

/* Spacing */
.space-x-1>*+* {
    margin-left: 0.25rem;
}

.space-x-4>*+* {
    margin-left: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.p-8 {
    padding: 2rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* Layout */
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.max-w-5xl {
    max-width: 64rem;
}

.z-10 {
    z-index: 10;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

.w-80 {
    width: 20rem;
}

.min-w-80 {
    min-width: 20rem;
}

/* Max height utilities */
.max-h-\[300px\] {
    max-height: 300px;
}

.max-h-\[150px\] {
    max-height: 150px;
}

.max-h-\[500px\] {
    max-height: 500px;
}

.min-h-\[400px\] {
    min-height: 400px;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* Outline button custom */
.outline-btn-custom {
    border-color: var(--gray-200);
}

.footer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.75rem;
}

.footer-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-bar-secondary {
    font-size: 0.8125rem;
}

.footer-bar .footer-link {
    color: var(--gray-500);
    text-decoration: none;
}

.footer-bar .footer-link:hover {
    color: var(--gray-500);
    text-decoration: underline;
}

.footer-sep {
    color: var(--gray-400);
    user-select: none;
}

/* Legal documents (privacy, terms) */
.legal-page {
    flex: 1;
    width: 100%;
    padding: 1.5rem 1rem 2.5rem;
}

.legal-article {
    max-width: 48rem;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 2rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--gray-800);
    line-height: 1.65;
    font-size: 0.9375rem;
}

.legal-article h1 {
    margin: 0 0 1.25rem;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--gray-900);
}

.legal-article h2 {
    margin: 1.75rem 0 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--gray-900);
}

.legal-article p {
    margin: 0 0 0.85rem;
}

.legal-article ul {
    margin: 0 0 1rem 1.25rem;
    padding: 0;
    list-style: disc;
}

.legal-article li {
    margin: 0 0 0.45rem;
}

.legal-article a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-article a:hover {
    color: #1d4ed8;
}

@media (min-width: 768px) {
    .legal-page {
        padding: 2rem 1.5rem 3rem;
    }

    .legal-article {
        padding: 2rem 2.25rem 2.5rem;
    }
}

/* 404 page */
.error-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 2rem 1rem 3rem;
}

.error-card {
    width: 100%;
    max-width: 32rem;
    padding: 2.5rem 1.75rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.error-code {
    margin: 0 0 0.5rem;
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--gray-200);
}

.error-title {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--gray-900);
}

.error-text {
    margin: 0 0 1.5rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--gray-600);
}

.error-actions {
    display: flex;
    justify-content: center;
}

.error-home-btn {
    min-width: 10rem;
}

@media (min-width: 768px) {
    .error-card {
        padding: 3rem 2.5rem;
    }

    .error-code {
        font-size: 5.5rem;
    }
}

/* mt-auto for footer */
.mt-auto {
    margin-top: auto;
}

/* Mobile-only UI */
.mobile-only {
    display: none !important;
}

.mobile-toolbar {
    display: none;
}

.btn-mobile-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--gray-700);
}

.btn-mobile-burger:hover {
    background: var(--gray-200);
}

.btn-mobile-options {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-mobile-options:hover {
    background: var(--gray-200);
}

.btn-mobile-options svg {
    flex-shrink: 0;
    color: var(--gray-600);
}

.mobile-nav-drawer {
    position: fixed;
    top: 7rem;
    left: 0;
    bottom: 0;
    width: min(16rem, 82vw);
    z-index: 48;
    background: var(--background);
    border-right: 1px solid var(--gray-200);
    box-shadow: none;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-nav-drawer.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.mobile-nav-drawer .nav-link {
    display: block;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    background: var(--gray-50);
}

.mobile-nav-drawer .nav-link.hidden {
    display: none;
}

.mobile-nav-drawer .nav-link.active {
    background: #eff6ff;
    color: var(--blue-600);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 40;
}

.sidebar-overlay.is-visible {
    display: block;
}

@media (max-width: 767px) {
    .mobile-only {
        display: inline-flex !important;
    }

    .mobile-toolbar {
        display: flex;
        padding: 0.5rem 1rem;
        background: var(--background);
        border-bottom: 1px solid var(--gray-200);
        position: sticky;
        top: 3.5rem;
        z-index: 47;
    }

    .mobile-nav-drawer {
        top: 7rem;
    }

    body {
        overflow-x: hidden;
    }

    .flex.flex-col.min-h-screen {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }

    header .gap-8 {
        gap: 0.75rem;
    }

    header .text-xl {
        font-size: 1.0625rem;
        line-height: 1.5rem;
    }

    .workspace,
    .workspace.editor-workspace {
        flex-direction: column;
        min-height: 0;
        overflow: visible;
    }

    .tools-row {
        flex-direction: column;
    }

    .tools-column-input {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .tools-column-output {
        position: absolute;
        width: 0;
        height: 0;
        overflow: visible;
        padding: 0;
        border: none;
        flex: 0 0 auto;
    }

    .tools-column-output .sidebar-content {
        padding: 1rem;
    }

    .sidebar {
        position: fixed;
        top: 7rem;
        left: 0;
        bottom: 0;
        width: min(20rem, 88vw);
        min-width: 0;
        max-width: 88vw;
        height: auto;
        z-index: 45;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .editor-main-column {
        width: 100%;
        flex: 1 1 auto;
        overflow: visible;
    }

    .editors-row {
        flex-direction: column;
        overflow: visible;
    }

    .editor-panel {
        flex: 0 0 auto;
        width: 100%;
        min-height: 0;
        border-right: none !important;
        border-bottom: 1px solid var(--gray-200);
    }

    .editor-panel:last-child {
        border-bottom: none;
    }

    .editor-panel-body,
    .editor-panel-body.editor-resizable {
        min-height: 220px;
    }

    .editor-panel > .bg-gray-50.px-4.py-2.flex {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .editor-panel > .bg-gray-50.px-4.py-2 .flex.space-x-2.items-center {
        flex-wrap: wrap;
        row-gap: 0.25rem;
        max-width: 100%;
    }

    .editor-visual-toolbar .ql-toolbar.ql-snow,
    .editor-panel-body > .ql-toolbar.ql-snow {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .find-rule {
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.375rem;
    }

    .find-rule .input {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
    }

    .find-rule .rule-delete {
        flex: 0 0 2rem;
        align-self: center;
    }

    .find-replace-actions {
        justify-content: flex-end;
    }

    .tools-panel .max-h-\[300px\] {
        max-height: none;
    }

    .seo-section.p-8 {
        padding: 1.5rem 1rem;
    }

    .sidebar-content {
        padding-bottom: 2rem;
    }

    .option-select {
        width: 100%;
    }

    .editor-panel.has-resize-handle > .editor-resize-handle,
    .editor-panel-body.has-resize-handle > .editor-resize-handle {
        right: 10px;
        width: 26px;
        height: 26px;
    }
}
