/* Header Link Icon */
.google-vision-link {
    display: inline-block;
    vertical-align: middle;
}

.google-vision-link .google-vision-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.google-vision-link .google-vision-search-btn:hover {
    opacity: 0.7;
}

.google-vision-link .google-vision-search-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.google-vision-link .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.google-vision-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.google-vision-modal .modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.google-vision-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.google-vision-modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.google-vision-modal .modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.google-vision-modal .modal-body {
    padding: 20px;
}

.google-vision-modal .upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.google-vision-modal .upload-area.dragover {
    border-color: #333;
    background: #f9f9f9;
}

.google-vision-modal .upload-icon {
    margin-bottom: 15px;
    color: #999;
}

.google-vision-modal .upload-area p {
    margin-bottom: 15px;
    color: #666;
}

.google-vision-modal .upload-area button {
    margin: 5px;
}

.google-vision-modal .preview-area {
    text-align: center;
    padding: 20px 0;
}

.google-vision-modal .preview-area img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.google-vision-modal .camera-area {
    text-align: center;
}

.google-vision-modal .camera-area video {
    width: 100%;
    max-height: 300px;
    border-radius: 4px;
    margin-bottom: 15px;
    background: #000;
}

.google-vision-modal .camera-area button {
    margin: 5px;
}

.google-vision-modal .loading-area {
    text-align: center;
    padding: 40px 20px;
}

.google-vision-modal .loader {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

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

.google-vision-modal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.google-vision-modal .modal-footer .search-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* Results Panel */
.google-vision-results {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    overflow-y: auto;
}

.google-vision-results .results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
}

.google-vision-results .results-header h3 {
    margin: 0;
}

.google-vision-results .close-results {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.google-vision-results .detected-attributes {
    padding: 15px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.google-vision-results .detected-attributes p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.google-vision-results .products-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.google-vision-results .product-item {
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.google-vision-results .product-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.google-vision-results .product-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.google-vision-results .product-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.google-vision-results .product-info {
    padding: 10px;
}

.google-vision-results .product-info h4 {
    margin: 0 0 5px;
    font-size: 14px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.google-vision-results .product-info .price {
    font-weight: bold;
    color: #333;
}

.google-vision-results .no-results {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

/* Body states */
body.vision-modal-open,
body.vision-results-open {
    overflow: hidden;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .google-vision-search-btn .vision-text {
        display: none;
    }
    
    .google-vision-results {
        width: 100%;
    }
    
    .google-vision-results .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
