:root {
    --primary-color: #3a86ff;
    --secondary-color: #8338ec;
    --accent-color: #ff006e;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #38b000;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    box-shadow: var(--box-shadow);
}

.app-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.app-description {
    font-size: 1rem;
    opacity: 0.9;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

@media (min-width: 768px) {
    .container {
        flex-direction: row;
    }
}

.input-section, .output-section {
    flex: 1;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    transition: var(--transition);
}

.input-section:hover, .output-section:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    transition: var(--transition);
    min-height: 3rem;
    overflow: auto;
    resize: vertical;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover {
    background-color: #2b76e5;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.secondary-button {
    background-color: #e9ecef;
    color: var(--dark-color);
}

.secondary-button:hover {
    background-color: #dde2e6;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
}

.primary-button:hover {
    background-color: #2b76e5;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
}

.primary-button:hover {
    background-color: #2b76e5;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    min-height: 200px;
}

#qrcode {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.color-picker-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.color-preview {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

footer {
    text-align: center;
    padding: 1.5rem;
    background-color: var(--dark-color);
    color: white;
    margin-top: 2rem;
}

.success-message {
    padding: 0.75rem;
    background-color: rgba(56, 176, 0, 0.1);
    color: var(--success-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: center;
    opacity: 0;
    transition: var(--transition);
}

.success-message.show {
    opacity: 1;
}

@media print {
    body * {
        visibility: hidden;
    }
    .qr-container, .qr-container * {
        visibility: visible;
    }
    .qr-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        background: white;
    }
    #qrcode {
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    #qrcode img {
        width: 32mm !important;
        height: 32mm !important;
        display: block;
    }
    .no-print {
        display: none !important;
    }
}

/* DYMO Label specific styles */
.dymo-preview {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.dymo-preview.show {
    display: flex;
}

.dymo-preview-content {
    background-color: white;
    width: 57mm;
    height: 32mm;
    padding: 1mm;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 2px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
}

.dymo-preview-controls {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 400px;
}

.dymo-export-section,
.dymo-print-section {
    text-align: center;
}

.dymo-export-section h4,
.dymo-print-section h4 {
    color: white;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.export-buttons,
.print-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.export-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    min-width: 70px;
}

.export-button:hover {
    background-color: #e6005a;
    transform: translateY(-1px);
}

.export-button:active {
    transform: translateY(0);
}

.dymo-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background-color: transparent;
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.dymo-preview-content img {
    max-width: 90%;
    max-height: 90%;
}

/* For label makers */
@media (max-width: 380px) {
    .qr-container {
        transform: scale(0.8);
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--success-color);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Scanner test area styles */
.scanner-test-area {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background-color: #f8f9fa;
}

.scanner-status {
    text-align: center;
    margin-bottom: 1rem;
}

.scanner-status h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.scan-indicator {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background-color: #f0f0f0;
    color: #666;
    font-weight: 600;
    margin: 0.5rem 0;
}

.scan-indicator.active {
    background-color: #fff7cd;
    color: #b97800;
}

.scan-indicator.success {
    background-color: rgba(56, 176, 0, 0.1);
    color: var(--success-color);
}

.scan-indicator.error {
    background-color: #ffdddd;
    color: #d32f2f;
}

.scan-result-container {
    margin-top: 1rem;
}

.scan-result-container input[type="text"] {
    min-height: 3rem;
    overflow: auto;
    resize: vertical;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.scan-match-result {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
}

#scan-match-result.match {
    background-color: rgba(56, 176, 0, 0.1);
    color: var(--success-color);
}

#scan-match-result.no-match {
    background-color: #ffdddd;
    color: #d32f2f;
}

/* Scanavenger scanner animation */
.scan-animation {
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    background-size: 200% 100%;
    animation: scanAnimation 1.5s infinite;
    margin: 1rem 0;
    border-radius: 2px;
}

@keyframes scanAnimation {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Mobile QR scanner styles */
.mobile-scanner-area {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background-color: #f8f9fa;
}

.qr-reader {
    width: 100%;
    max-width: 500px;
    height: 300px;
    margin: 1rem auto;
    background-color: #000;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Customize HTML5QRCode styles */
#reader video {
    border-radius: var(--border-radius);
}

#reader img {
    border-radius: var(--border-radius);
}

#reader {
    border: none !important;
}

#reader div:first-child {
    box-shadow: none !important;
}

/* Permission prompt */
.permission-section {
    text-align: center;
    padding: 1rem;
    background-color: #e9ecef;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.permission-button {
    background-color: var(--accent-color);
    margin-top: 0.5rem;
}

.camera-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    z-index: 10;
}

.camera-guidance {
    text-align: center;
    padding: 1rem;
    max-width: 80%;
}

/* Mobile camera scanning line animation */
.scanning-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
    top: 50%;
    transform: translateY(-50%);
    animation: scanningAnimation 2s infinite ease-in-out;
    z-index: 6;
    box-shadow: 0 0 8px 1px rgba(255, 0, 110, 0.5);
}

@keyframes scanningAnimation {
    0% { top: 20%; }
    50% { top: 80%; }
    100% { top: 20%; }
}

/* Scanner corners to guide users */
.scanner-corners {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--primary-color);
    border-style: solid;
    border-width: 0;
}

.corner-top-left {
    top: 0;
    left: 0;
    border-top-width: 3px;
    border-left-width: 3px;
}

.corner-top-right {
    top: 0;
    right: 0;
    border-top-width: 3px;
    border-right-width: 3px;
}

.corner-bottom-left {
    bottom: 0;
    left: 0;
    border-bottom-width: 3px;
    border-left-width: 3px;
}

.corner-bottom-right {
    bottom: 0;
    right: 0;
    border-bottom-width: 3px;
    border-right-width: 3px;
}