/* ==========================================================================
   Vouchermaker — Global Stylesheet
   Single source of truth for all custom styles (Tailwind handles utilities).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CROSS-BROWSER NORMALIZATION
   Levels out rendering differences between Chrome, Safari, Firefox and Edge.
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%; /* Prevent iOS font inflation in landscape */
    text-size-adjust: 100%;
    tab-size: 4;
}

body {
    margin: 0;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Shared content width — aligns header logo/user with page body */
.app-container {
    width: 100%;
    max-width: 80rem; /* Tailwind max-w-7xl */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Media elements: block display kills inline baseline gaps (Safari/Firefox) */
img,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

/* Form controls inherit typography instead of using per-browser UA fonts */
button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    color: inherit;
    margin: 0;
}

button,
[type='button'],
[type='reset'],
[type='submit'] {
    -webkit-appearance: button;
    appearance: button;
    background-color: transparent;
    background-image: none;
    cursor: pointer;
}

/* Remove Firefox's inner focus border on buttons */
button::-moz-focus-inner,
[type='button']::-moz-focus-inner,
[type='reset']::-moz-focus-inner,
[type='submit']::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

/* Consistent number inputs: hide spinners (Chrome/Safari + Firefox) */
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type='number'] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Consistent search inputs (Safari adds decoration/cancel buttons) */
input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* Date inputs: Safari renders them with extra inner padding */
input[type='date'] {
    -webkit-appearance: none;
    appearance: none;
}

/* File upload buttons inherit font (Safari/Chrome differ by default) */
::file-selector-button {
    font: inherit;
}

/* Color swatch inputs: uniform across WebKit browsers */
input[type='color']::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type='color']::-webkit-color-swatch {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

/* Textareas: only vertical resizing, consistent overflow */
textarea {
    resize: vertical;
}

/* Anchor reset relies on Tailwind; ensure consistent tap behavior on mobile */
a {
    -webkit-tap-highlight-color: transparent;
}

/* Hide the default <summary> marker for clean accordions (all engines) */
details > summary {
    list-style: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

/* --------------------------------------------------------------------------
   2. THEMES
   -------------------------------------------------------------------------- */

/* Dark pages: scanner + voucher status */
body.theme-dark {
    background-color: #0a0a0a;
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   3. SHARED COMPONENTS
   -------------------------------------------------------------------------- */

/* Card-style radio options: highlight the sibling card when checked */
input[type='radio']:checked + div {
    border-color: #dc2626 !important;       /* red-600 */
    background-color: #fef2f2 !important;   /* red-50 */
}

input[type='radio']:checked + div .radio-dot {
    border-width: 6px !important;
    border-color: #dc2626 !important;
}

/* Preview toggle tabs */
.preview-tab-active {
    background-color: #111827;
    color: #ffffff;
}

.preview-tab-inactive {
    background-color: #f3f4f6;
    color: #6b7280;
}

.preview-tab-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Create campaign — empty design preview placeholder */
.create-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 2rem 1.5rem;
    text-align: center;
    background: transparent;
    border: none;
    border-radius: 0;
}

.create-preview-empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* Create campaign — empty preview (auto height, nothing cropped) */
.preview-placeholder-mode {
    width: 100%;
    overflow: visible;
}

.preview-placeholder-mode #svgPreviewContainer {
    width: 100%;
    height: auto;
    overflow: visible;
    background: transparent;
}

/* Create campaign — responsive preview when design is uploaded */
.preview-has-design {
    width: 100%;
    overflow: visible;
}

.preview-has-design #svgPreviewContainer,
.preview-has-design #svgBackPreviewContainer {
    width: 100%;
    height: auto;
    overflow: visible;
}

.preview-has-design .preview-design-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Admin sidebar active state */
.nav-link.active {
    background-color: #fef2f2;
    color: #dc2626;
    font-weight: 600;
    border-right: 3px solid #dc2626;
}

.nav-link.active svg {
    color: #dc2626;
}

/* Modal fade-in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.25s ease-out forwards;
}

/* --------------------------------------------------------------------------
   4. LANDING PAGE (layouts/public)
   -------------------------------------------------------------------------- */

.bg-grid {
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

.hero-glow {
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
}

/* QR scanner hero animation */
@keyframes scan {
    0%,
    100% {
        top: 15%;
    }
    50% {
        top: 85%;
    }
}

.animate-scan {
    animation: scan 2.5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   5. VOUCHER DESIGNER (create-campaign + campaign preview)
   -------------------------------------------------------------------------- */

#svgPreviewContainer svg,
#svgBackPreviewContainer svg {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    display: block !important;
}

/* Eliminate inline baseline padding gaps on preview images (browser-specific) */
#svgPreviewContainer img,
#svgBackPreviewContainer img,
#enlargedSvgContainer img,
#enlargedBackSvgContainer img {
    display: block !important;
    vertical-align: middle !important;
    line-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#svgPreviewContainer,
#svgBackPreviewContainer {
    width: 100% !important;
    max-width: 100% !important;
}

/* Text overlay boxes rendered inside the voucher SVG preview */
.svg-html-box {
    background: transparent;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    word-wrap: break-word;
    pointer-events: none;
}

.title-style {
    font-weight: 800;
    text-transform: uppercase;
    width: 100%;
}

.desc-style {
    font-weight: 400;
    margin-top: 2px;
    width: 100%;
}

.terms-style {
    font-weight: 400;
    white-space: pre-wrap;
    width: 100%;
}

/* --------------------------------------------------------------------------
   6. SCANNER PAGE
   -------------------------------------------------------------------------- */

.scanner-viewport {
    position: relative;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(220, 38, 38, 0.15),
        0 25px 50px -12px rgba(0, 0, 0, 0.65);
}

.scanner-viewport::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 5;
}

.scanner-frame {
    position: absolute;
    inset: 12%;
    z-index: 10;
    pointer-events: none;
}

.scanner-corner {
    position: absolute;
    width: 2rem;
    height: 2rem;
    border-color: #ef4444;
    border-style: solid;
    opacity: 0.95;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.55));
}

.scanner-corner-tl {
    top: 0;
    left: 0;
    border-width: 3px 0 0 3px;
    border-radius: 0.5rem 0 0 0;
}

.scanner-corner-tr {
    top: 0;
    right: 0;
    border-width: 3px 3px 0 0;
    border-radius: 0 0.5rem 0 0;
}

.scanner-corner-bl {
    bottom: 0;
    left: 0;
    border-width: 0 0 3px 3px;
    border-radius: 0 0 0 0.5rem;
}

.scanner-corner-br {
    bottom: 0;
    right: 0;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 0.5rem 0;
}

@keyframes scannerLine {
    0%,
    100% {
        top: 8%;
        opacity: 0.35;
    }
    50% {
        top: 88%;
        opacity: 1;
    }
}

.scanner-line {
    position: absolute;
    left: 4%;
    right: 4%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ef4444 20%, #fca5a5 50%, #ef4444 80%, transparent);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.85);
    animation: scannerLine 2.2s ease-in-out infinite;
}

@keyframes scannerPulseRing {
    0% {
        transform: scale(0.92);
        opacity: 0.55;
    }
    70% {
        transform: scale(1.04);
        opacity: 0;
    }
    100% {
        transform: scale(1.04);
        opacity: 0;
    }
}

.scanner-pulse-ring {
    position: absolute;
    inset: 10%;
    border: 2px solid rgba(239, 68, 68, 0.45);
    border-radius: 1rem;
    animation: scannerPulseRing 2.4s ease-out infinite;
    pointer-events: none;
    z-index: 6;
}

@keyframes scannerFlash {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 0.75;
    }
    100% {
        opacity: 0;
    }
}

.scanner-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(34, 197, 94, 0.35), rgba(34, 197, 94, 0));
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

.scanner-flash.is-active {
    animation: scannerFlash 0.45s ease-out;
}

@keyframes scannerModalIn {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.scanner-modal-panel {
    animation: scannerModalIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pinShake {
    0%,
    100% {
        transform: translateX(0);
    }
    20%,
    60% {
        transform: translateX(-8px);
    }
    40%,
    80% {
        transform: translateX(8px);
    }
}

.pin-shake {
    animation: pinShake 0.45s ease-in-out;
}

.scanner-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.55);
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.scanner-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.scanner-toast--success {
    background: linear-gradient(135deg, #052e16 0%, #14532d 100%);
    border-color: rgba(34, 197, 94, 0.35);
    color: #ecfdf5;
}

.scanner-toast--error {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fef2f2;
}

.scanner-toast--warning {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fffbeb;
}

.scanner-toast-icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
}

.scanner-pin-input,
body.theme-dark input[type='password'] {
    letter-spacing: 0.5em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#reader {
    border: none !important;
    border-radius: 1.5rem;
    overflow: hidden;
    background: #111827;
}

#reader__scan_region {
    background: #111827;
}

#reader__dashboard_section_csr span {
    color: #ffffff !important;
}

#reader button {
    background: #dc2626;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

/* Reward celebration overlay (shown once when a punch cycle completes) */
.reward-overlay {
    background:
        radial-gradient(circle at 50% 35%, rgba(251, 191, 36, 0.22) 0%, rgba(0, 0, 0, 0) 55%),
        rgba(0, 0, 0, 0.96);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

@keyframes rewardPop {
    0% {
        transform: scale(0.3) rotate(-12deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.25) rotate(6deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.reward-pop {
    font-size: 5rem;
    line-height: 1;
    animation: rewardPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes rewardGlow {
    0%,
    100% {
        text-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
    }
    50% {
        text-shadow: 0 0 36px rgba(251, 191, 36, 0.95);
    }
}

@keyframes rewardSparkle {
    0% {
        transform: translateY(0) scale(0.6);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translateY(-120px) scale(1.1);
        opacity: 0;
    }
}

.reward-sparkle {
    position: absolute;
    font-size: 1.5rem;
    animation: rewardSparkle 2.2s ease-out infinite;
    pointer-events: none;
}

.reward-glow {
    animation: rewardGlow 1.6s ease-in-out infinite;
}

/* Quick redeemed / applied splash */
.redeemed-overlay {
    background:
        radial-gradient(circle at 50% 40%, rgba(34, 197, 94, 0.18) 0%, rgba(0, 0, 0, 0) 55%),
        rgba(0, 0, 0, 0.94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.redeemed-overlay--in {
    opacity: 1;
}

.redeemed-overlay--out {
    opacity: 0;
}

@keyframes redeemedStamp {
    0% {
        transform: scale(1.6);
        opacity: 0;
        letter-spacing: 0.2em;
    }
    55% {
        transform: scale(0.95);
        opacity: 1;
        letter-spacing: -0.02em;
    }
    100% {
        transform: scale(1);
        opacity: 1;
        letter-spacing: 0;
    }
}

.redeemed-stamp {
    animation: redeemedStamp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
    text-shadow: 0 0 30px rgba(74, 222, 128, 0.45);
}

@keyframes redeemedCheckPop {
    0% {
        transform: scale(0.4);
        opacity: 0;
    }
    70% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.redeemed-check-ring {
    animation: redeemedCheckPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.redeemed-check-circle {
    stroke-dasharray: 63;
    stroke-dashoffset: 63;
    animation: redeemedCircleDraw 0.5s ease-out 0.05s forwards;
}

.redeemed-check-mark {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: redeemedMarkDraw 0.35s ease-out 0.45s forwards;
}

@keyframes redeemedCircleDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes redeemedMarkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes redeemedCtaIn {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.redeemed-cta {
    animation: redeemedCtaIn 0.4s ease-out 0.55s both;
}

/* Campaign fully validated splash */
.campaign-complete-overlay {
    background:
        radial-gradient(circle at 50% 38%, rgba(56, 189, 248, 0.2) 0%, rgba(0, 0, 0, 0) 55%),
        rgba(0, 0, 0, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.campaign-complete-overlay--in {
    opacity: 1;
}

.campaign-complete-overlay--out {
    opacity: 0;
}

@keyframes completeBadgePop {
    0% {
        transform: scale(0.3) rotate(-20deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.15) rotate(8deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.complete-badge {
    font-size: 5rem;
    line-height: 1;
    animation: completeBadgePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.complete-stamp {
    animation: redeemedStamp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
    text-shadow: 0 0 30px rgba(56, 189, 248, 0.5);
}

.complete-cta {
    animation: redeemedCtaIn 0.4s ease-out 0.55s both;
}

/* Voucher status — digital loyalty stamp grid */
.loyalty-stamp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 12rem;
    margin-left: auto;
    margin-right: auto;
}

.loyalty-stamp-slot {
    aspect-ratio: 1;
    border-radius: 0.65rem;
    border: 2px dashed rgba(75, 85, 99, 0.85);
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.loyalty-stamp-slot--filled {
    border-style: solid;
    border-color: #dc2626;
    background: linear-gradient(145deg, #7f1d1d 0%, #450a0a 100%);
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.35);
    animation: loyaltyStampPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.loyalty-stamp-slot--filled svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #fecaca;
}

@keyframes loyaltyStampPop {
    0% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.loyalty-reward-banner {
    background: linear-gradient(135deg, #78350f 0%, #b45309 50%, #78350f 100%);
    border: 1px solid rgba(251, 191, 36, 0.45);
    box-shadow: 0 0 24px rgba(251, 191, 36, 0.2);
    animation: rewardGlow 2s ease-in-out infinite;
}

/* Scanner review modal — 3 square cells per row */
.scanner-stamp-table {
    border-collapse: separate;
    border-spacing: 0.35rem;
    margin-left: auto;
    margin-right: auto;
}

.scanner-stamp-table td {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    vertical-align: middle;
}

.scanner-stamp-table td.scanner-stamp-pad {
    border: none;
    background: transparent;
}

.scanner-stamp-slot {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.4rem;
    border: 2px dashed rgba(75, 85, 99, 0.85);
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.scanner-stamp-slot--filled {
    border-style: solid;
    border-color: #dc2626;
    background: linear-gradient(145deg, #7f1d1d 0%, #450a0a 100%);
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.35);
}

.scanner-stamp-slot--filled svg {
    width: 0.85rem;
    height: 0.85rem;
    color: #fecaca;
}

.scanner-rewards-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-left: auto;
    margin-right: auto;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background: rgba(120, 53, 15, 0.45);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fde68a;
    font-size: 0.75rem;
    font-weight: 700;
}

.scanner-rewards-icon {
    font-size: 1rem;
    line-height: 1;
}

.scanner-rewards-count {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

/* Campaign voucher scan timeline */
.voucher-timeline-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 14rem;
    overflow-y: auto;
}

.voucher-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
}

.voucher-timeline-type {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.45rem;
    border-radius: 9999px;
    border: 1px solid transparent;
}

.voucher-timeline-type--punch {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.voucher-timeline-type--reward {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}

.voucher-timeline-type--redemption {
    color: #15803d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

/* --------------------------------------------------------------------------
   7. CAMPAIGN VOUCHERS TABLE — filter / sort toolbar
   -------------------------------------------------------------------------- */

.vouchers-toolbar-input,
.vouchers-toolbar-select,
.vouchers-toolbar-btn {
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.vouchers-toolbar-select {
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

/* --------------------------------------------------------------------------
   8. MOBILE RESPONSIVE — auth nav, design editor slide panels
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    .public-mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        top: var(--public-nav-height, 5rem);
        background: rgba(17, 24, 39, 0.35);
        z-index: 55;
    }

    .public-mobile-nav-backdrop.hidden {
        display: none;
    }

    .public-mobile-nav-panel {
        position: fixed;
        top: var(--public-nav-height, 5rem);
        left: 0;
        right: 0;
        z-index: 60;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
        max-height: calc(100dvh - var(--public-nav-height, 5rem));
        overflow-y: auto;
    }

    .public-mobile-nav-panel.hidden {
        display: none;
    }

    .public-mobile-nav-panel-inner {
        padding: 0.75rem 1rem 1.25rem;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .public-mobile-nav-link {
        display: block;
        width: 100%;
        padding: 0.875rem 1rem;
        border-radius: 0.75rem;
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.4;
        text-align: left;
        color: #374151;
        text-decoration: none;
        transition: background-color 0.15s ease;
    }

    .public-mobile-nav-link:hover,
    .public-mobile-nav-link:focus-visible {
        background: #f9fafb;
        color: #111827;
    }

    .public-mobile-nav-link-btn {
        background: transparent;
        border: none;
        cursor: pointer;
        font-family: inherit;
    }

    .public-mobile-nav-link-primary {
        background: #dc2626;
        border: none;
        cursor: pointer;
        font-family: inherit;
        color: #fff;
        text-align: center;
        margin-top: 0.25rem;
    }

    .public-mobile-nav-link-primary:hover,
    .public-mobile-nav-link-primary:focus-visible {
        background: #b91c1c;
        color: #fff;
    }

    body.public-mobile-menu-open {
        overflow: hidden;
    }
}

@media (max-width: 1023px) {
    .design-editor-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 205;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .design-editor-sidebar-overlay.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .design-editor-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(20rem, 88vw);
        max-width: 88vw;
        z-index: 210;
        transform: translateX(-105%);
        transition: transform 0.28s ease;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.18);
        pointer-events: none;
        visibility: hidden;
    }

    .design-editor-sidebar.is-open {
        transform: translateX(0);
        pointer-events: auto;
        visibility: visible;
    }

    .design-editor-tools-toggle {
        position: fixed;
        bottom: 5.5rem;
        left: 1rem;
        z-index: 215;
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.625rem 0.875rem;
        border-radius: 9999px;
        background: #111827;
        color: #fff;
        font-size: 0.75rem;
        font-weight: 700;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
        touch-action: manipulation;
    }

    #templateEditorModal .design-editor-tools-toggle {
        bottom: 4.75rem;
    }

    #editor-canvas-area,
    #editor-canvas-mount {
        width: 100%;
        max-width: 100%;
        touch-action: none;
    }

    #update-preview-pane,
    #update-preview-mount,
    #enlargedSvgContainer {
        touch-action: none;
    }

    .tpl-layer-label {
        top: auto;
        bottom: 100%;
        left: 0;
        right: auto;
        transform: none;
        margin-bottom: 0.125rem;
        padding: 0.25rem 0.5rem;
        min-height: 0;
        display: inline-flex;
        align-items: center;
        font-size: 0.625rem;
        line-height: 1.2;
        white-space: nowrap;
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
        max-width: 100%;
    }

    .tpl-resize-handle,
    .tpl-rotate-handle {
        width: 2.75rem;
        height: 2.75rem;
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .tpl-resize-handle {
        right: -0.35rem;
        bottom: -0.35rem;
    }

    .tpl-rotate-handle {
        top: -2.25rem;
    }

    .tpl-text-edit,
    .tpl-layer-handle,
    .tpl-layer-box,
    .qr-upload-stamp {
        -webkit-user-select: none;
        user-select: none;
    }

    .tpl-text-edit {
        touch-action: manipulation;
        -webkit-user-select: text;
        user-select: text;
        -webkit-touch-callout: default;
    }

    body.design-canvas-dragging {
        overflow: hidden;
        touch-action: none;
    }

    #previewModal .preview-modal-shell {
        position: fixed;
        inset: 0;
        max-width: none;
        width: 100%;
        height: 100%;
        max-height: none;
        margin: 0;
        border-radius: 0;
        padding: 1rem;
    }

    #reuploadModal > div {
        position: fixed;
        inset: 0;
        max-width: none;
        width: 100%;
        height: 100%;
        max-height: none;
        margin: 0;
        border-radius: 0;
        padding: 1rem;
    }

    #templateEditorModal header p {
        display: none;
    }

    #editor-canvas-mount,
    #editor-canvas-mount .tpl-editor-stage,
    .tpl-layer-handle,
    .tpl-resize-handle,
    .tpl-rotate-handle,
    .tpl-layer-label,
    .qr-upload-stamp,
    #update-preview-mount,
    #enlargedSvgContainer {
        touch-action: none;
    }

    #editor-canvas-mount .tpl-text-edit {
        touch-action: manipulation;
    }
}

@media (max-width: 767px) {
    .design-editor-sidebar {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        max-height: min(72vh, 520px);
        border-radius: 1rem 1rem 0 0;
        transform: translateY(105%);
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
    }

    .design-editor-sidebar.is-open {
        transform: translateY(0);
    }

    .design-editor-tools-toggle {
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
    }

    #templateEditorModal .design-editor-tools-toggle {
        bottom: 4.5rem;
        transform: translateX(-50%);
    }

    #previewModal .design-editor-tools-toggle {
        bottom: 5.25rem;
    }

    #reuploadModal .design-editor-tools-toggle {
        bottom: 5.25rem;
    }
}

@media (min-width: 1024px) {
    .design-editor-sidebar-overlay,
    .design-editor-tools-toggle {
        display: none !important;
    }

    .design-editor-sidebar {
        position: relative;
        transform: none !important;
        box-shadow: none;
        max-width: none;
        width: 20rem;
    }
}
