/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.header h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
}

.lang-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 80px;
}

.lang-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

/* Main Content */
.main-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    flex: 1;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    margin-bottom: 20px;
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

.input-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.sscc-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 18px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.sscc-input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 5px;
    display: none;
    animation: slideIn 0.3s ease;
}

.duplicate-warning {
    color: #f39c12;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(243, 156, 18, 0.1);
    border-radius: 5px;
    display: none;
    animation: slideIn 0.3s ease;
}

/* Copy Section */
.copy-section {
    margin-bottom: 30px;
}

.copy-section label {
    display: block;
    margin-bottom: 15px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.copy-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
}

.copy-btn {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 12px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 70px;
}

.copy-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
}

.copy-btn:active {
    transform: translateY(-1px);
}

.copy-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;
}

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

/* Preview Section */
.preview-section {
    margin-bottom: 30px;
}

.preview-label {
    margin-bottom: 15px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.sticker-preview {
    width: 300px;
    height: 180px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-placeholder {
    text-align: center;
    color: #7f8c8d;
    font-size: 16px;
}

.sticker-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    height: 100%;
}

.qr-code-container {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qr-code-container canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-code-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sticker-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-grow: 1;
    height: 100%;
}

.last-five {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.unique-symbol {
    font-size: 28px;
    color: #666;
    margin-top: 4px;
}

/* Printer Section */
.printer-section {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.printer-section label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    min-width: 60px;
}

.printer-select {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: #f8f9fa;
    min-width: 200px;
}

.printer-select:focus {
    outline: none;
    border-color: #3498db;
    background: white;
}

.change-printer-btn {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.change-printer-btn:hover {
    background: #8e44ad;
    transform: translateY(-2px);
}

/* Status Bar */
.status-bar {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-ready {
    color: #27ae60;
    font-weight: 600;
}

.status-printing {
    color: #f39c12;
    font-weight: 600;
}

.status-error {
    color: #e74c3c;
    font-weight: 600;
}

.status-connected {
    color: #27ae60;
    font-weight: 600;
}

.status-disconnected {
    color: #e74c3c;
    font-weight: 600;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.footer-content {
    font-size: 14px;
    color: #7f8c8d;
}

.footer-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.loading-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 0.6s ease-in-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .copy-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .copy-btn {
        padding: 18px;
        font-size: 20px;
        min-height: 60px;
    }
    
    .sticker-content {
        width: 260px;
        height: 147px;
        padding: 10px;
        gap: 10px;
    }
    
    .last-five {
        font-size: 20px;
    }
    
    .unique-symbol {
        font-size: 28px;
    }
    
    .printer-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .printer-select {
        min-width: auto;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .status-item {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .copy-buttons {
        grid-template-columns: 1fr;
    }
    
    .sticker-content {
        width: 220px;
        height: 124px;
        padding: 8px;
        gap: 8px;
    }
    
    .last-five {
        font-size: 18px;
    }
    
    .unique-symbol {
        font-size: 24px;
    }
}

/* High contrast mode for better visibility in warehouse environments */
@media (prefers-contrast: high) {
    .sscc-input {
        border-width: 3px;
    }
    
    .copy-btn {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .sticker-content {
        border: 2px solid #333;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .copy-btn {
        min-height: 80px;
        font-size: 26px;
    }
    
    .lang-btn,
    .change-printer-btn {
        padding: 15px 25px;
        font-size: 16px;
    }
    
    .sscc-input {
        padding: 18px 20px;
        font-size: 20px;
    }
}

/* Print-specific styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .print-container,
    .print-container * {
        visibility: visible;
    }
    
    .print-container {
        position: absolute;
        left: 0;
        top: 0;
    }
    
    .sticker {
        page-break-after: always;
    }
    
    .sticker:last-child {
        page-break-after: avoid;
    }
}

body, .sticker, .qr-code-container, .sticker-info, .last-five, .unique-symbol {
    color: #000 !important;
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.sticker-preview, .sticker {
    border: 1px solid #000;
}

.last-five, .unique-symbol {
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 0 0 1px #fff, 0 0 2px #000;
}

/* Accessibility: high contrast for error/warning */
.error-message, .duplicate-warning {
    color: #b00;
    background: #fff;
    font-weight: bold;
    border: 1px solid #b00;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 4px;
}

/* Accessibility: Focus Indicators for Keyboard Navigation */
button:focus, input:focus, select:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
    border-radius: 3px;
}

.copy-btn:focus, .lang-btn:focus, .clear-btn:focus {
    background: #ddd;
} 