:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    /* New Variables for List View */
    --list-row-hover: #f1f5f9;
    --list-header-bg: #f8fafc;
}

body {
    background-color: #f8f9fa;
    color: #334155;
}

/* --- Glass Card & General UI --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    box-shadow: var(--card-shadow);
    border-radius: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.page-header {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem 1.5rem 4rem;
    border-radius: 0 0 2rem 2rem;
    margin-bottom: -3rem;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
}

/* --- Smart Toolbar --- */
.smart-toolbar {
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.search-capsule {
    background: #f1f5f9;
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    flex-grow: 1;
    max-width: 400px;
}

.search-capsule input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    margin-left: 0.5rem;
    color: #475569;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    background: #f8fafc;
}

.filter-chip.active {
    background: #eff6ff;
    color: #3b82f6;
    border-color: #bfdbfe;
}

/* --- Product Card --- */
.product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
}

.card-img-wrapper {
    position: relative;
    padding-top: 60%;
    /* Aspect Ratio */
    background: #f8fafc;
    overflow: hidden;
}

.card-img-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1rem;
    transition: transform 0.3s;
}

.product-card:hover .card-img-top {
    transform: scale(1.05);
}

.status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.badge-replenish {
    background: #fffbeb;
    color: #b45309;
}

.badge-urgent {
    background: #fef2f2;
    color: #b91c1c;
    animation: pulse 2s infinite;
}

.badge-order {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.stock-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 0.75rem;
    margin-top: auto;
}

.stock-item {
    text-align: center;
    flex: 1;
}

.stock-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
}

.stock-value {
    font-weight: 700;
    color: #334155;
    font-size: 1.1rem;
}

.stock-divider {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
    margin: 0 0.5rem;
}

.btn-action {
    width: 100%;
    padding: 0.8rem;
    border: none;
    font-weight: 600;
    margin-top: 1rem;
    border-radius: 1rem;
    transition: all 0.2s;
}

.btn-replenish {
    background: #eff6ff;
    color: #3b82f6;
}

.btn-replenish:hover {
    background: #3b82f6;
    color: white;
}

/* --- Wizard Styles --- */
.wizard-modal .modal-content {
    border: none;
    border-radius: 1.5rem;
    overflow: hidden;
}

.wizard-header {
    background: var(--primary-gradient);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.step-progress {
    display: flex;
    justify-content: space-between;
    margin: 2rem 1rem;
    position: relative;
}

.step-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
    transform: translateY(-50%);
}

.step-dot {
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #94a3b8;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

.step-dot.active {
    border-color: #6366f1;
    color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.step-dot.completed {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

.barcode-input-wrapper {
    position: relative;
    transition: all 0.3s;
}

.barcode-input-wrapper.success {
    transform: scale(1.02);
}

.barcode-input-wrapper.success input {
    border-color: var(--success-color);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.barcode-input-wrapper.success .status-icon {
    color: var(--success-color);
    opacity: 1;
    transform: scale(1);
}

.large-input {
    font-size: 1.5rem;
    padding: 1rem;
    text-align: center;
    border-radius: 1rem;
    border: 2px solid #e2e8f0;
    font-weight: 700;
    letter-spacing: 2px;
}

.large-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.manual-entry-toggle {
    cursor: pointer;
    color: #64748b;
    font-size: 0.9rem;
    text-decoration: underline;
    margin-top: 0.5rem;
    display: inline-block;
}

.status-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) scale(0.5);
    font-size: 1.5rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Stepper Styles for Touch - Premium & Modern */
.stepper-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    /* Adjusted for better spacing */
    margin-bottom: 1rem;
}

.stepper-btn {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    font-size: 1.5rem;
    /* Smoother icon size */
    color: #6366f1;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.15), 0 8px 10px -6px rgba(99, 102, 241, 0.1);
    /* Tweaked shadow */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    touch-action: manipulation;
}

.stepper-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.2), 0 10px 10px -5px rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    border-color: #cbd5e1;
}

.stepper-btn:active {
    transform: scale(0.92) translateY(0);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1);
    background: #f1f5f9;
}

.qty-display-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-display-input {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #1e293b;
    outline: none;
    padding: 0;
    letter-spacing: -2px;
    font-family: 'Pretendard', sans-serif;
}

/* Hide spin buttons */
.qty-display-input::-webkit-outer-spin-button,
.qty-display-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Mobile Floating Action Button */
.fab-refresh {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    z-index: 100;
    border: none;
    transition: transform 0.2s;
}

.fab-refresh:active {
    transform: scale(0.95);
}

/* --- View Mode Styles --- */
.view-mode-btn {
    padding: 0.5rem 0.8rem;
    color: #64748b;
    border: 1px solid #e2e8f0;
    background: white;
    transition: all 0.2s;
}

.view-mode-btn.active {
    background: #eff6ff;
    color: #3b82f6;
    border-color: #bfdbfe;
}

.view-mode-group {
    display: flex;
    border-radius: 0.5rem;
    overflow: hidden;
}

.view-mode-btn:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}

.view-mode-btn:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
    border-left: none;
}

/* --- Autocomplete Styles --- */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: 0.5rem;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f8fafc;
}

.autocomplete-thumb {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    object-fit: contain;
    background: #f8fafc;
    margin-right: 0.75rem;
    border: 1px solid #e2e8f0;
}

/* --- List View Specifics --- */
.list-view-container {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.product-table {
    width: 100%;
    margin-bottom: 0;
    white-space: nowrap;
}

.product-table th {
    background: var(--list-header-bg);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.product-table tr:last-child td {
    border-bottom: none;
}

.product-table tr:hover td {
    background: var(--list-row-hover);
}

.list-thumb {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    object-fit: cover;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* --- Prevent Double Tap Zoom --- */
button,
input,
.btn {
    touch-action: manipulation;
}