/* KilnAVP Resource Catalog Styles */

/* Search Section */
.search-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.search-header {
    text-align: center;
    margin-bottom: 2rem;
}

.search-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-header h1 i {
    color: #ffd700;
    margin-right: 0.5rem;
}

.search-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.search-controls {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 1rem;
    align-items: end;
    max-width: 1000px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .search-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.search-input-group {
    display: flex;
    flex-direction: column;
}

.search-input-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.search-dropdown {
    min-width: 250px;
}

.form-select, .form-input {
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.95);
    color: #333;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: #ffd700;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

/* Results Section */
.results-section {
    margin-bottom: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.results-info {
    font-weight: 500;
    color: #555;
}

.selected-count {
    background: #28a745;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 1rem;
}

.results-actions {
    display: flex;
    gap: 0.5rem;
}

/* Product Search Bar */
.product-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.search-input-container {
    position: relative;
    flex: 1;
    max-width: 500px;
    transition: all 0.3s ease;
}

.search-input-container .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.search-bar {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
}

.search-bar:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-bar::placeholder {
    color: #999;
    font-style: italic;
}

/* Active search state */
.search-input-container.search-active {
    transform: scale(1.02);
}

.search-input-container.search-active .search-icon {
    color: #667eea;
    animation: pulse 2s infinite;
}

.search-input-container.search-active .search-bar {
    border-color: #667eea;
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
}

/* Search button results state */
#searchBtn.search-results {
    background: #28a745;
    border-color: #28a745;
    animation: fadeIn 0.3s ease;
}

#searchBtn.search-results:hover {
    background: #218838;
    border-color: #1e7e34;
}

/* Mutual exclusivity visual feedback */
.filter-group.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.filter-group.disabled .form-select {
    background-color: #f8f9fa;
    color: #6c757d;
}

.search-input-group.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.search-input-group.disabled .form-select {
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Clear search button */
.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

.clear-search-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.clear-search-btn:active {
    background: #e0e0e0;
    transform: translateY(-50%) scale(0.95);
}

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Product List */
.product-list {
    margin-bottom: 2rem;
}

.product-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: auto 1fr 1fr auto auto auto;
    gap: 1rem;
    align-items: center;
}

.product-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.product-item.selected {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
    background: #f8fff8;
}

.product-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.2s ease;
}

.product-item.selected .product-checkbox {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.product-checkbox::after {
    content: '✓';
    opacity: 0;
    font-weight: bold;
    font-size: 0.8rem;
    transition: opacity 0.2s ease;
}

.product-item.selected .product-checkbox::after {
    opacity: 1;
}

.product-main-info {
    flex-grow: 1;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.product-manufacturer {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.product-description {
    color: #777;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.product-category {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.product-fl-number {
    background: #ffd700;
    color: #333;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
}

.product-uplift {
    background: #28a745;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.product-uplift.high {
    background: #dc3545;
}

.product-uplift.medium {
    background: #ffc107;
    color: #333;
}

.product-uplift.none {
    background: #6c757d;
    opacity: 0.6;
}

.fl-number {
    background: #ffd700;
    color: #333;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
}

.uplift-value {
    background: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: bold;
}

.uplift-value.high {
    background: #dc3545;
}

.uplift-value.medium {
    background: #ffc107;
    color: #333;
}

/* Selected Products Panel */
.selected-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #667eea;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 1000;
    transform: translateY(calc(100% - 60px));
    transition: transform 0.3s ease;
}

.selected-panel.open {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #667eea;
    color: white;
    cursor: pointer;
}

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
}

.panel-content {
    padding: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.selected-products-list {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.selected-product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.selected-product-info {
    flex-grow: 1;
}

.selected-product-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.selected-product-details {
    font-size: 0.85rem;
    color: #666;
}

.remove-selected {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-selected:hover {
    background: #c82333;
}

.panel-actions {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Loading and Empty States */
.loading-state, .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #555;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    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: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.export-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.export-preview {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.export-preview h4 {
    margin: 0 0 0.75rem 0;
    color: #555;
    font-size: 0.9rem;
}

.preview-content {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #666;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #ddd;
}

/* Button Variants */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-icon {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .results-actions {
        justify-content: center;
    }
    
    .selected-panel {
        transform: translateY(calc(100% - 50px));
    }
    
    .panel-header {
        padding: 0.75rem 1rem;
    }
    
    .panel-header h3 {
        font-size: 0.9rem;
    }
}

/* Admin Modal Specific Styles */
#adminModal .modal-content {
    max-width: 400px;
    width: 90%;
}

#adminModal .input-group {
    margin-bottom: 20px;
}

#adminModal .input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

#adminModal .input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#adminModal .input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#adminModal .admin-submit-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

#adminModal .admin-submit-btn:hover {
    background: #5a6fd8;
}

#passwordError {
    background: #ffeaea;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Sticky Header Styles */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    border-bottom: 2px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.sticky-header:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sticky-header .results-header {
    margin: 0;
    padding: 0 1rem;
}