/* Reset and base styles */
* {
    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: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

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

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Sections */
section {
    background: white;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

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

section h2 {
    color: #4a5568;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

/* Form elements */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group small {
    color: #718096;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Tag containers */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

.tag {
    padding: 8px 16px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    user-select: none;
}

.tag:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.tag.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tag.selected:hover {
    background: #5a67d8;
    border-color: #5a67d8;
}

/* Search container */
.search-container {
    margin-bottom: 1rem;
}

#demographic-search {
    max-width: 400px;
}

/* Selected tags */
.selected-tags h3 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem 0;
    color: #4a5568;
}

.selected-lifestyle,
.selected-demographic {
    margin-bottom: 1rem;
}

#selected-lifestyle-tags,
#selected-demographic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e0;
}

.selected-tag {
    background: #48bb78;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.selected-tag .remove-tag {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.selected-tag .remove-tag:hover {
    opacity: 1;
}

/* Generate button */
.generate-section {
    text-align: center;
}

.generate-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(72, 187, 120, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Progress bar */
.progress-container {
    margin: 2rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38a169);
    width: 0%;
    transition: width 0.5s ease;
}

#progress-text {
    text-align: center;
    color: #4a5568;
    font-weight: 500;
}

/* Results */
.result-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.result-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.result-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-generating {
    background: #fef5e7;
    color: #d69e2e;
}

.status-reviewing {
    background: #e6fffa;
    color: #319795;
}

.status-approved {
    background: #f0fff4;
    color: #38a169;
}

.status-rejected {
    background: #fed7d7;
    color: #e53e3e;
}

.result-content {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

.result-review {
    background: #fffbf0;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #d69e2e;
    font-size: 0.95rem;
}

.review-score {
    font-weight: 600;
    color: #d69e2e;
    margin-bottom: 0.5rem;
}

.review-feedback {
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.final-ranking {
    background: #f0fff4;
    border: 2px solid #48bb78;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
}

.final-ranking h3 {
    color: #38a169;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
}

.ranked-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #48bb78;
    position: relative;
}

.rank-number {
    position: absolute;
    top: -8px;
    left: 12px;
    background: #48bb78;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    .tag-container {
        gap: 8px;
    }
    
    .tag {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
}