/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.app-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Search Section */
.search-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-button, .clear-button, .action-button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-button {
    background: #667eea;
    color: white;
}

.search-button:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.clear-button {
    background: #6c757d;
    color: white;
}

.clear-button:hover {
    background: #5a6268;
}

.search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-button {
    background: #28a745;
    color: white;
}

.action-button:hover {
    background: #218838;
    transform: translateY(-1px);
}

.action-button.secondary {
    background: #6c757d;
}

.action-button.secondary:hover {
    background: #5a6268;
}

/* Loading Indicator */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    text-align: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Results Summary */
.results-summary {
    background: white;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    color: #495057;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #495057;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 10px;
}

.empty-state .hint {
    font-style: italic;
    color: #8A8A8A;
}

/* Product Cards */
.products-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.product-header {
    display: grid;
    grid-template-columns: 60px 1fr auto auto;
    align-items: center;
    padding: 20px;
    gap: 15px;
    cursor: pointer;
    background: #f8f9fa;
    transition: background-color 0.3s ease;
}

.product-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-header:hover {
    background: #e9ecef;
}

.product-info h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 600;
}

.product-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: #6c757d;
}

.ean {
    font-weight: 600;
    color: #495057;
}

.brand {
    color: #667eea;
    font-weight: 500;
}

.product-stats {
    text-align: right;
    margin-right: 15px;
}

.price-range {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.price-label {
    color: #6c757d;
    font-weight: 500;
}

.price-values {
    font-weight: 700;
    color: #28a745;
}

.uom-info {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.uom-label {
    color: #6c757d;
    font-weight: 500;
}

.uom-values {
    font-weight: 700;
    color: #17a2b8;
}

.proposal-count {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
}

.expand-icon {
    font-size: 1.2rem;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.product-card.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Proposals Container */
.proposals-container {
    border-top: 1px solid #e9ecef;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 2000px; }
}

.proposals-header {
    padding: 15px 20px;
    background: #f1f3f4;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.proposals-list {
    display: flex;
    flex-direction: column;
}

/* Proposal Rows */
.proposal-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.proposal-row:hover {
    background: #f8f9fa;
}

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

.image-placeholder {
    width: 48px;
    height: 48px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #adb5bd;
}

.proposal-vendor {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.proposal-hash {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #8A8A8A;
    word-break: break-all;
    margin-bottom: 2px;
}

.vendor-id {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.vendor-title {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 2px;
}

.proposal-file {
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 500;
    word-break: break-all;
}

.proposal-pricing, .proposal-quantities {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.proposal-pricing label, .proposal-quantities label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.proposal-pricing span, .proposal-quantities span {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.price-per-unit span, .total-price span {
    color: #28a745;
}

.original-price span {
    color: #dc3545;
}

/* Messages */
.error-message, .success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.error-message {
    background: #dc3545;
}

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

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.close-error, .close-success {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .search-actions {
        justify-content: center;
    }
    
    .product-header {
        grid-template-columns: 60px 1fr;
        gap: 15px;
        text-align: left;
    }
    
    .product-stats {
        text-align: left;
        margin-right: 0;
        grid-column: 2;
    }
    
    .expand-icon {
        grid-column: 2;
        justify-self: end;
        align-self: start;
    }
    
    .proposal-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px 15px;
    }
    
    .proposal-row > div {
        padding: 8px 0;
        border-bottom: 1px solid #f8f9fa;
    }
    
    .proposal-row > div:last-child {
        border-bottom: none;
    }
    
    .error-message, .success-message {
        position: static;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .search-section {
        padding: 15px;
    }
    
    .product-header {
        padding: 15px;
    }
    
    .proposals-header, .proposal-row {
        padding: 10px 15px;
    }
}