:root {
    --bg-color: #f1f5f9;
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.06);
    --text-primary: #333333;
    --text-muted: #64748b;
    --accent-color: #AF0010;
    --accent-glow: rgba(175, 0, 16, 0.25);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --font-family: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    background-image: radial-gradient(circle at 15% 50%, rgba(175, 0, 16, 0.05), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(0, 0, 0, 0.03), transparent 25%);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    z-index: 10;
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem 2rem;
}

.brand-logo {
    max-width: 180px;
    height: auto;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(175, 0, 16, 0.1), rgba(175, 0, 16, 0.02));
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Header */
.top-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--glass-border);
    width: 300px;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

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

.icon-btn .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
    border-radius: 1rem;
    font-weight: bold;
}

/* Modules */
.module-container {
    padding: 2rem;
    flex-grow: 1;
}

.module-view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.module-view.active {
    display: block;
}

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

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
}

.module-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.module-header p {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.primary-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.primary-btn:hover {
    background: #8e000d;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--accent-glow);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: rgba(0,0,0,0.05);
    border-color: var(--text-muted);
}

/* Glass Panels */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

/* Dashboard Banner */
.dashboard-banner {
    display: flex;
    align-items: center;
    background: linear-gradient(to right, rgba(175, 0, 16, 0.05), transparent);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.banner-content {
    flex: 1;
}

.banner-content h2 {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.banner-image img {
    height: 180px;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

/* Product Lineup List */
.product-showcase {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.product-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    flex: 1;
}

.product-card h4 {
    margin-top: 0.5rem;
}

.product-card img {
    height: 120px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

/* Dashboard Specifics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
    background: white;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

.stat-card.alert {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.02);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend.positive { color: var(--success); }
.trend.negative { color: var(--danger); }
.trend.neutral { color: var(--text-muted); }
.trend i { width: 14px; height: 14px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.chart-container h3, .recent-activity h3, .content-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Simple CSS Bar Chart Placeholder */
.placeholder-chart {
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.bar {
    flex: 1;
    background: #e2e8f0;
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: var(--transition);
}

.bar:hover {
    background: #cbd5e1;
}

.bar.accent {
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

.bar span {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0;
    transition: var(--transition);
}

.bar:hover span {
    opacity: 1;
    color: var(--text-primary);
}

/* Activity List */
.activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.activity-list li {
    display: flex;
    gap: 1rem;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
}

.activity-icon.blue { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
.activity-icon.green { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.activity-icon.yellow { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.activity-icon.red { color: #ef4444; background: rgba(239, 68, 68, 0.1); }


.activity-text p {
    font-size: 0.9rem;
}

.activity-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}
.bg-blue { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.bg-yellow { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.bg-green { background: rgba(16, 185, 129, 0.15); color: #059669; }
.bg-red { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    width: 100px;
}

.progress-bar .fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 4px;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* 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;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    transform: translateY(20px);
    transition: var(--transition);
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    max-height: 90vh;
    overflow-y: auto;
}

/* Custom Scrollbar for Modal */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb {
    background-color: var(--glass-border);
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background-color: #cbd5e1;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    font-family: var(--font-family);
    transition: border-color 0.2s;
    background: #f8fafc;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: white;
}

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

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    padding: 0.6rem 1.2rem;
    transition: color 0.2s;
}

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

.image-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--glass-border);
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.015);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.image-upload-area:hover {
    background: rgba(175, 0, 16, 0.03);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.scan-feedback {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 500;
}

.scan-feedback.hidden {
    display: none;
}

.scan-feedback.success {
    color: var(--success);
}

.spin {
    animation: spin 1s linear infinite;
}

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

/* Catalog Styles */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.catalog-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: var(--transition);
}

.catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
    border-color: var(--accent-color);
}

.sku-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    display: inline-block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.catalog-card h4 {
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.catalog-card p.category {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.catalog-card p.price {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Dropdown Menus */
.dropdown-menu {
    position: absolute;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: 160px;
    z-index: 50;
    display: none;
    flex-direction: column;
}

.dropdown-menu.active {
    display: flex;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item i {
    width: 16px;
    height: 16px;
}

.dropdown-item:hover {
    background: #f8fafc;
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.05);
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-family);
    white-space: nowrap;
}

.tab-btn i {
    width: 16px;
    height: 16px;
}

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

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-out forwards;
}

.tab-pane.active {
    display: block;
}

/* Batch Scanner Cards */
.batch-card {
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out forwards;
}

.batch-card-img {
    height: 140px;
    background: #f8fafc;
    overflow: hidden;
    position: relative;
    border-bottom: 1px dashed var(--glass-border);
}

.batch-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.batch-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.batch-card .form-group {
    margin-bottom: 0;
}

.batch-card .form-group label {
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}

.batch-card .form-group input {
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

.batch-remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.batch-remove-btn:hover {
    background: var(--danger);
    color: white;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-width: 380px;
    pointer-events: all;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    backdrop-filter: blur(16px);
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.removing {
    animation: toastOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast.success { border-left: 3px solid var(--success); color: #065f46; background: rgba(240, 253, 244, 0.97); }
.toast.success .toast-icon { color: var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  color: #7f1d1d; background: rgba(254, 242, 242, 0.97); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); color: #78350f; background: rgba(255, 251, 235, 0.97); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    { border-left: 3px solid #3b82f6;        color: #1e3a5f; background: rgba(239, 246, 255, 0.97); }
.toast.info    .toast-icon { color: #3b82f6; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(16px); }
}

/* Work Order Modal — larger than the default 90vh */
#work-order-modal .modal-content {
    max-height: 96vh;
}

/* Finished weight scan grid — fixed height so it scrolls rather than pushing the form down */
#wo-fin-scan-grid {
    max-height: 230px;
    overflow-y: auto;
    padding-right: 2px;
}

/* Scan detail image — driven by the +/- zoom buttons; width is set inline */
#fin-scan-detail-img {
    transition: width 0.12s ease;
    display: block;
    width: 100%;
    transform-origin: top left;
}

/* Confirm Dialog */
#confirm-dialog .modal-content {
    max-width: 420px;
}

#confirm-dialog .confirm-message {
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 1.75rem;
}
#confirm-dialog-ok {
    min-width: 100px;
}

#confirm-dialog-cancel {
    background: transparent;
    border-color: var(--glass-border);
    color: var(--text-primary);
}

.input-missing {
    border-color: #ef4444 !important;
    background-color: rgba(239,68,68,0.05) !important;
}
