/* ============================================
   create-qr.css
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    overflow-x: hidden;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    overflow-x: hidden;
}

.navbar {
    background: white;
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.navbar-brand {
    font-weight: 800;
    font-size: 20px;
    color: #1a202c;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar-brand span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.navbar-brand i {
    color: #667eea;
    font-size: 24px;
    -webkit-text-fill-color: initial;
}
.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}
.nav-links a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: color 0.3s;
}
.nav-links a:hover { color: #667eea; }
.nav-links .btn-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
}
.nav-links .btn-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    color: white;
}

.hero {
    padding: 20px 0 15px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
}
.hero h1 {
    font-size: 26px;
    font-weight: 900;
    color: #1a202c;
}
.hero h1 span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero p {
    font-size: 14px;
    color: #718096;
}

/* ============================================
   MAIN LAYOUT - Sidebar + Content
   ============================================ */
.main-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    max-width: 1300px;
    margin: 15px auto;
    padding: 0 15px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    padding: 20px;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar .section {
    margin-bottom: 20px;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 16px;
}
.sidebar .section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.sidebar .section-title {
    font-size: 12px;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar .section-title i {
    color: #667eea;
}

/* Grid-style option buttons */
.type-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 6px;
    width: 100%;
}
.type-opt {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 6px 2px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: white;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 9.5px;
    font-weight: 500;
    color: #4a5568;
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
}
.type-opt:hover {
    border-color: #667eea;
    background: #f7fafc;
}
.type-opt.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}
.type-opt .icon {
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}

/* Style dropdowns */
.style-dropdown {
    position: relative;
    width: 100%;
}
.style-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.25s;
    text-align: left;
}
.style-dropdown-btn:hover {
    border-color: #667eea;
    background: #f7f8ff;
}
.style-dropdown.open .style-dropdown-btn {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.style-dropdown-btn-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-size: 18px;
}
.style-dropdown-btn-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}
.style-dropdown-btn-label {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.style-dropdown-btn i.fa-chevron-down {
    flex-shrink: 0;
    font-size: 11px;
    color: #a0aec0;
    transition: transform 0.25s;
}
.style-dropdown.open .style-dropdown-btn i.fa-chevron-down {
    transform: rotate(180deg);
}
.style-dropdown-menu {
    display: none;
    position: fixed;
    z-index: 2000;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
}
.style-dropdown-menu.show {
    display: block;
}
.style-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.style-dropdown-item:hover {
    background: #f4f5f9;
}
.style-dropdown-item.active {
    background: #eef0fd;
    color: #667eea;
}
.style-dropdown-item-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    font-size: 16px;
}
.style-dropdown-item.active .style-dropdown-item-icon {
    color: #667eea;
}
.style-dropdown-item-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}
.style-dropdown-item-label {
    font-size: 12.5px;
    font-weight: 500;
    color: inherit;
}

/* Color Options */
.color-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 8px;
}
.color-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 10px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s;
}
.color-opt:hover {
    border-color: #667eea;
    background: #f7f8ff;
}
.color-opt .swatch-plate {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 4px #e2e8f0, inset 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s;
}
.color-opt:hover .swatch-plate {
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 4px #667eea, inset 0 1px 3px rgba(0,0,0,0.08);
}
.color-opt .label {
    font-size: 11px;
    color: #4a5568;
    font-weight: 600;
}
.color-opt .hex {
    font-size: 10px;
    color: #a0aec0;
    font-family: monospace;
    letter-spacing: 0.3px;
}

.color-picker-popover {
    display: none;
    position: fixed;
    z-index: 2000;
    width: 220px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.16);
    padding: 14px;
}
.color-picker-popover.show { display: block; }
.cp-sv-wrap {
    position: relative;
    width: 100%;
    height: 140px;
    border-radius: 10px;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none;
}
.cp-sv-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}
.cp-sv-cursor {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.cp-hue-wrap {
    position: relative;
    width: 100%;
    height: 14px;
    border-radius: 7px;
    margin-top: 12px;
    cursor: pointer;
    touch-action: none;
    background: linear-gradient(to right,
        #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%,
        #00f 67%, #f0f 83%, #f00 100%);
}
.cp-hue-cursor {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    background: #fff;
}
.cp-bottom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}
.cp-preview {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.cp-hex-field {
    flex: 1;
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 8px;
    transition: border-color 0.2s;
}
.cp-hex-field:focus-within {
    border-color: #667eea;
}
.cp-hex-field span {
    font-size: 12px;
    color: #a0aec0;
    font-weight: 700;
}
.cp-hex-field input {
    border: none;
    outline: none;
    font-size: 12.5px;
    font-family: monospace;
    font-weight: 600;
    color: #2d3748;
    width: 100%;
    padding: 7px 4px;
    text-transform: uppercase;
}

/* ============================================
   GRADIENT SECTION
   ============================================ */

/* Toggle row */
.gradient-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 8px 10px;
    background: #f7f8ff;
    border-radius: 10px;
    border: 1px solid #e8ebff;
}
.gradient-toggle-text {
    font-size: 12px;
    font-weight: 700;
    color: #4a5568;
    letter-spacing: 0.2px;
}

/* Toggle switch */
.gradient-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.gradient-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.gradient-switch-track {
    width: 38px;
    height: 21px;
    background: #e2e8f0;
    border-radius: 21px;
    transition: background 0.25s;
    position: relative;
    display: block;
}
.gradient-switch input:checked ~ .gradient-switch-track {
    background: linear-gradient(135deg, #667eea, #764ba2);
}
.gradient-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: transform 0.25s;
}
.gradient-switch input:checked ~ .gradient-switch-track .gradient-switch-thumb {
    transform: translateX(17px);
}

/* Controls panel */
.gradient-controls {
    margin-top: 10px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e8ebff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Live preview bar */
.gradient-preview-bar {
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(90deg, #000000, #764ba2);
    transition: background 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Color 1 → Color 2 row */
.gradient-colors-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.gradient-color-chip-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.gradient-chip-label {
    font-size: 10px;
    font-weight: 700;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gradient-color-chip {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    outline: none;
}
.gradient-color-chip:focus,
.gradient-color-chip:focus-visible {
    outline: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.gradient-color-chip span {
    display: block;
    width: 100%;
    height: 100%;
}
.gradient-color-chip.clickable {
    cursor: pointer;
}
.gradient-color-chip.clickable:hover {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
    transform: scale(1.06);
}
.gradient-chip-edit {
    position: absolute;
    bottom: 3px;
    right: 3px;
    font-size: 8px;
    color: white;
    background: rgba(0,0,0,0.35);
    border-radius: 3px;
    padding: 1px 3px;
    pointer-events: none;
}
.gradient-chip-edit.clickable {
    pointer-events: auto;
}
.gradient-chip-hex {
    font-size: 9px;
    font-family: monospace;
    font-weight: 700;
    color: #718096;
    letter-spacing: 0.3px;
}

/* Arrow connector */
.gradient-arrow-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.gradient-line {
    width: 1px;
    height: 0;
    display: none;
}
.gradient-arrow-icon {
    font-size: 14px;
    color: #cbd5e0;
}

/* Direction grid */
.gradient-dir-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gradient-dir-title {
    font-size: 11px;
    font-weight: 700;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gradient-dir-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.gradient-dir-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px 4px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}
.gradient-dir-opt svg {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.gradient-dir-opt span {
    font-size: 10px;
    font-weight: 700;
    color: #a0aec0;
    line-height: 1;
}
.gradient-dir-opt:hover {
    border-color: #667eea;
    background: #f7f8ff;
}
.gradient-dir-opt:hover svg {
    opacity: 0.9;
}
.gradient-dir-opt.active {
    border-color: #667eea;
    background: #f0f2ff;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}
.gradient-dir-opt.active svg {
    opacity: 1;
}
.gradient-dir-opt.active span {
    color: #667eea;
}

/* Placeholder icon (shown before a QR has been generated) */
.placeholder-icon {
    display: block;
    margin: 0 auto;
    font-size: 64px;
    color: #cbd5e0;
}
.placeholder p {
    margin-top: 10px !important;
}

/* Size */
.size-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.size-opt {
    padding: 4px 12px;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    background: white;
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s;
}
.size-opt:hover {
    border-color: #667eea;
    color: #667eea;
}
.size-opt.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Content Fields */
.field-group {
    margin-bottom: 10px;
}
.field-group:last-child {
    margin-bottom: 0;
}
.field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}
.field-input,
.field-textarea,
.field-select {
    width: 100%;
    padding: 7px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    color: #2d3748;
    transition: all 0.3s;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.field-textarea {
    resize: vertical;
    min-height: 50px;
}
.field-checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #4a5568;
    cursor: pointer;
}
.field-checkbox-row input {
    cursor: pointer;
}

/* Field errors */
.field-error {
    display: none;
    color: #e53e3e;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}
.field-error.show {
    display: block;
}
.field-input.has-error,
.field-textarea.has-error {
    border-color: #e53e3e;
}

/* Photo / PDF upload field */
.photo-pdf-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    padding: 20px 10px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    cursor: pointer;
    color: #4a5568;
    transition: all 0.3s;
}
.photo-pdf-dropzone:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.04);
}
.photo-pdf-dropzone i {
    font-size: 22px;
    color: #667eea;
}
.photo-pdf-dropzone p {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
}
.photo-pdf-dropzone small {
    font-size: 10px;
    color: #a0aec0;
}
.photo-pdf-dropzone.photo-pdf-uploading {
    cursor: default;
}

.photo-pdf-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    /* Same overflow:hidden fix as .logo-preview-thumb-wrap -- prevents a
       long, un-wrapped filename from widening the whole page on mobile. */
    overflow: hidden;
    max-width: 100%;
}
.photo-pdf-preview-thumb {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    background: #f7fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-pdf-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-pdf-preview-thumb i {
    font-size: 20px;
    color: #e53e3e;
}
.photo-pdf-preview-info {
    flex: 1;
    min-width: 0;
}
.photo-pdf-preview-name {
    font-size: 11px;
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.photo-pdf-preview-status {
    font-size: 10px;
    color: #38a169;
    margin-top: 2px;
}
.btn-photo-pdf-replace {
    flex-shrink: 0;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.btn-photo-pdf-replace:hover {
    background: #5a67d8;
}

/* ============================================
   CONTENT (QR Preview)
   ============================================ */
.content-area {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    position: sticky;
    top: 80px;
}
.qr-drag-handle {
    display: none;
}
.content-area .qr-preview-box {
    text-align: center;
    max-width: 500px;
}
.content-area .qr-preview-box img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    transition: width 0.3s ease;
}
.qr-size-label {
    margin-top: 10px;
    font-size: 12px;
    color: #a0aec0;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.content-area .qr-preview-box .placeholder {
    color: #a0aec0;
    font-size: 14px;
}
.content-area .qr-preview-box .placeholder i {
    font-size: 60px;
    display: block;
    margin-bottom: 12px;
    color: #cbd5e0;
}

/* Download section */
.download-section {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.download-section .btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    transition: all 0.3s;
    cursor: pointer;
}
.btn-png { background: #48bb78; color: white; }
.btn-png:hover { background: #38a169; }
.btn-svg { background: #4299e1; color: white; }
.btn-svg:hover { background: #3182ce; }
.btn-pdf { background: #fc8181; color: white; }
.btn-pdf:hover { background: #f56565; }

/* Result modal */
.qr-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 32, 44, 0.55);
    z-index: 4000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.qr-modal-overlay.show {
    display: flex;
    opacity: 1;
}
.qr-modal-box {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 34px 30px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.28);
}
.qr-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f3f8;
    color: #4a5568;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.qr-modal-close:hover {
    background: #e2e8f0;
    color: #1a202c;
    transform: rotate(90deg);
}
.qr-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 16px;
}
.qr-modal-box img {
    max-width: 100%;
    width: 260px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

/* Animation */
@keyframes qrZoomIn {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.qr-zoom-in {
    animation: qrZoomIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (max-width: 480px) {
    .qr-modal-box { padding: 28px 18px 22px; }
    .qr-modal-box img { width: 200px; }
}

/* Generate Button */
.generate-btn-wrapper {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #edf2f7;
}
.btn-generate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    color: white;
    width: 100%;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}
.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
}
.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 992px) {
    .main-wrapper {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        order: 2;
        max-height: none;
        overflow: visible;
        /* .sidebar is a CSS Grid item of .main-wrapper. A grid item's
           default min-width is "auto", meaning the browser won't shrink
           it below its content's natural min-content size -- and that
           calculation ignores overflow:hidden set on descendants further
           down the tree (like .logo-size-row). It only respects
           overflow:hidden on the grid item itself. Since .sidebar has to
           stay overflow:visible here (for the draggable QR preview),
           min-width:0 is what actually stops it from stretching to fit
           the logo size slider's native width once that row appears. */
        min-width: 0;
    }
    .content-area {
        order: 1;
        min-height: auto;
        max-height: none;
        overflow: visible;
        position: fixed;
        top: 78px;
        right: 14px;
        width: 190px;
        padding: 12px 12px 10px;
        border-radius: 16px;
        box-shadow: 0 10px 32px rgba(0,0,0,0.2);
        z-index: 1200;
        cursor: grab;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
    }
    .content-area.dragging {
        cursor: grabbing;
        box-shadow: 0 16px 44px rgba(0,0,0,0.3);
        transition: none;
    }
    .content-area .qr-drag-handle {
        display: block;
        width: 30px;
        height: 4px;
        border-radius: 4px;
        background: #cbd5e0;
        margin: 0 auto 8px;
    }
    .content-area .qr-preview-box img {
        max-width: 100%;
    }
    .content-area .qr-preview-box .placeholder {
        font-size: 11px;
    }
    .content-area .qr-preview-box .placeholder i {
        font-size: 32px;
        margin-bottom: 6px;
    }
    .content-area .qr-preview-box .placeholder small {
        display: none;
    }
    .content-area .qr-size-label {
        font-size: 9px;
        margin-top: 6px;
    }
}
@media (max-width: 768px) {
    .type-options { grid-template-columns: repeat(5, 1fr); }
    .hero h1 { font-size: 22px; }
    .sidebar { padding: 15px; }
    .nav-links a:not(.btn-nav) { display: none; }
}
@media (max-width: 480px) {
    .type-options { grid-template-columns: repeat(3, 1fr); }
    .style-dropdown-menu { max-height: 220px; }
    .color-options { grid-template-columns: 1fr; }
    .hero h1 { font-size: 18px; }
    .color-picker-popover { width: 200px; }
}

/* ============================================
   CUSTOM LOGO SECTION
   ============================================ */
.logo-size-row {
    display: flex;
    align-items: center;
    gap: 10px;
    /* On mobile, .sidebar switches to overflow:visible (needed so the
       draggable floating preview isn't clipped). Without a clipping
       boundary somewhere below that, a range input's non-negotiable
       browser-default intrinsic width can propagate all the way up
       through the CSS grid track sizing and widen the entire page.
       min-width:0 on the slider (below) fixes the flex layer, but this
       overflow:hidden is what actually stops that upward propagation. */
    overflow: hidden;
    max-width: 100%;
}
.logo-size-slider {
    flex: 1;
    min-width: 0; /* without this, flexbox won't let the range input shrink
                     below its browser-default intrinsic width, which is
                     wider than most phone screens -- that's what was
                     pushing the whole page wide on mobile after a logo
                     was attached and this row became visible. */
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
}
.logo-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102,126,234,0.4);
    border: 2px solid white;
}
.logo-size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102,126,234,0.4);
    border: 2px solid white;
}
.logo-size-value {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
    min-width: 32px;
    text-align: right;
}

/* Logo dropzone/preview reuse the photo-pdf-dropzone visuals but slightly smaller */
.logo-preview-thumb-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    /* Same fix as .logo-size-row: on mobile the sidebar is overflow:visible,
       so an un-wrapped long filename (white-space:nowrap on
       .logo-preview-name below) can push this whole row -- and with it
       the entire page -- wider than the screen. overflow:hidden here
       clips it and forces the ellipsis truncation to actually apply. */
    overflow: hidden;
    max-width: 100%;
}
.logo-preview-thumb {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #f7fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
}
.logo-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.logo-preview-info {
    flex: 1;
    min-width: 0;
}
.logo-preview-name {
    font-size: 11px;
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logo-preview-status {
    font-size: 10px;
    color: #38a169;
    margin-top: 2px;
}
.btn-logo-remove {
    flex-shrink: 0;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: #e53e3e;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.btn-logo-remove:hover {
    background: #c53030;
}

/* "Previously uploaded" logo dropdown -- one consistent dropdown across
   every device: a button that toggles a menu listing the user's last 10
   uploaded logos, each pickable or deletable. Styled to match
   .style-dropdown / .crypto-coin-dropdown above. */
.logo-history-dropdown {
    position: relative;
    width: 100%;
    margin-top: 10px;
}
.logo-history-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.25s;
    text-align: left;
}
.logo-history-btn:hover {
    border-color: #667eea;
    background: #f7f8ff;
}
.logo-history-dropdown.open .logo-history-btn {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.logo-history-btn i.fa-clock-rotate-left {
    flex-shrink: 0;
    color: #667eea;
    font-size: 14px;
}
.logo-history-btn span {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.logo-history-btn i.fa-chevron-down {
    flex-shrink: 0;
    font-size: 11px;
    color: #a0aec0;
    transition: transform 0.25s;
}
.logo-history-dropdown.open .logo-history-btn i.fa-chevron-down {
    transform: rotate(180deg);
}

.logo-history-menu {
    display: none;
    position: fixed;
    z-index: 2000;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
}
.logo-history-menu.show {
    display: block;
}
.logo-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}
.logo-history-item:hover {
    background: #f4f5f9;
}
.logo-history-item.selected {
    background: #eef0fd;
}
.logo-history-thumb {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.logo-history-name {
    flex: 1;
    font-size: 12.5px;
    font-weight: 500;
    color: #2d3748;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.logo-history-check {
    flex-shrink: 0;
    color: #667eea;
    font-size: 12px;
}
.logo-history-delete {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #a0aec0;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.logo-history-delete:hover {
    background: #fed7d7;
    color: #e53e3e;
}
@media (max-width: 480px) {
    .logo-history-menu { max-height: 220px; }
}

/* ============================================
   CRYPTO COIN / NETWORK DROPDOWN
   ============================================ */
.crypto-coin-dropdown { position: relative; width: 100%; }
.crypto-coin-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: 10px; border: 2px solid #e2e8f0;
    background: white; cursor: pointer; transition: all 0.25s; text-align: left;
}
.crypto-coin-btn:hover { border-color: #667eea; background: #f7f8ff; }
.crypto-coin-dropdown.open .crypto-coin-btn {
    border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.crypto-coin-btn-icon { flex-shrink: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.crypto-coin-btn-icon img { width: 24px; height: 24px; display: block; border-radius: 50%; }
.crypto-coin-btn-label { flex: 1; font-size: 13px; font-weight: 600; color: #2d3748; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crypto-coin-btn i.fa-chevron-down { flex-shrink: 0; font-size: 11px; color: #a0aec0; transition: transform 0.25s; }
.crypto-coin-dropdown.open .crypto-coin-btn i.fa-chevron-down { transform: rotate(180deg); }

.crypto-coin-menu {
    display: none; flex-direction: column; position: fixed; z-index: 2000;
    background: white; border: 1px solid #e2e8f0; border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14); max-height: 320px; overflow: hidden; padding: 8px;
}
.crypto-coin-menu.show { display: flex; }
.crypto-coin-search-wrap {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px;
    border: 2px solid #e2e8f0; border-radius: 8px; margin-bottom: 6px; flex-shrink: 0;
}
.crypto-coin-search-wrap:focus-within { border-color: #667eea; }
.crypto-coin-search-wrap i { color: #a0aec0; font-size: 12px; }
.crypto-coin-search-wrap input { border: none; outline: none; width: 100%; font-size: 12.5px; color: #2d3748; font-family: inherit; }
.crypto-coin-list { overflow-y: auto; max-height: 250px; }
.crypto-coin-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.crypto-coin-item:hover, .crypto-coin-item.kb-active { background: #f4f5f9; }
.crypto-coin-item.active { background: #eef0fd; }
.crypto-coin-item.active .crypto-coin-symbol { color: #667eea; }
.crypto-coin-icon { flex-shrink: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.crypto-coin-icon img { width: 24px; height: 24px; display: block; border-radius: 50%; }
.crypto-coin-text { font-size: 12.5px; color: #2d3748; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crypto-coin-symbol { font-weight: 700; }
.crypto-coin-network { color: #a0aec0; font-weight: 500; }
.crypto-coin-empty { padding: 14px 8px; text-align: center; font-size: 12px; color: #a0aec0; }

@media (max-width: 480px) {
    .crypto-coin-menu { max-height: 280px; }
    .crypto-coin-list { max-height: 200px; }
}