/* QR Scanner Mobile App - Styles */

/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
    color: #2c3e50;
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Заголовок */
.app-header {
    background: white;
    padding: 0.735rem;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    border-left: 1.96px solid #2563eb;
    position: relative;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.02) 0%, rgba(59, 130, 246, 0.02) 100%);
    border-radius: 0;
    z-index: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header-content i {
    font-size: 1.5rem;
    color: #2563eb;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a8a;
    text-shadow: 0 2px 4px rgba(30, 58, 138, 0.1);
}

.app-version {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Основной контент */
.main-content {
    flex: 1;
    padding: 0.735rem;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* Статус дот в заголовке */
.scanner-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.status-dot.error {
    background: #2563eb;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Секции */
.scanner-section,
.results-section,
.history-section {
    background: white;
    border-radius: 7.84px;
    padding: 0.98rem;
    margin-bottom: 0.735rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
}

.scanner-section::before,
.results-section::before,
.history-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.scanner-section {
    animation-delay: 0.1s;
}

.results-section {
    animation: fadeInUp 0.8s ease-out;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

.history-section {
    animation: fadeInUp 0.8s ease-out;
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

.scanner-header,
.results-header,
.history-header {
    margin-bottom: 1rem;
}

.scanner-header h2,
.results-header h2,
.history-header h2 {
    display: flex;
    align-items: center;
    gap: 0.245rem;
    font-size: 0.686rem;
    color: #333;
    margin-bottom: 0.3675rem;
}

.scanner-header p {
    color: #666;
    font-size: 0.49rem;
}

/* Кнопки сканирования */
.scanner-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Секция ручного ввода */
.manual-input-section {
    margin-top: 0.5rem;
}

.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.button-group .scan-btn {
    flex: 1;
}

.manual-input {
    width: 100%;
    padding: 0.49rem 0.588rem;
    border: 2px solid #e2e8f0;
    border-radius: 5.88px;
    font-size: 0.539rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    min-height: 2.94rem;
}

.manual-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
}

.input-hint {
    font-size: 0.4655rem;
    color: #64748b;
    margin: 0;
    text-align: center;
    opacity: 0.8;
}

/* Уведомление об автозапуске */
.auto-start-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    animation: pulse 2s infinite;
    position: relative;
    overflow: hidden;
}

.auto-start-notice::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.auto-start-notice i {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

.scan-btn {
    flex: 1;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 0.588rem 0.735rem;
    border-radius: 5.88px;
    font-size: 0.539rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.245rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}

.scan-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.scan-btn:hover::before {
    left: 100%;
}

.scan-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.scan-btn:active {
    transform: translateY(0);
}

.scan-btn.stop-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.scan-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Контейнер камеры */
.camera-container {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #000;
    box-shadow: 0 8px 30px rgba(30, 58, 138, 0.1);
    border: 2px solid rgba(37, 99, 235, 0.1);
}

#qr-reader {
    width: 350px;
    height: 350px;
    position: relative;
    margin: 0 auto;
}

#qr-reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

#qr-reader canvas {
    display: none;
}

/* Оверлей камеры */
.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-frame {
    width: 210px;
    height: 190px;
    border: 3px solid #2563eb;
    border-radius: 10px;
    position: relative;
    left: 15px;
    animation: scanPulse 2s infinite;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.4);
}

.scan-frame::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #2563eb, transparent);
    animation: scanLine 2s infinite;
}

.scan-frame::before,
.scan-frame::after {
    content: '';
    position: absolute;
}

@keyframes scanPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes scanLine {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.scan-instruction {
    color: white;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}


/* Результаты сканирования */
.qr-result {
    background: rgba(76, 175, 80, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.8s ease-out;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.result-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.result-item label {
    font-weight: 500;
    color: #333;
}

.result-value {
    color: #666;
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

.result-value.success {
    color: #4CAF50;
    font-weight: 500;
}

/* Секция поиска */
.search-section {
    margin-bottom: 1rem;
}

.search-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 1rem;
}

.search-result {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem;
}

.info-message,
.success-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 12px;
}

.info-message {
    background: rgba(33, 150, 243, 0.1);
    color: #1976d2;
}

.success-message {
    background: rgba(76, 175, 80, 0.1);
    color: #388e3c;
}

.info-message i,
.success-message i {
    font-size: 1.25rem;
}

.warning-message {
    background: rgba(255, 152, 0, 0.1);
    color: #f57c00;
}

.error-message {
    background: rgba(244, 67, 54, 0.1);
    color: #d32f2f;
}

.loading-message {
    background: rgba(33, 150, 243, 0.1);
    color: #1976d2;
}

.warning-message i,
.error-message i,
.loading-message i {
    font-size: 1.25rem;
}

/* Стили для деталей товара */
.product-details {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(76, 175, 80, 0.1);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    font-weight: 600;
    color: #2e7d32;
    flex: 0 0 120px;
}

.detail-row .value {
    flex: 1;
    text-align: right;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    word-break: break-word;
}

/* Действия с результатом */
.result-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 68.6px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 0.49rem 0.588rem;
    border-radius: 5.88px;
    font-size: 0.49rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.245rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}


.action-btn.scan-again-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.action-btn.scan-again-btn:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

/* История сканирований */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-history-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    position: relative;
    overflow: hidden;
}

.clear-history-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.clear-history-btn:hover::before {
    left: 100%;
}

.clear-history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.empty-history {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
}

.empty-history i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.history-item {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #2563eb;
}

.history-item:nth-child(1) { animation-delay: 0.1s; }
.history-item:nth-child(2) { animation-delay: 0.2s; }
.history-item:nth-child(3) { animation-delay: 0.3s; }
.history-item:nth-child(4) { animation-delay: 0.4s; }
.history-item:nth-child(5) { animation-delay: 0.5s; }

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(30, 58, 138, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-item-time {
    font-size: 0.8rem;
    color: #666;
}

.history-item-qr {
    font-family: monospace;
    font-size: 0.9rem;
    color: #333;
    word-break: break-all;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 15px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 90%;
    animation: slideDown 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-icon {
    font-size: 1.25rem;
}

.notification.success {
    border-left: 4px solid #16a34a;
}

.notification.success .notification-icon {
    color: #16a34a;
}

.notification.error {
    border-left: 4px solid #dc2626;
}

.notification.error .notification-icon {
    color: #dc2626;
}

.notification.warning {
    border-left: 4px solid #d97706;
}

.notification.warning .notification-icon {
    color: #d97706;
}

.notification.info {
}

.notification.info .notification-icon {
    color: #2563eb;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.modal-close:hover {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    transform: rotate(90deg);
}

.modal-body {
    padding: 0 1.5rem 1rem;
}

.modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Google Auth Section */
.auth-section {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.auth-notice {
    text-align: center;
}

.auth-notice i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.auth-notice h3 {
    margin: 10px 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.auth-notice p {
    margin: 10px 0 20px 0;
    opacity: 0.9;
    font-size: 1rem;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: white;
    color: #4285f4;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-btn:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Постоянная секция управления авторизацией */
.auth-management-section {
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.auth-management {
    padding: 20px;
}

.auth-management h3 {
    color: #4285f4;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.auth-btn.primary {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.auth-btn.primary:hover {
    background: linear-gradient(135deg, #3367d6, #2e7d32);
}

.auth-btn.secondary {
    background: #f8f9fa;
    color: #dc3545;
    border: 1px solid #dc3545;
    cursor: pointer;
}

.auth-btn.secondary:hover {
    background: #dc3545;
    color: white;
}

.auth-status {
    font-size: 0.75rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-weight: 500;
}

.auth-status i {
    font-size: 0.85rem;
}

.auth-status.success {
    color: #10b981;
}

.auth-status.warning {
    color: #f59e0b;
}

.auth-status.error {
    color: #ef4444;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 767px) {
    .app-container {
        max-width: 95%;
        margin: 0 auto;
    }

    .main-content {
        padding: 0.7rem;
    }

    .scanner-section,
    .results-section,
    .history-section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    .scanner-controls {
        flex-direction: column;
        gap: 0.8rem;
    }

    .input-group {
        flex-direction: column;
        gap: 0.6rem;
    }

    .button-group {
        flex-direction: column;
        gap: 0.6rem;
    }

    .manual-input {
        width: 100%;
        padding: 0.6rem 0.7rem;
        font-size: 0.6rem;
        min-height: 44px;
    }

    .scan-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.55rem;
        min-height: 44px; /* Удобный размер для пальцев */
    }

    .action-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.5rem;
        min-height: 40px;
    }

    .scan-frame {
        width: 180px;
        height: 160px;
        border-radius: 8px;
    }

    #qr-reader {
        width: 350px;
        height: 350px;
    }

    .scanner-header h2 {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    .scanner-header p {
        font-size: 0.55rem;
    }

    .input-hint {
        font-size: 0.5rem;
    }
}

/* Специальные стили для очень маленьких экранов */
@media (max-width: 480px) {
    .app-container {
        max-width: 98%;
    }

    .main-content {
        padding: 0.5rem;
    }

    .scanner-section,
    .results-section,
    .history-section {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .scan-btn {
        padding: 0.7rem;
        font-size: 0.6rem;
    }

    .action-btn {
        padding: 0.6rem;
        font-size: 0.55rem;
    }

    .manual-input {
        padding: 0.7rem;
        font-size: 0.65rem;
        min-height: 44px;
    }

    .scan-frame {
        width: 160px;
        height: 140px;
    }

    #qr-reader {
        width: 350px;
        height: 350px;
    }
}

/* Стили для средних мобильных устройств */
@media (min-width: 481px) and (max-width: 750px) {
    .scan-frame {
        width: 160px;
        height: 140px;
    }

    #qr-reader {
        width: 350px;
        height: 350px;
    }

    .scan-btn {
        padding: 0.8rem 1rem;
        font-size: 0.65rem;
    }

    .manual-input {
        padding: 0.8rem 1rem;
        font-size: 0.7rem;
        min-height: 44px;
    }
}
    
    .result-actions {
        flex-direction: column;
    }
    
    .action-btn {
        min-width: auto;
    }

    .scan-frame {
        width: 210px;
        height: 190px;
    }

    #qr-reader {
        height: 122.5px;
    }
}

/* Скрытие элементов по умолчанию */
.camera-container,
.results-section {
    display: none;
}

/* Стили для HTML5-QRCode */
#qr-reader__dashboard_section {
    display: none !important;
}

#qr-reader__camera_selection {
    display: none !important;
}

/* Управление ориентацией камеры осуществляется через JavaScript */

/* Дополнительные стили для лучшего отображения QR-кодов */
#qr-reader__scan_region {
    border: none !important;
}

#qr-reader__scan_region video {
    border-radius: 12px;
}

/* Унифицированный размер области сканирования для всех устройств */
#qr-reader {
    width: 350px !important;
    height: 350px !important;
}

/* Адаптивность для разных устройств */

/* Мобильные устройства (до 768px) - уменьшенные размеры */
@media (max-width: 767px) {
    body {
        font-size: 14px;
    }

    .app-container {
        padding: 0.5rem;
    }

    .scanner-section h2 {
        font-size: 1.2rem;
    }

    .scan-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }

    .action-btn {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }

    .result-item label {
        font-size: 0.9rem;
    }

    .result-value {
        font-size: 0.9rem;
    }

    .notification {
        min-width: 280px;
        font-size: 0.9rem;
    }

    .modal-content {
        width: 90%;
        max-width: 350px;
    }

}

/* Планшеты и маленькие десктопы (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    body {
        font-size: 16px;
    }

    .app-container {
        max-width: 800px;
        padding: 1rem;
    }

    .scanner-section h2 {
        font-size: 1.4rem;
    }

    .scan-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .action-btn {
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }
}

/* Экраны около 500px (адаптивный дизайн для ПК) */
@media (min-width: 481px) and (max-width: 600px) {
    body {
        font-size: 16px;
    }

    .scanner-section h2 {
        font-size: 1.2rem;
    }

    .scan-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
        min-height: 48px;
    }

    .action-btn {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .manual-input {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        min-height: 48px;
    }
}

/* Большие десктопы (1025px и выше) - нормальные размеры */
@media (min-width: 1025px) {
    body {
        font-size: 18px;
    }

    .app-container {
        max-width: 900px;
        padding: 2rem;
    }

    .scanner-section h2 {
        font-size: 1.6rem;
    }

    .scan-btn {
        padding: 1.2rem 2rem;
        font-size: 1.1rem;
    }

    .action-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .result-item label {
        font-size: 1rem;
    }

    .result-value {
        font-size: 1rem;
    }

    .notification {
        min-width: 400px;
        font-size: 1rem;
    }

    .modal-content {
        width: 500px;
    }
}

/* Стили для результатов поиска в Google Sheets */
.product-details {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    font-weight: 600;
    color: #374151;
    flex: 1;
}

.detail-row .value {
    font-weight: 500;
    color: #1f2937;
    flex: 2;
    text-align: right;
    word-break: break-word;
}

.auth-btn {
    background: #4285f4;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.auth-btn:hover {
    background: #3367d6;
    transform: translateY(-1px);
}

.auth-btn i {
    margin-right: 0.5rem;
}

/* Управление количеством товара */
.quantity-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.1);
}

.quantity-section h3 {
    color: #2563eb;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quantity-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quantity-input-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.quantity-input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    transition: border-color 0.2s ease;
    width: 100%;
    max-width: none;
}

.quantity-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.quantity-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.quantity-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
    min-height: 48px;
}

.quantity-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quantity-btn:active {
    transform: translateY(0);
}

.add-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.add-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.remove-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.remove-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.remove-btn:disabled,
.remove-btn[disabled] {
    background: linear-gradient(135deg, #9ca3af, #6b7280) !important;
    cursor: not-allowed !important;
    opacity: 0.4 !important;
}

.refresh-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.quantity-status {
    text-align: center;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.quantity-status.loading {
    color: #f59e0b;
}

.quantity-status.success {
    color: #10b981;
}

.quantity-status.error {
    color: #ef4444;
}

/* Адаптивность для результатов поиска */
@media (max-width: 767px) {
    .product-details {
        padding: 0.75rem;
    }

    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .detail-row .value {
        text-align: left;
    }

    /* Адаптивность для управления количеством */
    .quantity-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .quantity-input {
        max-width: 100%;
    }

    .quantity-controls {
        gap: 1rem;
    }
}

/* Красный цвет для нулевого количества */
.quantity-zero {
    color: #ef4444 !important;
    font-weight: bold;
}

