/* Import Pixelify Sans font */
@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400;500;600;700&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pixelify Sans', monospace;
    background: #2C2C2C;
    color: #E4E4E4;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(145deg, #3A3A3A, #2C2C2C);
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    overflow: hidden;
    border: 2px solid #4A4A4A;
    position: relative; 
}

.header {
    background: linear-gradient(135deg, #A8DADC 0%, #B39CD0 50%, #FFC1CC 100%);
    color: #2C2C2C;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(44,44,44,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.header p {
    opacity: 0.8;
    font-size: 1.1rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    background: #2C2C2C;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #A8DADC;
    font-size: 1.1rem;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.3);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #4A4A4A;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Pixelify Sans', monospace;
    background: #3A3A3A;
    color: #E4E4E4;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: #A8DADC;
    box-shadow: 
        0 0 0 3px rgba(168, 218, 220, 0.2),
        inset 0 2px 4px rgba(0,0,0,0.2);
    background: #404040;
}

.form-group input:hover, 
.form-group select:hover, 
.form-group textarea:hover {
    border-color: #B39CD0;
    transform: translateY(-1px);
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.2),
        inset 0 2px 4px rgba(0,0,0,0.2);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    flex: 1;
    height: 8px;
    background: #4A4A4A;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.slider:hover {
    background: #5A5A5A;
    transform: scaleY(1.2);
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #A8DADC, #B39CD0);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(168, 218, 220, 0.4);
    border: 2px solid #2C2C2C;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(168, 218, 220, 0.6);
    background: linear-gradient(135deg, #B39CD0, #FFC1CC);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #A8DADC, #B39CD0);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #2C2C2C;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(168, 218, 220, 0.4);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(168, 218, 220, 0.6);
    background: linear-gradient(135deg, #B39CD0, #FFC1CC);
}

.speed-value {
    font-weight: 600;
    color: #A8DADC;
    min-width: 100px;
    text-align: center;
    font-size: 1.1rem;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.3);
}

.buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Pixelify Sans', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    text-decoration: none; /* support anchor buttons */
    display: inline-block; /* ensure anchors render like buttons */
    text-align: center;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #B39CD0 0%, #A8DADC 100%);
    color: #2C2C2C;
    border: 2px solid #9B7BC7;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(179, 156, 208, 0.4);
    background: linear-gradient(135deg, #A8DADC 0%, #FFC1CC 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #4A4A4A 0%, #3A3A3A 100%);
    color: #E4E4E4;
    border: 2px solid #5A5A5A;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5A5A5A 0%, #4A4A4A 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    border-color: #A8DADC;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #6A6A6A 0%, #5A5A5A 100%);
    position: relative;
    overflow: hidden;
}

.btn-primary:disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

.canvas-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-container {
    background: linear-gradient(145deg, #3A3A3A, #2C2C2C);
    border: 2px solid #4A4A4A;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 1rem;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.3),
        0 4px 8px rgba(0,0,0,0.2);
}

.canvas-container:hover {
    border-color: #A8DADC;
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.3),
        0 8px 16px rgba(168, 218, 220, 0.2);
    transform: translateY(-2px);
}

#qrCanvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

#qrCanvas:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.progress-container {
    width: 100%;
    background: #3A3A3A;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.2);
    border: 1px solid #4A4A4A;
}

.progress-bar {
    height: 8px;
    background: linear-gradient(90deg, #A8DADC, #B39CD0, #FFC1CC);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.status {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(145deg, #3A3A3A, #2C2C2C);
    border-radius: 10px;
    font-weight: 500;
    color: #E4E4E4;
    border: 1px solid #4A4A4A;
    transition: all 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.working-link {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.working-link .btn {
    min-width: 220px;
}

.status:not(:empty) {
    background: linear-gradient(145deg, #4A4A4A, #3A3A3A);
    border-color: #A8DADC;
    color: #A8DADC;
}

.char-counter {
    font-size: 14px;
    color: #A8DADC;
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.char-counter span {
    font-weight: 600;
}

.warning {
    color: #FFC1CC;
    font-weight: 500;
}

.error {
    color: #FF6B6B;
    font-weight: 500;
}

/* Color input styling */
input[type="color"] {
    width: 60px !important;
    height: 40px;
    padding: 4px;
    border: 2px solid #4A4A4A;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #3A3A3A;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

input[type="color"]:hover {
    border-color: #A8DADC;
    transform: scale(1.05);
    box-shadow: 
        0 0 0 3px rgba(168, 218, 220, 0.2),
        inset 0 2px 4px rgba(0,0,0,0.2);
}

input[type="color"]:focus {
    outline: none;
    border-color: #A8DADC;
    box-shadow: 
        0 0 0 3px rgba(168, 218, 220, 0.3),
        inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: #A8DADC;
    cursor: pointer;
}


.form-group label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #A8DADC;
    cursor: pointer;
}

/* Color input labels */
.form-group:has(input[type="color"]) label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-group:has(input[type="color"]) {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-group:has(input[type="color"]) label {
    margin-bottom: 0;
    flex: 1;
}


@media (max-width: 768px) {
    .content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .buttons {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .header {
        padding: 1.5rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .canvas-container {
        min-height: 300px;
        padding: 15px;
    }
    
    .form-group:has(input[type="color"]) {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .form-group:has(input[type="color"]) label {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}


.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(168, 218, 220, 0.05) 50%, transparent 100%),
        linear-gradient(0deg, transparent 0%, rgba(255, 193, 204, 0.05) 50%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}


.header h1 {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* ===== Additions for explainer page (how-qr-works) ===== */

/* Section headings used in explainer */
h2 {
    color: #A8DADC;
    margin: 0 0 0.75rem 0;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.3);
}

/* Improve readability of paragraphs and lists without overriding explicit inline colors */
section p {
    margin-bottom: 0.5rem;
}

ul {
    margin-left: 1.25rem;
    padding-left: 0.75rem;
    line-height: 1.7;
}

li + li { margin-top: 0.25rem; }

/* Inline code styling for examples */
code {
    background: #3A3A3A;
    color: #E4E4E4;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #4A4A4A;
}

/* Links within content */
a {
    color: #A8DADC;
}
a:hover {
    color: #B39CD0;
}

/* Intro section media */
.intro img {
    margin-top: 0.75rem;
    border: 2px solid #4A4A4A;
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.3);
}

/* Make SVG text match app typography */
svg text {
    font-family: 'Pixelify Sans', monospace;
}

/* Reduce extra spacing for small diagram containers if set smaller inline */
.canvas-container svg {
    max-width: 100%;
    height: auto;
}

/* Single-button row support in explainer footer */
.buttons a.btn {
    width: 100%;
}