* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}


.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.camera-section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 40vh; /* ograniczenie wysokości na mobile */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-container canvas {
    display: none;
}

.camera-controls {
    text-align: center;
}

.scans-section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: 600px;
    overflow-y: auto;
}

.scans-section h2 {
    margin-bottom: 15px;
    font-size: 18px;
    color: #0051ba;
}

.scans-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scan-item {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 12px;
    border-left: 4px solid #0051ba;
    position: relative;
}

.scan-item.unrecognized {
    border-left-color: #ff6b6b;
}

.scan-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.scan-code {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.scan-time {
    font-size: 12px;
    color: #666;
}

.scan-image {
    width: 100%;
    max-width: 200px;
    border-radius: 4px;
    margin-top: 8px;
}

.scan-product {
    margin-top: 8px;
    font-size: 14px;
    color: #0051ba;
}

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: #ff5252;
}

.checklist-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.checklist-header h2 {
    font-size: 18px;
    color: #0051ba;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #0051ba;
}

.checklist-item--missing {
    background: #fff9e6;
    border-left-color: #ffcc00;
}

.checklist-item--complete {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.checklist-item--overflow {
    background: #ffecec;
    border-left-color: #ff6b6b;
}

.checklist-item-scanned--missing {
    color: #ff9800;
}

.checklist-item-scanned--complete {
    color: #4caf50;
}

.checklist-item-scanned--overflow {
    color: #ff3d00;
}

.checklist-item-code {
    font-weight: bold;
    flex: 1;
    font-size: 16px;
}

.checklist-item-quantity {
    margin: 0 15px;
    color: #666;
}

.checklist-item-scanned {
    color: #4caf50;
    font-weight: bold;
    margin-right: 10px;
}

.checklist-item-actions {
    display: flex;
    gap: 5px;
}

.progress-section {
    background: white;
    border-radius: 6px;
    padding: 4px 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.progress-stats {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    width: 100%;
}

.stat {
    display: inline-flex;
    align-items: center;
    text-align: center;
    padding: 0;
    background: transparent;
    flex: 1;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
}

.stat-label {
    display: inline;
    font-size: 8px;
    color: #666;
    margin-right: 2px;
    line-height: 1;
}

.stat-value {
    display: inline;
    font-size: 14px;
    font-weight: bold;
    color: #0051ba;
    line-height: 1;
}

.progress-bar {
    width: 100%;
    height: 16px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s ease;
    width: 0;
}

.unrecognized-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.unrecognized-section h2 {
    margin-bottom: 15px;
    font-size: 18px;
    color: #ff6b6b;
}

.unrecognized-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-primary {
    background: #0051ba;
    color: white;
}

.btn-primary:hover {
    background: #003d8f;
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #555;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 50% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #0051ba;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-content label {
    font-weight: 500;
    color: #333;
}

.modal-content input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-content input:focus {
    outline: none;
    border-color: #0051ba;
}

:root { --fixed-top-h: 0px; }

.fixed-top {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: #f5f5f5;
    z-index: 200;
    padding: 10px 15px 0 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tabs {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    flex: 1;
    padding: 8px 10px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    transition: all .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab.active {
    background: #0051ba;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,81,186,0.3);
}

.tab:hover:not(.active) {
    background: #e8e8e8;
    color: #333;
}

/* Nowy układ paneli - wypełnia przestrzeń pod fixed-top */
.panels-wrapper {
    position: fixed;
    top: var(--fixed-top-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5f5;
    overflow: hidden;
}

.panel {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 12px 12px 60px;
    display: none !important;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.panel.active {
    display: block !important;
}

@media (max-width: 600px) {
    .camera-container { max-height: 38vh; }
}
@media (max-width: 420px) {
    .camera-container { max-height: 34vh; }
}
