:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #2563eb;
    --success: #10b981;
    --error: #ef4444;
    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: #f8fafc;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%), radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--accent);
}

.status {
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status.ready {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status.processing {
    background-color: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}

.status.error {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.scanner-area {
    margin-bottom: 30px;
    position: relative;
}

#barcode-input {
    width: 100%;
    padding: 20px;
    font-size: 2rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
    text-align: center;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
}

#barcode-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.focus-warning {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: none; /* Hidden by default now */
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* If input is NOT focused, show warning */
#barcode-input:not(:focus)~.focus-warning {
    opacity: 1;
    pointer-events: auto;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.history-section h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 15px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

.history-code {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-main);
}

.history-time {
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Customer Section */
.customer-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.customer-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-label {
    color: var(--text-muted);
    margin-right: 10px;
}

.customer-name {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-main);
    flex-grow: 1;
}

#customer-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    gap: 10px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    background: #ffffff;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}

.icon-btn:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
}

.nav-links {
    list-style: none;
    padding: 20px;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.nav-link {
    display: block;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
}

.nav-separator {
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
    list-style: none;
}

.nav-group {
    list-style: none;
    margin-bottom: 5px;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    border-radius: 8px;
    user-select: none;
    transition: all 0.2s;
}

.nav-header:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.04);
}

.nav-chevron {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.nav-header.collapsed .nav-chevron {
    transform: rotate(-90deg);
}

.nav-sub {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-left: 8px;
}

.nav-sub .nav-link {
    padding: 10px 15px;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.nav-sub.hidden,
.hidden {
    display: none !important;
}

/* Card Updates */
.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

#scanner-name-input,
#customer-input,
#new-cust-id,
#new-cust-name,
#new-job-name,
#lookup-sku-input,
#po-number-input,
#po-filter-input {
    flex-grow: 1;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

select {
    flex-grow: 1;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

#scanner-name-input:focus,
#customer-input:focus,
select:focus,
#new-cust-id:focus,
#new-cust-name:focus,
#lookup-sku-input:focus,
#po-number-input:focus,
#po-filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.cust-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.cust-item:last-child {
    border-bottom: none;
}

.btn-primary {
    width: 100%;
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
}

.text-btn:hover {
    color: var(--text-main);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.page-btn {
    background: var(--card-bg);
    border: 1px solid var(--text-muted);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
    margin-left: 10px;
}

.delete-btn:hover {
    opacity: 1;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    animation: slideIn 0.3s ease-out;
}

.job-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 20px;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.job-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.15);
}

/* Login Screen Light Theme */
.login-screen-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #f8fafc;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container-light {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 2.5rem 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 800;
    color: #2563eb;
}

.login-title {
    text-align: center;
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.5rem;
}

.login-subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    margin-top: 0;
}

.login-form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

.login-input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #0f172a;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s;
}

.login-input::placeholder {
    color: #94a3b8;
}

.login-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-btn-primary {
    width: 100%;
    padding: 0.8rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.login-btn-primary:hover {
    background: #1d4ed8;
}

.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.25rem 0;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.login-divider span {
    padding: 0 0.75rem;
}

.login-btn-google {
    width: 100%;
    padding: 0.75rem;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.login-btn-google:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Desktop Layout (permanent sidebar, like ShiftHappens) */
@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    .sidebar-overlay {
        display: none !important;
    }
    .container {
        margin-left: 250px;
        max-width: calc(100% - 250px);
        padding: 40px;
        transition: margin-left 0.3s ease, max-width 0.3s ease;
    }
    body.sidebar-collapsed .container {
        margin-left: 0;
        max-width: 100%;
    }
    #menu-btn {
        display: block !important;
    }
    header {
        transition: margin-left 0.3s ease;
    }
}

/* Export Progress Spinner */
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border-left-color: #0284c7;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

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

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}