:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #3182ce;
    --success: #2ea043;
    --error: #f85149;
    --glass-blur: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, rgba(88, 166, 255, 0.1), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(46, 160, 67, 0.05), transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 25px;
    position: relative;
    overflow: hidden;
}

header {
    text-align: center;
}

h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.highlight {
    color: var(--accent);
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.mode-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: rgba(0,0,0,0.3);
    padding: 6px;
    border-radius: 16px;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn svg {
    width: 18px;
    height: 18px;
}

.mode-btn.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.main-content {
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.view {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.view.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.scanner-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 16px;
    background: rgba(0,0,0,0.2);
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(46, 160, 67, 0.7);
    animation: pulse 2s infinite;
}

/* Make input invisible but focusable */
#barcode-input {
    opacity: 0;
    position: absolute;
    left: -9999px;
}

.result-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card.hidden {
    display: none;
}

.result-card h3 {
    margin-bottom: 15px;
    font-size: 20px;
}

.qty-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.qty-label {
    color: var(--text-muted);
    font-size: 14px;
}

.qty-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
    padding: 4px 16px;
    border-radius: 20px;
}

.success-message {
    color: var(--success);
    font-size: 14px;
    font-weight: 500;
}

/* Count View */
#count-view {
    text-align: center;
}

.part-highlight {
    font-size: 22px;
    color: var(--accent);
    margin: 10px 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.input-group input {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 16px;
    color: var(--text-main);
    font-size: 24px;
    text-align: center;
    font-weight: 600;
    width: 100%;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.btn-cancel, .btn-submit {
    flex: 1;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.btn-submit {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(88, 166, 255, 0.4);
}

.btn-submit:active {
    transform: translateY(2px);
}

.toast {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
}

.toast.error {
    background: var(--error);
    color: #fff;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 160, 67, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(46, 160, 67, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 160, 67, 0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
