/* ============================================
   Generator Page Styles
   ============================================ */

/* ---------- Dropdown Nav ---------- */
.nav__dropdown {
    position: relative;
}

.nav__link--dropdown {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    cursor: pointer;
}

.nav__link--dropdown:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav__link--dropdown i {
    font-size: 16px;
    transition: transform 0.2s;
}

.nav__dropdown:hover .nav__link--dropdown i {
    transform: rotate(180deg);
}

.nav__dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    min-width: 220px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.nav__dropdown:hover .nav__dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.nav__dropdown-item i {
    font-size: 18px;
    color: var(--text-lighter);
    width: 20px;
    text-align: center;
}

.nav__dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav__dropdown-item:hover i {
    color: var(--primary);
}

.nav__dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav__dropdown-item.active i {
    color: var(--primary);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb-bar {
    padding-top: calc(var(--header-h) + 16px);
    padding-bottom: 0;
    background: var(--bg-alt);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-lighter);
}

.breadcrumb a {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    font-weight: 500;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span {
    color: var(--primary);
    font-weight: 600;
}

/* ---------- Page Hero ---------- */
.page-hero {
    padding: 32px 0 40px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-light);
}

.page-hero__content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.page-hero__icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    color: #fff;
    font-size: 28px;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.page-hero__title {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.page-hero__subtitle {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.6;
    max-width: 600px;
}

/* ---------- Generator Layout ---------- */
.gen-section {
    padding: 40px 0 80px;
}

.gen-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 32px;
    align-items: start;
}

/* ---------- Gen Panels ---------- */
.gen-panel--preview {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---------- Gen Block ---------- */
.gen-block {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.gen-block__header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-alt);
}

.gen-block__step {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    border-radius: 50%;
    flex-shrink: 0;
}

.gen-block__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.gen-block__body {
    padding: 24px;
}

/* ---------- URL Input ---------- */
.url-input-group {
    display: flex;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg);
}

.url-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

.url-protocol-select {
    padding: 14px 12px;
    border: none;
    outline: none;
    background: var(--bg-alt);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-right: 1px solid var(--border);
    appearance: none;
    min-width: 90px;
    text-align: center;
}

.url-input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--dark);
    background: transparent;
    min-width: 0;
}

.url-input::placeholder {
    color: var(--text-lighter);
}

.url-clear-btn {
    padding: 14px 16px;
    color: var(--text-lighter);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    cursor: pointer;
}

.url-clear-btn:hover {
    color: var(--text);
}

.url-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-lighter);
}

.url-hint i { font-size: 14px; }

.url-hint.error {
    color: #EF4444;
}

.url-hint.success {
    color: #10B981;
}

/* ---------- Customize ---------- */
.customize-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.customize-field {
    display: flex;
    flex-direction: column;
}

.customize-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-2);
    margin-bottom: 8px;
}

.customize-value {
    font-weight: 500;
    color: var(--text-lighter);
    font-size: 12px;
    margin-left: auto;
}

/* Color Picker */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: border-color 0.2s;
}

.color-picker-wrap:focus-within {
    border-color: var(--primary);
}

.color-picker {
    width: 32px;
    height: 32px;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 6px;
    background: none;
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
}
.color-picker::-moz-color-swatch {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
}

.color-text {
    width: 80px;
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 600;
    font-family: monospace;
    color: var(--dark);
    text-transform: uppercase;
    background: transparent;
}

.swap-colors-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1px;
    flex-shrink: 0;
}

.swap-colors-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Color Presets */
.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset {
    display: flex;
    gap: 2px;
    padding: 4px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.color-preset:hover {
    border-color: var(--border);
    transform: scale(1.05);
}

.color-preset.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.color-preset span {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: block;
}

/* Range Slider */
.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-lighter);
    margin-top: 4px;
}

/* Error Correction Options */
.ec-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.ec-option {
    cursor: pointer;
}

.ec-option input {
    display: none;
}

.ec-option__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: all 0.2s;
}

.ec-option__box strong {
    font-size: 16px;
    font-weight: 800;
    color: var(--dark);
}

.ec-option__box span {
    font-size: 11px;
    color: var(--text-lighter);
    font-weight: 500;
}

.ec-option:hover .ec-option__box {
    border-color: var(--primary);
    background: var(--primary-light);
}

.ec-option input:checked + .ec-option__box {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.ec-option input:checked + .ec-option__box strong {
    color: var(--primary);
}

/* Info Tooltip */
.info-tooltip {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-lighter);
    font-size: 12px;
    cursor: help;
    position: relative;
    transition: all 0.2s;
}

.info-tooltip:hover {
    background: var(--primary);
    color: #fff;
}

.info-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    padding: 10px 14px;
    background: var(--dark);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    pointer-events: none;
}

/* ---------- Preview Card ---------- */
.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.preview-card__label {
    padding: 14px 20px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preview-card__canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    min-height: 280px;
    background:
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.preview-card__canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow-md);
}

.preview-card__url {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-light);
    overflow: hidden;
}

.preview-card__url i {
    color: var(--primary);
    flex-shrink: 0;
}

.preview-card__url span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
    font-size: 12px;
}

.preview-card__actions {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-card__actions-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.preview-card__actions-row .btn {
    padding: 10px 4px;
    font-size: 13px;
    gap: 4px;
    justify-content: center;
    white-space: nowrap;
}

.preview-card__meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 14px 20px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border-light);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-lighter);
}

.meta-item i {
    font-size: 14px;
}

/* ---------- Bulk Card ---------- */
.bulk-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.bulk-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 6px;
}

.bulk-card h3 i {
    color: var(--primary);
}

.bulk-card > p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 14px;
    line-height: 1.5;
}

.bulk-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: monospace;
    color: var(--dark);
    resize: vertical;
    outline: none;
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 12px;
}

.bulk-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

/* ---------- Related Types ---------- */
.related-types__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.related-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    transition: all 0.3s;
    text-align: center;
}

.related-type-card i {
    font-size: 28px;
}

.related-type-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    color: var(--primary);
}

/* ---------- Guide Grid ---------- */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.guide-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    transition: all 0.3s;
}

.guide-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.guide-card__icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.guide-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
}

.guide-card p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
}

.guide-card ul {
    list-style: none;
    padding: 0;
}

.guide-card ul li {
    position: relative;
    padding-left: 20px;
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 6px;
}

.guide-card ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
}

/* ---------- Pattern Selector ---------- */
.pattern-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.pattern-selector--sm {
    grid-template-columns: repeat(3, 1fr);
}

.pattern-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.pattern-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.pattern-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.pattern-thumb {
    width: 36px;
    height: 36px;
    color: var(--dark);
}

.pattern-option.active .pattern-thumb {
    color: var(--primary);
}

.pattern-option span {
    font-size: 11px;
    font-weight: 600;
    color: var(--dark);
}

.pattern-option.active span {
    color: var(--primary);
}

/* ---------- Custom Checkbox ---------- */
.customize-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
    margin-right: 4px;
}

/* ---------- Logo Upload ---------- */
.logo-upload__dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
    transition: all 0.2s;
    text-align: center;
}

.logo-upload__dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.logo-upload__dropzone i {
    font-size: 36px;
    color: var(--text-lighter);
}

.logo-upload__dropzone.dragover i {
    color: var(--primary);
}

.logo-upload__dropzone p {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    margin: 0;
}

.logo-upload__dropzone > span {
    font-size: 12px;
    color: var(--text-lighter);
}

.logo-upload__hint {
    font-size: 11px !important;
    color: var(--text-lighter) !important;
    margin-top: 4px;
}

.logo-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.logo-preview__img-wrap {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-alt);
    margin: 0 auto;
}

.logo-preview__img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-preview__controls {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.logo-remove-btn {
    flex-shrink: 0;
    color: #EF4444 !important;
    border-color: #FCA5A5 !important;
}

.logo-remove-btn:hover {
    background: #FEF2F2 !important;
}

.logo-ec-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 14px;
    background: #EEF2FF;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.logo-ec-notice i {
    font-size: 16px;
    flex-shrink: 0;
}

/* ---------- Frame Selector ---------- */
.frame-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.frame-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.frame-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.frame-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.frame-thumb {
    width: 48px;
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.frame-thumb__qr {
    width: 28px;
    height: 28px;
    background: var(--dark);
    border-radius: 2px;
}

.frame-thumb--simple {
    border: 2px solid var(--dark);
    padding: 4px;
}

.frame-thumb--rounded {
    border: 2px solid var(--dark);
    border-radius: 6px;
    padding: 4px;
}

.frame-thumb--badge {
    border: 2px solid var(--dark);
    border-radius: 6px;
    overflow: hidden;
    padding: 4px;
    padding-bottom: 0;
}

.frame-thumb__text {
    font-size: 5px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: calc(100% + 8px);
    text-align: center;
    background: var(--dark);
    padding: 3px 0;
    margin: 3px -4px 0;
}

.frame-option span {
    font-size: 11px;
    font-weight: 600;
    color: var(--dark);
}

.frame-option.active span {
    color: var(--primary);
}

/* -- Banner Top thumb -- */
.frame-thumb--banner-top {
    border: 2px solid var(--dark);
    border-radius: 6px;
    overflow: hidden;
    padding: 0 4px 4px;
    padding-top: 0;
}
.frame-thumb__text-top {
    font-size: 5px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: calc(100% + 8px);
    text-align: center;
    background: var(--dark);
    padding: 3px 0;
    margin: 0 -4px 3px;
}

/* -- Shadow thumb -- */
.frame-thumb--shadow {
    border: 2px solid var(--dark);
    padding: 4px;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.25);
}

/* -- Dotted thumb -- */
.frame-thumb--dotted {
    border: 2px dashed var(--dark);
    border-radius: 4px;
    padding: 4px;
}

/* -- Double thumb -- */
.frame-thumb--double {
    border: 2px solid var(--dark);
    padding: 2px;
    outline: 2px solid var(--dark);
    outline-offset: 2px;
}

/* -- Bubble thumb -- */
.frame-thumb--bubble {
    border: 2px solid var(--dark);
    border-radius: 6px;
    padding: 4px;
    position: relative;
    margin-bottom: 8px;
}
.frame-thumb--bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 7px solid var(--dark);
}

/* -- Ticket thumb -- */
.frame-thumb--ticket {
    border: 2px solid var(--dark);
    padding: 4px;
    position: relative;
}
.frame-thumb--ticket::before,
.frame-thumb--ticket::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--dark);
}
.frame-thumb--ticket::before { left: -6px; }
.frame-thumb--ticket::after { right: -6px; }

/* -- Stamp thumb -- */
.frame-thumb--stamp {
    padding: 5px;
    position: relative;
    background:
        radial-gradient(circle, var(--bg) 2.5px, transparent 2.5px) -2.5px -2.5px / 7px 7px repeat,
        var(--dark);
    background-clip: padding-box;
}

/* -- Ribbon thumb -- */
.frame-thumb--ribbon {
    border: 2px solid var(--dark);
    border-radius: 6px;
    padding: 4px;
    padding-bottom: 0;
    overflow: hidden;
}
.frame-thumb__ribbon-text {
    font-size: 5px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    background: var(--dark);
    padding: 3px 0;
    margin: 3px -8px 0;
    position: relative;
}
.frame-thumb__ribbon-text::before,
.frame-thumb__ribbon-text::after {
    content: '';
    position: absolute;
    top: -3px;
    width: 0;
    height: 0;
    border-bottom: 3px solid rgba(0,0,0,0.3);
}
.frame-thumb__ribbon-text::before {
    left: 0;
    border-left: 4px solid transparent;
}
.frame-thumb__ribbon-text::after {
    right: 0;
    border-right: 4px solid transparent;
}

/* ---------- Input Field ---------- */
.input-field {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.input-field::placeholder {
    color: var(--text-lighter);
}

/* ---------- QR Container in Preview ---------- */
#qrContainer {
    display: flex;
    align-items: center;
    justify-content: center;
}

#qrContainer canvas,
#qrContainer svg {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow-md);
}

#qrExportCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow-md);
}

/* ---------- QR Placeholder ---------- */
.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 220px;
    height: 220px;
    background: #F8FAFC;
    border-radius: 8px;
    color: #94A3B8;
    gap: 8px;
}

.qr-placeholder i {
    font-size: 32px;
}

.qr-placeholder span {
    font-size: 13px;
    font-weight: 500;
}

/* ---------- Template Gallery ---------- */
.template-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.template-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.template-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.template-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.template-card__preview {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.template-card__preview .tpl-bg {
    position: absolute;
    inset: 0;
    border-radius: 6px;
}

.template-card__preview .tpl-dot {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
}

.template-card__name {
    font-size: 11px;
    font-weight: 600;
    color: var(--dark);
}

.template-card.active .template-card__name {
    color: var(--primary);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-lighter);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    background: none;
    border: none;
}

.modal__close:hover {
    background: var(--bg-alt);
    color: var(--dark);
}

.modal__body {
    padding: 24px;
}

.modal__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---------- Print Presets ---------- */
.print-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.print-preset {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.print-preset:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.print-preset.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.print-preset strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
}

.print-preset span {
    font-size: 11px;
    color: var(--text-lighter);
    font-weight: 500;
}

.print-preset.active strong {
    color: var(--primary);
}

/* ---------- Embed Section ---------- */
.embed-section {
    border-top: 1px solid var(--border-light);
}

.embed-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s;
    cursor: pointer;
    background: none;
    border: none;
}

.embed-toggle:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.embed-toggle__arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.embed-toggle.active .embed-toggle__arrow {
    transform: rotate(180deg);
}

.embed-content {
    padding: 0 20px 20px;
}

.embed-code-wrap {
    position: relative;
    margin-top: 6px;
}

.embed-textarea {
    width: 100%;
    padding: 10px 14px;
    padding-right: 80px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: 'Courier New', monospace;
    color: var(--dark);
    resize: none;
    outline: none;
    background: var(--bg-alt);
    box-sizing: border-box;
}

.embed-textarea:focus {
    border-color: var(--primary);
}

.embed-copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 11px !important;
    padding: 4px 10px !important;
}

/* ============================================
   PLAIN TEXT INPUT
   ============================================ */

.text-input-wrap {
    position: relative;
}

.text-input-wrap textarea.text-input {
    width: 100%;
    min-height: 100px;
    max-height: 300px;
    resize: vertical;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    padding: 14px 40px 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.text-input-wrap textarea.text-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.text-input-wrap textarea.text-input::placeholder {
    color: var(--text-muted);
}

.text-input-wrap .url-clear-btn {
    position: absolute;
    top: 12px;
    right: 12px;
}

.char-counter {
    display: flex;
    justify-content: flex-end;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    transition: color 0.2s;
}

.char-counter--warning {
    color: #D97706;
}

.char-counter--danger {
    color: #DC2626;
    font-weight: 600;
}

/* ============================================
   EMAIL FORM
   ============================================ */

.email-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.email-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.email-required {
    color: #EF4444;
    font-weight: 700;
}

.email-cc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-start;
}

.email-cc-toggle:hover {
    background: var(--primary);
    color: #fff;
}

.email-cc-toggle i {
    font-size: 16px;
}

.email-cc-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .gen-layout {
        grid-template-columns: 1fr 360px;
        gap: 24px;
    }

    .related-types__grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 860px) {
    .gen-layout {
        grid-template-columns: 1fr;
        overflow: hidden;
    }

    /* Critical: allow grid items to shrink below content intrinsic width */
    .gen-panel {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }

    .gen-panel--preview {
        position: static;
    }

    .preview-card__canvas-wrap {
        min-height: 200px;
        padding: 24px;
    }

    .preview-card__canvas-wrap canvas {
        max-width: 100%;
        height: auto !important;
    }

    .customize-row {
        flex-wrap: wrap;
    }

    .customize-field {
        min-width: 140px;
        flex: 1;
    }
}

@media (max-width: 768px) {
    .nav__dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        padding: 0 0 0 16px;
        opacity: 1;
        visibility: visible;
        display: none;
    }

    .nav__dropdown.open .nav__dropdown-menu {
        display: block;
    }

    /* Prevent overflow globally on this page */
    .gen-section,
    .gen-layout,
    .gen-panel,
    .gen-block,
    .preview-card,
    .bulk-card {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .gen-layout {
        width: 100%;
    }

    /* Canvas must respect container on mobile */
    .preview-card__canvas-wrap canvas,
    #qrCanvas,
    #qrExportCanvas,
    #qrContainer canvas,
    #qrContainer svg {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Pattern selector mobile */
    .pattern-selector { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .pattern-option { padding: 8px 4px; }
    .pattern-thumb { width: 28px; height: 28px; }
    .pattern-option span { font-size: 10px; }

    /* Frame selector mobile */
    .frame-selector { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .frame-option { padding: 8px 4px; }
    .frame-option span { font-size: 10px; }
    .frame-thumb { width: 40px; height: 48px; }
    .frame-thumb__qr { width: 22px; height: 22px; }

    /* Logo upload mobile */
    .logo-upload__dropzone { padding: 24px 16px; }
    .logo-upload__dropzone i { font-size: 28px; }
    .logo-upload__dropzone p { font-size: 13px; }
    .logo-preview__controls { flex-direction: column; align-items: stretch; }
    .logo-remove-btn { align-self: flex-start; }

    /* Input field mobile */
    .input-field { padding: 10px 12px; font-size: 13px; }

    /* Breadcrumb */
    .breadcrumb-bar { padding-top: calc(var(--header-h) + 12px); }
    .breadcrumb { font-size: 12px; }

    /* Page Hero */
    .page-hero { padding: 24px 0 32px; }
    .page-hero__content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    .page-hero__icon { width: 52px; height: 52px; font-size: 24px; }
    .page-hero__title { font-size: 22px; }
    .page-hero__subtitle { max-width: 100%; font-size: 14px; }

    /* Generator Section */
    .gen-section { padding: 24px 0 60px; }
    .gen-block { margin-bottom: 16px; overflow: hidden; }
    .gen-block__header { padding: 14px 16px; }
    .gen-block__title { font-size: 15px; }
    .gen-block__body { padding: 16px; }

    /* URL input */
    .url-input-group { border-radius: var(--radius-sm); }
    .url-protocol-select {
        min-width: 70px;
        padding: 12px 6px;
        font-size: 12px;
    }
    .url-input {
        padding: 12px 10px;
        font-size: 14px;
    }
    .url-clear-btn { padding: 12px 10px; }

    /* Color row: side by side with swap in the middle */
    .customize-row {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 8px;
        align-items: end;
    }

    .customize-field { min-width: 0; width: 100%; }

    .color-picker-wrap { padding: 5px 8px; }
    .color-picker { width: 28px; height: 28px; }
    .color-text { width: 60px; font-size: 12px; }

    .swap-colors-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin: 0 0 1px 0;
        flex-shrink: 0;
        align-self: end;
    }

    /* Presets */
    .color-presets { gap: 6px; }
    .color-preset span { width: 18px; height: 18px; }

    /* Size & margin slider rows: full width stacked */
    .customize-row:has(.range-slider),
    .customize-row:has(.ec-options) {
        grid-template-columns: 1fr;
    }

    /* Sliders */
    .customize-label {
        font-size: 12px;
        flex-wrap: wrap;
        gap: 4px;
    }
    .customize-value { font-size: 11px; white-space: nowrap; }
    .range-labels { font-size: 10px; }
    .range-slider { width: 100%; }

    /* EC options */
    .ec-options { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .ec-option__box { padding: 10px 4px; }
    .ec-option__box strong { font-size: 14px; }
    .ec-option__box span { font-size: 10px; }

    /* Tooltip */
    .info-tooltip:hover::after {
        left: auto;
        right: 0;
        transform: none;
        width: 220px;
    }

    /* Preview Card */
    .preview-card { overflow: hidden; }
    .preview-card__canvas-wrap { padding: 20px; min-height: 220px; }
    .preview-card__label { padding: 12px 16px; font-size: 12px; }
    .preview-card__url { padding: 8px 16px; font-size: 12px; }
    .preview-card__url span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
    .preview-card__actions { padding: 14px; gap: 8px; }

    .preview-card__actions-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .preview-card__actions-row .btn {
        padding: 10px 4px;
        font-size: 12px;
        gap: 3px;
    }

    .preview-card__meta {
        flex-wrap: wrap;
        gap: 6px 12px;
        padding: 12px 14px;
        justify-content: center;
    }
    .meta-item { font-size: 10px; }
    .meta-item i { font-size: 12px; }

    /* Bulk */
    .bulk-card { padding: 18px; overflow: hidden; }
    .bulk-card h3 { font-size: 14px; }
    .bulk-card > p { font-size: 12px; word-wrap: break-word; }
    .bulk-textarea { font-size: 12px; padding: 10px 12px; }

    /* Related types */
    .related-types__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .related-type-card { padding: 16px 8px; font-size: 11px; gap: 8px; }
    .related-type-card i { font-size: 20px; }

    /* Guide */
    .guide-grid { grid-template-columns: 1fr; gap: 16px; }
    .guide-card { padding: 24px 20px; }
    .guide-card h3 { font-size: 15px; }
    .guide-card p, .guide-card ul li { font-size: 13px; }
}

@media (max-width: 480px) {
    .page-hero__title { font-size: 20px; }

    .related-types__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ec-options { grid-template-columns: repeat(2, 1fr); }

    /* Color row stacks on very small screens */
    .customize-row {
        grid-template-columns: 1fr;
    }

    .swap-colors-btn {
        align-self: center;
    }

    .color-presets { gap: 4px; }
    .color-preset { padding: 3px; }
    .color-preset span { width: 16px; height: 16px; }

    /* Pattern selector 480px */
    .pattern-selector { grid-template-columns: repeat(2, 1fr); }

    /* Frame selector 480px */
    .frame-selector { grid-template-columns: repeat(2, 1fr); }

    /* Template gallery 480px */
    .template-gallery { grid-template-columns: repeat(2, 1fr); }

    /* Modal 480px */
    .modal__body { padding: 16px; }
    .modal__header { padding: 16px; }
    .modal__footer { padding: 12px 16px; }

    /* Embed 480px */
    .embed-content { padding: 0 14px 14px; }
}