/* Root Variables */
:root {
    --primary-color: #000000;
    --secondary-color: #FFD700;
    --accent-color: #4A90E2;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-light: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --success-color: #4CAF50;
    --error-color: #f44336;
}

/* Reset & 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: var(--text-primary);
    background-color: var(--bg-light);
}

/* Header */
.header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header .container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
    font-family: 'Georgia', serif;
}

.header-title {
    font-size: 1.2rem;
    color: white;
}

.header-search {
    margin-left: auto;
    flex: 0 0 400px;
}

.header-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
}

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

/* Main Content */
.main-content {
    padding: 3rem 0;
}

/* Intro Section */
.intro-section {
    text-align: center;
    margin-bottom: 3rem;
}

.intro-section h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.intro-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.card h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* Form Styles */
.input-card {
    max-width: 800px;
    margin: 0 auto 2rem;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    width: 100%;
    margin-top: 1rem;
}

.btn-primary:hover {
    background-color: #3a7bc8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--text-primary);
}

#stopButton:hover {
    background-color: #bd2130 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Loader */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Progress Section */
.progress-card {
    max-width: 800px;
    margin: 2rem auto;
}

.progress-bar-container {
    width: 100%;
    height: 30px;
    background-color: var(--bg-light);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--success-color));
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-message {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

.progress-logs {
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--bg-light);
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.progress-logs .log-entry {
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

/* Results Page */
.results-title {
    text-align: center;
    margin-bottom: 3rem;
}

.results-title h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.results-title p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Cluster Cards */
.clusters-section {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.cluster-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cluster-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.cluster-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.cluster-title {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.cluster-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    background-color: var(--bg-light);
    border-radius: 20px;
}

.cluster-description {
    padding: 2rem;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
    background-color: #fafafa;
}

.cluster-description p {
    margin-bottom: 1rem;
}

.cluster-image {
    padding: 0;
}

.cluster-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
}

.no-results h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Action Section */
.action-section {
    text-align: center;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .intro-section h1,
    .results-title h1 {
        font-size: 2rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .cluster-title {
        font-size: 1.5rem;
    }

    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .header-search {
        width: 100%;
        flex: 1;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
