:root {
    --primary: #8b7ab8;
    --primary-dark: #7a69a7;
    --accent: #e5a77e;
    --accent-dark: #d4956d;
    --bg-primary: #1a1625;
    --bg-secondary: #2a2435;
    --bg-card: #3a3445;
    --text-primary: #e8e4f0;
    --text-secondary: #c5bfd4;
    --text-muted: #9990a8;
    --border: #544d63;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --gradient: linear-gradient(135deg, #8b7ab8 0%, #e5a77e 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(139, 122, 184, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(229, 167, 126, 0.08) 0%, transparent 50%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.title {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.card-header {
    margin-bottom: 25px;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.decoration-line {
    height: 3px;
    width: 60px;
    background: var(--gradient);
    border-radius: 2px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.label-icon {
    font-size: 1.1rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 122, 184, 0.15);
    transform: translateY(-1px);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Size Controls */
.size-controls-section {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.size-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.slider-group {
    width: 100%;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.slider-value {
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    color: var(--accent);
    min-width: 50px;
    text-align: center;
    border: 1px solid var(--border);
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-card);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(139, 122, 184, 0.4);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(139, 122, 184, 0.6);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(139, 122, 184, 0.4);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(139, 122, 184, 0.6);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.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;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px var(--primary);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.btn-danger {
    background: #d97575;
    color: white;
    padding: 8px 12px;
    font-size: 12px;
}

.btn-danger:hover {
    background: #c96565;
    transform: scale(1.05);
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.barcode-container {
    margin: 30px 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.barcode-preview {
    padding: 20px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#barcode {
    max-width: 100%;
    height: auto;
    display: block;
}

.barcode-value {
    margin-top: 15px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.search-container {
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 45px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 122, 184, 0.15);
}

.history-list {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg-secondary);
}

.history-item:hover {
    transform: translateX(4px);
    border-left: 3px solid var(--primary);
}

.history-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.history-barcode {
    width: 120px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    flex-shrink: 0;
}

.history-barcode svg {
    max-width: 100%;
    max-height: 100%;
}

.history-details {
    flex: 1;
    min-width: 0;
}

.history-value {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-family: 'Monaco', 'Consolas', monospace;
    word-break: break-all;
}

.history-time {
    color: var(--text-muted);
    font-size: 13px;
}

.history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.history-actions .btn {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1rem;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print Styles - Fixed to print exact size without empty space */
@media print {
    @page {
        size: auto;
        margin: 0mm;
    }
    
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    body * {
        visibility: hidden;
    }
    
    .barcode-container,
    .barcode-container *,
    .barcode-preview,
    .barcode-preview *,
    #barcode,
    .barcode-value {
        visibility: visible;
    }
    
    .barcode-container {
        position: fixed;
        left: 0;
        top: 0;
        transform: none;
        width: auto;
        border: none;
        box-shadow: none;
        background: white;
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 5mm;
        margin: 0;
    }
    
    .barcode-preview {
        background: white;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
    }
    
    #barcode {
        width: auto !important;
        height: auto !important;
        display: block;
    }
    
    .barcode-value {
        background: white;
        color: black;
        border: none;
        text-align: center;
        margin-top: 3mm;
        padding: 0;
    }
    
    #action-buttons {
        display: none !important;
    }
}

@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .size-controls {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .size-controls {
        grid-template-columns: 1fr;
    }
    
    .history-item {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .history-barcode {
        width: 100%;
        max-width: 200px;
        height: 80px;
    }
    
    .history-details {
        flex: 1;
        min-width: 100%;
    }
    
    .history-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .history-actions .btn {
        flex: 1;
        min-width: calc(50% - 4px);
    }
}