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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

.search-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
}

#thresholdValue {
    display: inline-block;
    margin-left: 1rem;
    font-weight: bold;
    color: #667eea;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    width: 100%;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.loading {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.results-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.results-section h2 {
    margin-bottom: 1.5rem;
    color: #333;
    border-bottom: 2px solid #e1e5e9;
    padding-bottom: 0.5rem;
}

.result-card {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.result-card.expanded {
    background: #f8f9fa;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.similarity-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.result-details {
    margin-top: 1rem;
    display: none;
}

.result-card.expanded .result-details {
    display: block;
}

.detail-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e1e5e9;
}

.detail-label {
    font-weight: 600;
    color: #666;
}

.detail-value {
    color: #333;
}

.error {
    background: #fee;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0;
    color: #721c24;
}

.hidden {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .result-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

/* New styles for resources functionality */
.result-summary {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.result-actions {
    margin: 1rem 0;
    text-align: center;
}

.resources-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    width: auto;
    display: inline-block;
}

.resources-btn:hover {
    transform: translateY(-1px);
}

.resources-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.resources-section {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e1e5e9;
}

.resources-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e1e5e9;
}

.resources-header h4 {
    margin: 0;
    color: #333;
}

.resources-count {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.resources-table {
    max-height: 400px;
    overflow-y: auto;
}

.resource-row {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e1e5e9;
}

.resource-row:last-child {
    margin-bottom: 0;
}

.resource-info {
    margin-bottom: 0.5rem;
}

.resource-details {
    font-size: 0.8rem;
    color: #666;
}

.no-results {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Resource categorization styles */
.resource-view-toggle {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e1e5e9;
}

.resource-view-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.resource-view-toggle input[type="radio"] {
    margin: 0;
}

.resource-category {
    margin-bottom: 1.5rem;
}

.category-header {
    margin: 0 0 0.75rem 0;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
}

.ui-category {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

.api-category {
    background: #e8f5e8;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.infra-category {
    background: #fff3e0;
    color: #ef6c00;
    border-left: 4px solid #ff9800;
}

.raw-category {
    background: #f5f5f5;
    color: #424242;
    border-left: 4px solid #9e9e9e;
}

.resource-card {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e1e5e9;
}

.resource-card:last-child {
    margin-bottom: 0;
}

.resource-main-info {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.resource-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: #666;
}

.ui-framework-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ui-framework-badge.adf {
    background: #2196f3;
    color: white;
}

.ui-framework-badge.redwood {
    background: #d32f2f;
    color: white;
}

.ess-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #9c27b0;
    color: white;
    margin-left: 0.5rem;
}

.resource-meta {
    font-size: 0.8rem;
    color: #666;
}

.raw-resource {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
}

.raw-resource code {
    background: none;
    padding: 0;
    color: #333;
    word-break: break-all;
}

/* Table-based resource view */
.resource-table-container {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.resource-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.resource-table th {
    background: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e1e5e9;
    color: #555;
}

.resource-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e1e5e9;
    vertical-align: top;
}

.resource-table tr:hover {
    background: #f8f9fa;
}

.resource-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive table */
@media (max-width: 768px) {
    .resource-table {
        font-size: 0.8rem;
    }
    
    .resource-table th,
    .resource-table td {
        padding: 0.5rem;
    }
    
    .resource-table-container {
        font-size: 0.8rem;
    }
}
