/* 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: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.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;
    max-width: 600px;
    margin: 0 auto;
}

.main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Chat Interface */
.chat-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    background: #f5f5f5;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    position: relative;
}

.message.user .message-content {
    background: #667eea;
    color: white;
}

.message.assistant .message-content {
    background: #f8f9fa;
}

.message h3 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.message ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message li {
    margin-bottom: 0.25rem;
}

/* Recommendations */
.recommendations {
    margin-top: 1rem;
}

.recommendation-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.recommendation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.rec-title {
    font-weight: 600;
    color: #333;
    font-size: 1.05rem;
}

.rec-genre {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.rec-artist {
    color: #666;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.rec-reasoning {
    color: #555;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.rec-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 0.75rem;
}

.similarity-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.score-bar {
    width: 100px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s;
}

.discovery-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.discovery-familiar { background: #d4edda; color: #155724; }
.discovery-moderate { background: #fff3cd; color: #856404; }
.discovery-adventurous { background: #f8d7da; color: #721c24; }

/* Input Form */
.input-form {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 1.5rem;
}

.input-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
}

#user-input:focus {
    outline: none;
    border-color: #667eea;
}

#send-button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 80px;
    justify-content: center;
}

#send-button:hover:not(:disabled) {
    background: #5a67d8;
}

#send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading Spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.preferences-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 1.5rem;
}

.preferences-panel h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.preference-section {
    margin-bottom: 1.5rem;
}

.preference-section h4 {
    color: #555;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #f0f0f0;
    color: #333;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid #e0e0e0;
}

.secondary-button {
    width: 100%;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-button:hover {
    background: #e9ecef;
    border-color: #667eea;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 20px 40px 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;
}

.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.close-button:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

/* History Items */
.history-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.history-date {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.history-input {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.history-recommendations {
    font-size: 0.9rem;
    color: #555;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chat-container {
        height: 500px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
    
    .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    #send-button {
        margin-top: 0.5rem;
    }
}

/* Smooth scrolling for messages */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}