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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    margin-bottom: 10px;
}

header p {
    color: #666;
}

.scanner-section {
    margin-bottom: 30px;
}

#scanner-container {
    text-align: center;
    margin-bottom: 20px;
}

#qr-reader {
    margin: 0 auto 20px;
    max-width: 100%;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #e2e8f0;
    color: #333;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.divider {
    text-align: center;
    margin: 20px 0;
    color: #999;
    font-weight: 500;
}

.manual-entry {
    display: flex;
    gap: 10px;
}

#barcode-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
}

.result-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

#product-info {
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
}

.location-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

#location-select {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
}

.status-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.status-message.success {
    background: #c6f6d5;
    color: #276749;
    display: block;
}

.status-message.error {
    background: #fed7d7;
    color: #9b2c2c;
    display: block;
}

.recent-scans ul {
    list-style: none;
}

.recent-scans li {
    padding: 10px;
    background: #f7fafc;
    margin-bottom: 8px;
    border-radius: 6px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-body {
    padding: 20px;
}

.add-location {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    align-items: center;
}

.location-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
}

.location-info {
    flex: 1;
}

.location-name {
    font-weight: bold;
    color: #333;
}

.location-types {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.location-actions {
    display: flex;
    gap: 5px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

/* Photo capture interface styles */
.btn-large {
    padding: 20px 40px;
    font-size: 20px;
    width: 100%;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* AI results grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.item-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.item-card:hover {
    border-color: #4a90e2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.item-card h4 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

.item-card p {
    margin: 8px 0;
    color: #666;
}

.item-card input,
.item-card select {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

.item-card select {
    width: 100%;
    margin-top: 5px;
}

/* Photo preview styles */
#photo-preview {
    text-align: center;
}

#preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Galaxy Fold specific optimizations */
@media (max-width: 768px) {
    .btn-large {
        padding: 15px 30px;
        font-size: 18px;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .item-card {
        padding: 12px;
    }
}

/* Status message improvements */
.status-message.info {
    background: #bee3f8;
    color: #2c5282;
    display: block;
}

/* Loading spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* AI Reasoning Box */
.ai-reasoning-box {
    margin-top: 30px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
}

.ai-reasoning-box summary {
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    padding: 10px;
    background: #e5e7eb;
    border-radius: 4px;
    user-select: none;
}

.ai-reasoning-box summary:hover {
    background: #d1d5db;
}

.reasoning-content {
    margin-top: 15px;
    padding: 10px;
}

.reasoning-item {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.reasoning-item h4 {
    margin: 0 0 10px 0;
    color: #1f2937;
    font-size: 16px;
}

.reasoning-item ul {
    margin: 0;
    padding-left: 20px;
}

.reasoning-item li {
    margin: 8px 0;
    color: #4b5563;
    line-height: 1.6;
}

.reasoning-item strong {
    color: #1f2937;
}

/* Verification Badge */
.verification-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
}

.verification-badge.verified {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}