:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --success: #10B981;
    --success-hover: #059669;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --bg-color: #f3f4f6;
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

/* Background animated gradient logic */
.glass-bg {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1;
    background: linear-gradient(135deg, #e0eAFC 0%, #cfdef3 100%);
}
.glass-bg::before, .glass-bg::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
}
.glass-bg::before { background: #E1CAFF; top: 10%; left: 10%; animation: float 10s ease-in-out infinite alternate; }
.glass-bg::after { background: #A0CFCF; bottom: 10%; right: 10%; animation: float 12s ease-in-out infinite alternate-reverse; }

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-50px) scale(1.1); }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

h1 {
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    color: #111827;
}

.badge {
    background-color: var(--primary);
    color: white;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    vertical-align: middle;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.config-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modern-input {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: rgba(255,255,255,0.8);
    transition: all 0.3s ease;
}
.modern-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Scanner Area */
.scan-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.scan-status-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.scan-pulse {
    width: 16px;
    height: 16px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.scan-fallback {
    width: 300px;
}

/* Table */
.table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

th {
    background: #f8fafc;
    font-weight: 600;
    position: sticky;
    top: 0;
    color: var(--text-secondary);
}

.empty-state td {
    text-align: center;
    color: #9CA3AF;
    padding: 3rem;
}

.qty-input {
    width: 60px;
    text-align: center;
    padding: 0.4rem;
}
.price-input {
    width: 100px;
    padding: 0.4rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: var(--success-hover); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

.action-bar {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    width: 100%;
    max-width: 650px;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
.scanned-info { background: #EFF6FF; color: #1E3A8A; padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; }

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}
.form-row .form-group { flex: 1; }
.full-width { width: 100%; }

.highlight-box {
    background: #FEF2F2;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px dashed #FCA5A5;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #FEE2E2;
    color: #991B1B;
    border-radius: 8px;
    font-size: 0.9rem;
}

.hidden { display: none !important; }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 1000;
    border-left: 4px solid var(--success);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateX(120%);
}
.toast.show { transform: translateX(0); }
.toast.error { border-left-color: var(--danger); }
