/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    height: calc(100vh - 200px);
}

/* Chat container */
.chat-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 20px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message .message-content {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 5px;
}

.message-content i {
    font-size: 1.2rem;
    margin-top: 2px;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

.message-content ul {
    margin: 10px 0 0 20px;
}

.message-content li {
    margin-bottom: 5px;
}

/* Card meaning response */
.card-meaning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
}

.card-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #856404;
    margin-bottom: 10px;
}

.card-summary {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    font-style: italic;
}

.interpretations {
    margin: 15px 0;
}

.interpretation-type {
    font-weight: bold;
    color: #495057;
    margin: 10px 0 5px 0;
}

.interpretation-item {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin: 5px 0;
    border-left: 3px solid #667eea;
}

.interpretation-source {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.interpretation-content {
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Keywords */
.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
}

.keyword-tag {
    background: #e9ecef;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Related cards */
.related-cards {
    margin: 15px 0;
}

.related-cards h4 {
    color: #495057;
    margin-bottom: 10px;
}

.related-card {
    display: inline-block;
    background: #f8f9fa;
    padding: 5px 10px;
    margin: 2px;
    border-radius: 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.related-card:hover {
    background: #e9ecef;
}

/* Chat input */
.chat-input-container {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#queryInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#queryInput:focus {
    border-color: #667eea;
}

.send-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-btn {
    background: white;
    border: 1px solid #e9ecef;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.quick-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.sidebar-section h3 {
    margin-bottom: 15px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stats */
.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #6c757d;
}

.stat-value {
    font-weight: bold;
    color: #495057;
}

/* Cards list */
.card-search {
    margin-bottom: 15px;
}

#cardSearch {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
}

.cards-list {
    max-height: 300px;
    overflow-y: auto;
}

.card-item {
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.card-item:hover {
    background: #f8f9fa;
}

.card-item.major {
    border-left: 3px solid #dc3545;
}

.card-item.minor {
    border-left: 3px solid #28a745;
}

.card-name {
    font-weight: 500;
}

.card-suit {
    color: #6c757d;
    font-size: 0.8rem;
}

/* Loading */
.loading {
    text-align: center;
    color: #6c757d;
    padding: 20px;
}

/* Error messages */
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

/* Success messages */
.success {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .sidebar {
        order: -1;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .message-content {
        max-width: 95%;
    }
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease-out;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar,
.cards-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.cards-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb,
.cards-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.cards-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
