:root {
    --bg-color: #0f172a; /* Slate 900 */
    --surface-color: #1e293b; /* Slate 800 */
    --primary-color: #10b981; /* Emerald 500 */
    --secondary-color: #3b82f6; /* Blue 500 */
    --text-color: #f8fafc; /* Slate 50 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --border-color: #334155; /* Slate 700 */
    --highlight-color: #f43f5e; /* Rose 500 */
    --completed-color: #10b981; 
    --font-family: 'Pretendard', 'Inter', -apple-system, sans-serif;
    --highlight-pulse: rgba(255, 51, 102, 0.5);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Glassmorphism */
.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* Sidebar */
.sidebar {
    width: 350px;
    min-width: 350px;
    flex-shrink: 0;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right: none;
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle-btn {
    position: absolute;
    top: 20px;
    left: 15px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--surface-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background-color 0.2s, transform 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background-color: var(--border-color);
}


.header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.header .subtitle {
    font-size: 0.9rem;
    color: var(--primary-color);
}

.upload-section, .search-section, .picking-list-section {
    margin-bottom: 24px;
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.search-box {
    display: flex;
    gap: 8px;
}

input[type="text"], input[type="file"] {
    flex: 1;
    min-width: 0;
    padding: 10px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    font-family: var(--font-family);
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: var(--font-family);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-color);
    filter: brightness(1.1);
}

.btn-success {
    background-color: var(--completed-color);
    color: #fff;
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

.picking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
}

.pick-item {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.pick-item:hover {
    border-color: var(--primary-color);
}

.pick-item.active {
    border-color: var(--highlight-color);
    box-shadow: 0 0 10px var(--highlight-pulse);
}

.pick-item .loc {
    font-weight: 700;
    color: var(--highlight-color);
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.pick-item .sku {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.pick-item .qty {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
}

.summary-info {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Zone Dashboard */
.zone-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}
.zone-card .z-name { font-weight: bold; color: var(--primary-color); font-size: 0.9rem; }
.zone-card .z-count { font-size: 1.1rem; margin-top: 4px; font-weight: 600; color: #fff; }

/* Map Area */
.map-container {
    flex: 1;
    position: relative;
    background-color: #0a0a0a;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-viewer {
    flex: 1;
    width: 100%;
    overflow: auto;
    position: relative;
}

.map-wrapper {
    position: relative;
    display: inline-block;
    background-color: #111;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Path Styles */
.path-line {
    fill: none;
    stroke: var(--secondary-color);
    stroke-width: 3;
    stroke-dasharray: 8 4;
    animation: dash 20s linear infinite;
    opacity: 0.8;
}

.path-line.completed {
    stroke: var(--completed-color);
    opacity: 0.4;
    animation: none;
    stroke-dasharray: none;
}

@keyframes dash {
    to {
        stroke-dashoffset: -1000;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    animation: slideUp 0.3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes slideUp {
    to { transform: translateY(0); }
}

/* Rack Grid Visualization */
.rack-grid {
    display: grid;
    gap: 4px;
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 2px solid var(--border-color);
    max-height: 80vh;
    overflow-y: auto;
}

.rack-level {
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    text-align: center;
    font-weight: bold;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.rack-level.target {
    border-color: var(--highlight-color);
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--highlight-color);
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
    animation: pulseRack 2s infinite;
}

@keyframes pulseRack {
    0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

/* SVG Marker Styles */
.marker {
    fill: var(--primary-color);
    transition: all 0.3s ease;
}

.marker.target {
    fill: var(--highlight-color);
    filter: drop-shadow(0 0 8px var(--highlight-color));
}

.marker.active {
    fill: var(--highlight-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        r: 8;
        fill-opacity: 1;
        stroke-width: 0;
        stroke: var(--highlight-color);
    }
    50% {
        r: 15;
        fill-opacity: 0.5;
        stroke-width: 4;
        stroke: var(--highlight-pulse);
    }
    100% {
        r: 8;
        fill-opacity: 1;
        stroke-width: 0;
        stroke: var(--highlight-color);
    }
}

.marker.completed {
    fill: var(--completed-color);
}

/* PDA / Mobile specific overrides */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .map-container {
        height: 60vh;
    }
    
    .mobile-task-overlay {
        display: flex !important;
        width: 100%;
        background-color: var(--surface-color);
        border-top: 1px solid var(--primary-color);
        padding: 16px;
        flex-direction: column;
        gap: 12px;
        z-index: 100;
        /* Removed absolute positioning so it sits at the bottom of the map-container */
    }
    
    .task-zone {
        font-size: 0.9rem;
        color: var(--text-secondary);
    }
    
    .task-loc {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--highlight-color);
    }
    
    .task-sku {
        font-size: 1rem;
        margin-top: 4px;
    }
    
    .task-qty {
        margin-top: 8px;
        font-size: 1.1rem;
    }
    
    .picking-list-section {
        display: none; /* Hide full list on mobile to save space */
    }
}
