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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 50%, #ddd6fe 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.section {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Login Section */
.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    margin: 0 auto;
}

.login-card h1 {
    color: #333;
    margin-bottom: 8px;
    font-size: 28px;
    text-align: center;
}

.subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Chat Section */
.chat-header {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
    border-radius: 16px 16px 0 0;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.chat-header h2 {
    color: white;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.session-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#sessionIdDisplay {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.chat-container {
    background: white;
    border-radius: 0 0 16px 16px;
    height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
    color: white;
}

.message-assistant .message-avatar {
    background: #f0f0f0;
    color: #666;
}

.message-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.5;
}

.message-user .message-content {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.message-assistant .message-content {
    background: #ffffff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* Formatting styles for assistant messages */
.message-assistant .message-content p {
    margin: 0 0 10px 0;
    line-height: 1.7;
    color: #374151;
}

.message-assistant .message-content p:first-child {
    margin-top: 0;
}

.message-assistant .message-content p:last-child {
    margin-bottom: 0;
}

.message-assistant .message-content strong {
    font-weight: 600;
    color: #111827;
}

.message-assistant .message-content ol {
    margin: 12px 0 16px 0;
    padding-left: 28px;
    list-style-type: decimal;
    color: #374151;
}

.message-assistant .message-content ol li {
    margin: 10px 0;
    padding-left: 6px;
    line-height: 1.7;
    color: #374151;
}

.message-assistant .message-content ol li strong {
    color: #111827;
    font-weight: 600;
}

.message-assistant .message-content ul {
    margin: 12px 0 16px 0;
    padding-left: 28px;
    list-style-type: disc;
    color: #374151;
}

.message-assistant .message-content ul li {
    margin: 10px 0;
    padding-left: 6px;
    line-height: 1.7;
    color: #374151;
}

.message-assistant .message-content br {
    line-height: 1.6;
}

/* Welcome Guide / System Message */
.message-system {
    margin-bottom: 28px;
    animation: fadeIn 0.5s ease-in;
    display: flex;
    justify-content: flex-start;
}

.message-system .message-content {
    background: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 32px 36px;
    max-width: 95%;
    font-size: 14px;
    line-height: 1.8;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.message-system .message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
}

.message-system .message-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
    padding-left: 4px;
}

.message-system .message-content p {
    margin: 14px 0;
    color: #4a5568;
}

.message-system .message-content p:first-of-type {
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 500;
    color: #2d3748;
    font-size: 15px;
}

.message-system .message-content .category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 16px 0 20px 0;
}

.message-system .message-content .category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-radius: 10px;
    border: 1px solid #e9d5ff;
    transition: all 0.2s ease;
}

.message-system .message-content .category-item:hover {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    border-color: #c084fc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.15);
}

.message-system .message-content .category-item .icon {
    font-size: 11px;
    font-weight: 700;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.message-system .message-content ul {
    margin: 14px 0 20px 0;
    padding-left: 0;
    list-style: none;
}

.message-system .message-content ul li {
    margin: 12px 0;
    padding-left: 32px;
    position: relative;
    color: #4a5568;
    line-height: 1.7;
}

.message-system .message-content ul li::before {
    content: "◆";
    position: absolute;
    left: 0;
    color: #8b5cf6;
    font-weight: bold;
    font-size: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-radius: 4px;
}

.message-system .message-content strong {
    color: #1a202c;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 15px;
    letter-spacing: -0.2px;
}

.message-system .message-content strong:first-of-type {
    margin-top: 0;
}

.message-system .message-content .note-box {
    margin-top: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    color: #78350f;
    font-size: 13px;
    line-height: 1.6;
}

.message-system .message-content .note-box strong {
    color: #c05621;
    margin: 0;
    font-size: 13px;
    display: inline;
}

.message-user {
    flex-direction: row-reverse;
}

.chat-input-container {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
}

#chatForm {
    display: flex;
    gap: 12px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

#messageInput:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 50%, #a855f7 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

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

.btn-secondary {
    background: #f0f0f0;
    color: #666;
    padding: 8px 16px;
    font-size: 12px;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Error Message */
.error-message {
    margin-top: 15px;
    padding: 12px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Loading Indicator */
.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .session-info {
        width: 100%;
        justify-content: space-between;
    }

    .message-content {
        max-width: 85%;
    }

    .message-system .message-content {
        padding: 24px 20px;
        max-width: 100%;
        border-radius: 16px;
    }

    .message-system .message-content h3 {
        font-size: 18px;
    }

    .message-system .message-content .category-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .message-system .message-content .category-item {
        padding: 10px 14px;
        font-size: 13px;
    }

    .chat-container {
        height: calc(100vh - 100px);
    }
}

