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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.flag-icon {
    display: inline-block;
    width: 20px;
    height: 16px;
    position: relative;
    vertical-align: middle;
    margin-right: 6px;
}
.flag-icon::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 2px;
    height: 16px;
    background: #666;
}
.flag-icon::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 0;
    width: 14px;
    height: 10px;
    background: #e74c3c;
    border-radius: 0 2px 2px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.magnifier-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: inline-block;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav a {
    color: #ddd;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.2s;
}

.nav a:hover {
    color: white;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 3px;
    background: transparent;
    border: none;
}

.menu-toggle span {
    width: 25px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s;
}

.main {
    flex: 1;
    padding: 20px 0;
    background: white;
}

.main-content {
    display: flex;
    justify-content: center;
}

.search-section {
    text-align: center;
    padding: 15px 0;
    max-width: 600px;
}

.qrcode-section {
    position: fixed;
    right: 20px;
    top: 25%;
    z-index: 9999;
}

.qrcode-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 10px;
    border: 1px solid #eee;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.qrcode-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 6px;
}

.qrcode-text {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.logo-container {
    margin-bottom: 10px;
}

.site-logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
}

.search-form {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 10px;
    max-width: 500px;
    width: 100%;
}

.search-input {
    flex: 1;
    height: 50px;
    padding: 0 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #667eea;
}

.search-btn {
    height: 50px;
    padding: 0 30px;
    font-size: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

.search-btn:hover {
    transform: translateY(-2px);
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper .search-input {
    width: 100%;
    box-sizing: border-box;
}

.scan-btn {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #667eea;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.2s;
}

.scan-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.scan-btn svg {
    width: 100%;
    height: 100%;
}

#scannerModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1001;
    justify-content: center;
    align-items: center;
}

#sliderModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

#scannerModal.show {
    display: flex;
}

.scanner-modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 95%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.scanner-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.scanner-modal-content .modal-title {
    font-size: 18px;
    font-weight: 600;
}

.scanner-modal-content .modal-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.scanner-modal-content .modal-btn:hover {
    background: rgba(255,255,255,0.3);
}

#scanner {
    width: 100%;
    height: 350px;
    overflow: hidden;
    position: relative;
    background: #000;
}

#scanner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    background: radial-gradient(transparent 35%, rgba(0,0,0,0.7) 70%);
}

.scanner-frame {
    width: 90%;
    max-width: 400px;
    height: 120px;
    border: 3px solid #22c55e;
    border-radius: 8px;
    position: relative;
    background: rgba(34, 197, 94, 0.1);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.3);
}

.scanner-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #22c55e, transparent);
    animation: scanline 2s linear infinite;
}

.scanner-frame::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 20px;
    height: 20px;
    border-top: 3px solid #22c55e;
    border-left: 3px solid #22c55e;
    border-radius: 4px 0 0 0;
}

.scanner-frame .corner-tr {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-top: 3px solid #22c55e;
    border-right: 3px solid #22c55e;
    border-radius: 0 4px 0 0;
}

.scanner-frame .corner-bl {
    position: absolute;
    bottom: -3px;
    left: -3px;
    width: 20px;
    height: 20px;
    border-bottom: 3px solid #22c55e;
    border-left: 3px solid #22c55e;
    border-radius: 0 0 0 4px;
}

.scanner-frame .corner-br {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-bottom: 3px solid #22c55e;
    border-right: 3px solid #22c55e;
    border-radius: 0 0 4px 0;
}

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

.search-tip {
    font-size: 14px;
    color: #999;
    text-align: center;
    margin-top: 10px;
}

.result-section {
    margin-top: 20px;
}

.product-card {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #eee;
    max-width: 700px;
    margin: 0 auto;
}

.product-info {
    flex: 1;
    min-width: 300px;
}

.product-image-wrapper {
    flex: 0 0 200px;
}

.product-image-box {
    width: 200px;
}

.product-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
}

.product-tip {
    width: 100%;
    padding: 10px;
    font-size: 12px;
    color: #999;
    text-align: center;
    background: #f0f0f0;
    border-radius: 4px;
    line-height: 1.6;
    margin-top: 0;
}

.product-tip-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.product-tip-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.barcode-section {
    display: flex;
    gap: 20px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
    max-width: 700px;
    margin: 20px auto 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.barcode-image-box {
    flex: 0 0 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fafafa;
    border-radius: 8px;
    padding: 15px;
}

.barcode-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.barcode-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 5px;
}

.barcode-title {
    font-size: 16px;
    font-weight: 600;
    color: #e53935;
    margin-bottom: 10px;
    margin-top: 0;
}

.barcode-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
}

.barcode-link {
    display: inline-block;
    align-self: flex-start;
    padding: 5px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: -3px;
}

.barcode-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.product-info h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
    line-height: 1.4;
}

.product-info-row {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    line-height: 1.4;
}

.product-info-label {
    width: 100px;
    color: #666;
    font-weight: 500;
}

.product-info-value {
    flex: 1;
    color: #333;
}

.history-section {
    background: #f8f9fa;
    padding: 8px 0;
    border-top: 1px solid #eee;
}

.history-content {
    display: flex;
    justify-content: center;
    padding-bottom: 3px;
}

.history-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    margin-right: 6px;
    flex-shrink: 0;
}

.history-list {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.history-item {
    display: inline-block;
    padding: 2px 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 11px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.history-item:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.history-empty {
    font-size: 13px;
    color: #999;
}

.footer {
    background: #333;
    color: white;
    padding: 12px 0;
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer a {
    color: #aaa;
    text-decoration: none;
    font-size: 12px;
}

.footer a:hover {
    color: white;
}

.copyright {
    color: #aaa;
    font-size: 12px;
}

@media (max-width: 768px) {
    .history-section {
        padding: 6px 0;
    }

    .history-content {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        text-align: center;
    }

    .history-label {
        width: 100%;
        font-size: 11px;
        text-align: center;
    }

    .history-list {
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        overflow-x: visible;
        justify-content: center;
    }

    .history-item {
        padding: 2px 6px;
        font-size: 10px;
        border-radius: 10px;
    }

    .header {
        padding: 8px 0;
    }

    .logo {
        font-size: 16px;
    }

    .magnifier-icon {
        display: none;
    }

    .container {
        padding: 0 15px;
        max-width: 100%;
        width: 100%;
    }

    .main-content {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .search-section {
        padding: 20px 0;
        width: 100%;
    }

    .qrcode-section {
        display: none;
    }

    .logo-container {
        margin-bottom: 15px;
    }

    .site-logo {
        width: 130px !important;
        height: 130px !important;
    }

    .search-form {
        margin-bottom: 20px;
        width: 100%;
    }

    .search-row {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    .scan-btn {
        display: block;
    }

    .search-input {
        width: 100% !important;
        box-sizing: border-box !important;
        height: 50px;
        font-size: 16px;
        padding: 0 15px;
        border-radius: 8px;
        border: 2px solid #ddd;
        flex: none !important;
    }

    .search-btn {
        width: 100% !important;
        box-sizing: border-box !important;
        height: 50px;
        font-size: 16px;
        border-radius: 8px;
        padding: 0 !important;
    }

    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #333;
        flex-direction: column;
        padding: 20px;
        gap: 15px;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    }

    .nav.active {
        display: flex;
    }

    .menu-toggle {
        display: flex;
    }

    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .product-card {
        flex-direction: column;
        align-items: center;
        padding: 20px;
        max-width: 100%;
        box-sizing: border-box;
        gap: 10px;
    }

    .product-info {
        width: 100%;
    }

    .product-image-wrapper {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 5px;
    }

    .product-image-box {
        width: 100%;
        max-width: 200px;
    }

    .product-image {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
    }

    .product-tip {
        width: 100%;
        margin-top: 5px;
        padding: 8px 10px;
    }

    .product-info-row {
        flex-direction: row;
        gap: 5px;
    }

    .product-info-label {
        width: auto;
        font-size: 14px;
        white-space: nowrap;
    }

    .product-info-value {
        font-size: 15px;
    }

    .barcode-section {
        flex-direction: column;
        align-items: center;
        padding: 15px;
        max-width: 100%;
    }

    .barcode-image-box {
        width: 100%;
        max-width: 180px;
        padding: 3px;
        flex: 0 0 auto;
        height: auto;
        align-items: center;
    }

    .barcode-info {
        width: 100%;
        text-align: center;
        padding: 1px 0 0 0;
    }

    .barcode-title {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .barcode-desc {
        font-size: 12px;
        line-height: 1.4;
        margin-bottom: 10px;
    }

    .barcode-link {
        align-self: center;
        padding: 4px 10px;
        font-size: 11px;
    }
}