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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    padding-bottom: 70px;
}

/* Header */
.header {
    background: #1a73e8;
    color: white;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 20px;
    margin-bottom: 8px;
}

.header h1 a {
    text-decoration: none;
    color: white;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:active {
    background: rgba(255, 255, 255, 0.4);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-top: 1px solid #eee;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font-size: 11px;
    color: #888;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 24px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active {
    color: #1a73e8;
}

.nav-icon {
    font-size: 24px;
}

/* Main Content */
.container {
    padding: 16px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 12px;
    color: #333;
    border-left: 3px solid #1a73e8;
    padding-left: 10px;
}

/* Buttons */
.btn {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    opacity: 0.7;
}

.btn-danger {
    background: #dc3545;
}

.btn-success {
    background: #28a745;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-outline {
    background: white;
    border: 2px solid #ddd;
    color: #333;
}

.btn-outline:active {
    background: #f5f5f5;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

/* Scanner placeholder */
.scanner-placeholder {
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
}

#reader {
    width: 100%;
    min-height: 300px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #fafafa;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: #1a73e8;
    outline: none;
    background: white;
}

input:disabled {
    background: #f0f0f0;
    opacity: 0.7;
}

/* Product list */
.product-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.product-item:active {
    background: #f5f5f5;
}

.product-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.product-location {
    font-size: 12px;
    color: #666;
}

/* Location chip */
.location-chip {
    background: #e8f0fe;
    color: #1a73e8;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    display: inline-block;
    margin: 4px 4px 0 0;
}

/* Status messages */
.status {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    display: none;
}

.status.show {
    display: block;
}

.status.success {
    background: #d4edda;
    color: #155724;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
}

.status.info {
    background: #d1ecf1;
    color: #0c5460;
}

.status.warning {
    background: #fff3cd;
    color: #856404;
}

/* Quick actions grid */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.quick-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    -webkit-tap-highlight-color: transparent;
}

.quick-card:active {
    transform: scale(0.96);
}

.quick-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.quick-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.quantity-input {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.quantity-input button {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: #f0f0f0;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.quantity-input button:active {
    background: #e0e0e0;
}

.quantity-input input {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
}

.hidden {
    display: none;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Sound toggle */
.sound-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: #555;
}

.sound-toggle input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.btn-group .btn {
    flex: 1;
    min-width: 80px;
}

.btn-group .btn-sm {
    flex: 0 1 auto;
}

/* Responsive */
@media (max-width: 400px) {
    .header h1 {
        font-size: 17px;
    }

    .quick-grid {
        gap: 8px;
    }

    .quick-card {
        padding: 16px;
    }

    .nav-item {
        font-size: 10px;
        padding: 4px 8px;
    }

    .nav-icon {
        font-size: 20px;
    }
}

/* Кнопка переключения камеры */
.switch-camera-btn {
    background: white;
    border: 2px solid #1a73e8;
    color: #1a73e8;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.switch-camera-btn:active {
    background: #e8f0fe;
    transform: scale(0.98);
}

.switch-camera-btn:hover {
    background: #e8f0fe;
}

/* ===== Стили для страницы логина ===== */
.login-page {
    background: linear-gradient(135deg, #e8f0fe 0%, #f5f5f5 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 24px;
    padding: 32px 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 28px;
    color: #1a73e8;
    margin-bottom: 4px;
}

.login-logo p {
    color: #666;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: #fafafa;
}

.login-form input:focus {
    border-color: #1a73e8;
    outline: none;
    background: white;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:active {
    background: #1557b0;
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-btn-outline {
    background: white;
    color: #1a73e8;
    border: 2px solid #1a73e8;
}

.login-btn-outline:active {
    background: #e8f0fe;
}

.login-status {
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

.login-status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
}

.login-status.success {
    display: block;
    background: #d4edda;
    color: #155724;
}

.login-status.info {
    display: block;
    background: #d1ecf1;
    color: #0c5460;
}

.login-loading {
    display: none;
    text-align: center;
    margin: 8px 0;
}

.login-loading.active {
    display: block;
}

.login-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: #999;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #999;
    font-size: 14px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.login-divider::before {
    margin-right: 16px;
}

.login-divider::after {
    margin-left: 16px;
}

.login-scanner-placeholder {
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    min-height: 200px;
}

#qr-reader {
    width: 100%;
    min-height: 200px;
}

.login-scanner-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.login-scanner-controls .btn {
    flex: 1;
}

.login-qr-hint {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

/* Общие стили для страницы логина (используем как body) */
body.login-page-body {
    background: linear-gradient(135deg, #e8f0fe 0%, #f5f5f5 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: 20px;
}