/* ============================================
   QR ON PHOTOS EDITOR
   Premium feature for embedding QR on images
   ============================================ */

.qurrl-qr-photo-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    overflow: visible; /* Required for sticky to work */
}

.qr-photo-editor {
    overflow: visible; /* Required for sticky to work */
}

/* Premium Gate */
.qurrl-premium-gate {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    max-width: 600px;
    margin: 40px auto;
    border: 1px solid #e2e8f0;
}

.premium-gate-content .premium-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.premium-gate-content h2 {
    font-size: 28px;
    color: #1e293b;
    margin: 0 0 16px;
}

.premium-gate-content > p {
    color: #64748b;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.premium-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
    text-align: left;
    background: white;
    padding: 20px 24px;
    border-radius: 12px;
}

.feature-item {
    color: #334155;
    font-size: 15px;
}

.btn-upgrade {
    display: inline-block;
    background: linear-gradient(135deg, #0078A1, #00A0B2);
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,120,161,0.3);
}

.login-note {
    margin-top: 16px;
    color: #64748b;
    font-size: 14px;
}

.login-note a {
    color: #0078A1;
}

/* Editor Layout */
.qr-photo-editor .editor-header {
    text-align: center;
    margin-bottom: 32px;
}

.qr-photo-editor .editor-header h2 {
    font-size: 28px;
    color: #1e293b;
    margin: 0 0 8px;
}

.qr-photo-editor .editor-header p {
    color: #64748b;
    font-size: 16px;
    margin: 0;
}

.editor-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: start;
    padding: 0 20px;
    overflow: visible;
    position: relative; /* For absolute positioning fallback */
}

@media (max-width: 1000px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
}

/* Controls Panel */
.editor-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.control-section h3 {
    font-size: 16px;
    color: #1e293b;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #0078A1;
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #0078A1;
}

.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: #0078A1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #006080;
}

/* Photo Upload Zone */
.photo-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.photo-upload-zone:hover,
.photo-upload-zone.dragover {
    border-color: #0078A1;
    background: rgba(0,120,161,0.05);
}

.upload-placeholder .upload-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.upload-placeholder p {
    margin: 0 0 8px;
    color: #64748b;
}

.upload-placeholder .upload-link {
    color: #0078A1;
    font-weight: 500;
}

.upload-placeholder small {
    color: #94a3b8;
    font-size: 12px;
}

.upload-placeholder[hidden] {
    display: none !important;
}

.upload-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.upload-preview[hidden] {
    display: none !important;
}

.upload-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.photo-info {
    flex: 1;
    min-width: 0;
}

.photo-info span {
    display: block;
}

#photo-name {
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#photo-size {
    font-size: 13px;
    color: #64748b;
}

.btn-remove-photo {
    width: 32px;
    height: 32px;
    border: none;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.btn-remove-photo:hover {
    background: #fecaca;
}

/* Range Slider */
.range-with-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-with-value input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #e2e8f0;
    border-radius: 3px;
}

.range-with-value input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #0078A1;
    border-radius: 50%;
    cursor: pointer;
}

.range-with-value span {
    min-width: 50px;
    text-align: right;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

/* Color Input */
.color-input-group {
    display: flex;
    gap: 8px;
}

.color-input-group input[type="color"] {
    width: 44px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
}

.color-input-group input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    text-transform: uppercase;
}

/* Checkbox */
.checkbox-group {
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0078A1;
}

/* Dot Style Grid */
.dot-style-grid {
    display: flex;
    gap: 8px;
}

.dot-style-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dot-style-btn:hover {
    border-color: #0078A1;
    background: white;
}

.dot-style-btn--active {
    border-color: #0078A1;
    background: rgba(0, 120, 161, 0.1);
    color: #0078A1;
}

/* Style Grid (unified for all style buttons) */
.style-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.style-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.style-btn:hover {
    border-color: #0078A1;
    background: white;
}

.style-btn--active,
.corner-btn--active,
.corner-dot-btn--active {
    border-color: #0078A1;
    background: rgba(0, 120, 161, 0.1);
    color: #0078A1;
}

/* Logo Upload Zone */
.logo-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.logo-upload-zone:hover,
.logo-upload-zone.dragover {
    border-color: #0078A1;
    background: #f0f9ff;
}

.logo-placeholder .upload-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

.logo-placeholder p {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 4px;
}

.logo-placeholder small {
    font-size: 12px;
    color: #94a3b8;
}

.logo-preview {
    position: relative;
    display: inline-block;
}

.logo-preview img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.btn-remove-logo {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-logo:hover {
    background: #dc2626;
}

/* Gradient Options */
.gradient-options {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* Form Select */
.form-select {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #0078A1;
}

/* Form Input */
.form-input {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.form-input:focus {
    outline: none;
    border-color: #0078A1;
}

/* Premium Badge Small */
.premium-badge-small {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Position Grid */
.hint-text {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 12px;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.pos-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.pos-btn:hover {
    background: #f1f5f9;
    border-color: #0078A1;
    color: #0078A1;
}

.position-coords {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coord-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coord-group label {
    min-width: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.coord-group input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

/* Download Section */
.download-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
}

.btn-download {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34,197,94,0.3);
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.download-hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: #166534;
    text-align: center;
}

/* Preview Panel - Follows scroll via JavaScript */
.editor-preview {
    position: relative;
    align-self: start;
    z-index: 100;
    transition: none; /* Disable transition for scroll follow */
}

.canvas-container {
    position: relative;
    background: repeating-conic-gradient(#f1f5f9 0% 25%, white 0% 50%) 50% / 20px 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    min-height: 400px;
    overflow: hidden;
}

/* Wrapper for canvas + overlay to center them together */
.canvas-wrapper {
    position: relative;
    display: inline-block;
}

.canvas-placeholder {
    text-align: center;
    padding: 60px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.canvas-placeholder .placeholder-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.canvas-placeholder p {
    color: #94a3b8;
    font-size: 16px;
    margin: 0;
}

#composite-canvas {
    max-width: 100%;
    max-height: 600px;
    display: block;
}

/* QR Overlay (draggable) - positioned relative to canvas */
.qr-overlay {
    position: absolute;
    border: 2px solid #0078A1;
    background: rgba(0,120,161,0.1);
    cursor: move;
    box-sizing: border-box;
    z-index: 10;
}

.qr-overlay::after {
    content: '✥';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #0078A1;
    opacity: 0.7;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #0078A1;
    border-radius: 3px;
}

.resize-handle.nw {
    top: -7px;
    left: -7px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -7px;
    right: -7px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -7px;
    left: -7px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -7px;
    right: -7px;
    cursor: se-resize;
}

/* Canvas Info */
.canvas-info {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
    font-size: 13px;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-top: none;
    margin-top: -1px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .qurrl-qr-photo-wrap {
        padding: 12px;
    }
    
    .qurrl-premium-gate {
        padding: 40px 20px;
    }
    
    .premium-gate-content .premium-icon {
        font-size: 48px;
    }
    
    .premium-gate-content h2 {
        font-size: 22px;
    }
    
    .control-section {
        padding: 16px;
    }
    
    .editor-preview {
        position: relative;
        top: 0;
    }
    
    .canvas-container {
        min-height: 300px;
    }
}
