/* Demo Page Styles - Matching Main Website Theme */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #682F7F;
    --primary-light: #9744B8;
    --primary-bg: #F7F0F9;
    --primary-hover: #ECDCF2;
    --text-color: #333;
    --text-light: #555;
    --text-muted: #666;
    --bg-color: #ffffff;
    --border-color: #e0e0e0;
    --code-bg: #f6f6f6;
    --user-bubble: #F7F0F9;
    --assistant-bubble: #f8f9fa;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f5f7;
    min-height: 100vh;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-hover);
    text-align: center;
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 16px;
    font-size: 24px;
}

.modal-content p {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 15px;
}

.modal-content .hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.modal-content .hint a {
    color: var(--primary-light);
    text-decoration: none;
}

.modal-content .hint a:hover {
    text-decoration: underline;
}

.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.input-group input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
}

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

/* Demo Container */
.demo-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.demo-header {
    text-align: center;
    padding: 20px 0 30px;
}

.back-link {
    display: inline-block;
    color: var(--primary-light);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.demo-header h1 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.demo-header .subtitle {
    color: var(--text-muted);
    font-size: 16px;
}

/* Main Content - Two Panel Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

/* Panel Base Styles */
.chat-panel,
.state-panel {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.panel-header h2 {
    font-size: 18px;
    color: var(--primary-color);
    font-weight: 600;
}

/* Chat Panel */
.chat-panel {
    min-height: 500px;
}

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

.welcome-message {
    background: linear-gradient(135deg, var(--primary-bg) 0%, #f0e6f5 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-light);
}

.welcome-message p {
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--text-color);
}

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

/* Start Prompt Box */
.start-prompt-box {
    margin-top: 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.start-prompt-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    background: var(--code-bg);
}

.start-prompt-content p {
    margin-bottom: 8px;
}

.start-prompt-content ul,
.start-prompt-content ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.start-prompt-content li {
    margin-bottom: 4px;
}

.start-prompt-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--primary-light);
    color: white;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.start-prompt-btn:hover {
    background: var(--primary-color);
}

/* Message Bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
}

.message.user .message-content {
    background: var(--user-bubble);
    color: var(--primary-color);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--assistant-bubble);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

/* Markdown content in chat messages */
.message-content p {
    margin-bottom: 8px;
}

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

.message-content ul,
.message-content ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.06);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content blockquote {
    border-left: 3px solid var(--primary-light);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-light);
}

.message-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message.user .message-label {
    text-align: right;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 15px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: var(--primary-light);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

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

.send-btn:active {
    transform: scale(0.95);
}

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

.send-btn svg {
    width: 20px;
    height: 20px;
}

/* Private State Panel */
.state-panel {
    min-height: 500px;
}

.private-state {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    transition: filter 0.3s ease;
    position: relative;
}

.private-state.blurred {
    filter: blur(8px);
    user-select: none;
}

.private-state.blurred::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    cursor: pointer;
}

.markdown-content {
    font-size: 14px;
    line-height: 1.6;
}

.markdown-content h2 {
    color: var(--primary-color);
    font-size: 16px;
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.markdown-content h2:first-child {
    margin-top: 0;
}

.markdown-content p {
    margin-bottom: 8px;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.markdown-content li {
    margin-bottom: 4px;
}

.markdown-content code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.markdown-content pre {
    background: var(--code-bg);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

/* Secret tags styling */
.secret-tag {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px dashed #856404;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0;
    font-family: monospace;
    color: #856404;
}

.state-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.blur-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.blur-hint.hidden {
    display: none;
}

/* Buttons */
.primary-btn {
    background: var(--primary-light);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

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

.primary-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-bg);
    color: var(--primary-light);
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.icon-btn {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}

.eye-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.eye-icon.hidden {
    display: none;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

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

/* Footer */
.demo-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.demo-footer code {
    background: var(--code-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}


/* Error Message */
.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin: 8px 0;
}

/* Typing indicator (WhatsApp style) */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--assistant-bubble);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
}

.typing-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-light);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .state-panel {
        order: -1;
        max-height: 250px;
    }
    
    .chat-panel {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .demo-container {
        padding: 10px;
    }
    
    .demo-header {
        padding: 15px 0 20px;
    }
    
    .demo-header h1 {
        font-size: 22px;
        line-height: 1.3;
        padding: 0 10px;
    }
    
    .demo-header .subtitle {
        font-size: 14px;
        padding: 0 10px;
    }
    
    .back-link {
        font-size: 13px;
    }
    
    .modal-content {
        padding: 24px 20px;
        width: 95%;
        max-width: 400px;
    }
    
    .modal-content h2 {
        font-size: 20px;
    }
    
    .modal-content p {
        font-size: 14px;
    }
    
    .input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .input-group input {
        width: 100%;
        padding: 12px 14px;
    }
    
    .panel-header {
        padding: 12px 16px;
    }
    
    .panel-header h2 {
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 12px;
        gap: 12px;
    }
    
    .message {
        max-width: 92%;
    }
    
    .message-content {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .message-label {
        font-size: 10px;
    }
    
    .welcome-message {
        padding: 16px;
    }
    
    .welcome-message p {
        font-size: 14px;
    }
    
    .start-prompt-content {
        padding: 12px;
        font-size: 13px;
        max-height: 150px;
    }
    
    .start-prompt-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .chat-input-container {
        padding: 12px;
        gap: 10px;
    }
    
    #chat-input {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 20px;
    }
    
    .send-btn {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }
    
    .send-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .private-state {
        padding: 16px;
    }
    
    .markdown-content {
        font-size: 13px;
    }
    
    .markdown-content h2 {
        font-size: 14px;
    }
    
    .state-footer {
        padding: 10px 16px;
    }
    
    .blur-hint {
        font-size: 11px;
    }
    
    .primary-btn {
        padding: 12px 24px;
        font-size: 15px;
        width: 100%;
    }
    
    .secondary-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .demo-footer {
        padding: 16px 10px;
        font-size: 12px;
    }
    
    .demo-footer code {
        font-size: 11px;
        display: block;
        margin-top: 4px;
        word-break: break-all;
    }
    
    .state-panel {
        max-height: 200px;
    }
    
    .chat-panel {
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    .demo-container {
        padding: 8px;
    }
    
    .demo-header h1 {
        font-size: 18px;
    }
    
    .demo-header .subtitle {
        font-size: 13px;
    }
    
    .modal-content {
        padding: 20px 16px;
    }
    
    .modal-content h2 {
        font-size: 18px;
    }
    
    .panel-header h2 {
        font-size: 15px;
    }
    
    .message-content {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .welcome-message {
        padding: 14px;
    }
    
    .welcome-message p {
        font-size: 13px;
    }
    
    .chat-input-container {
        padding: 10px;
    }
    
    #chat-input {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
    }
    
    .state-panel {
        max-height: 180px;
    }
    
    .typing-indicator {
        padding: 10px 14px;
    }
    
    .typing-dots span {
        width: 6px;
        height: 6px;
    }
}

