/* Google-style minimal design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fafafa;
    color: #202124;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 32px;
    font-weight: 400;
    color: #1a73e8;
    margin-bottom: 8px;
}

.header p {
    color: #5f6368;
    font-size: 16px;
}

/* Suggestions */
.suggestions {
    margin-bottom: 40px;
}

.suggestions h2 {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 20px;
    color: #202124;
}

/* Custom Input Section */
.custom-input-section {
    margin-bottom: 24px;
}

.custom-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#customTopicInput {
    flex: 1;
    min-height: 48px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    background: #fff;
}

#customTopicInput:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.custom-start-btn {
    padding: 12px 24px;
    height: 48px;
    border: none;
    border-radius: 8px;
    background: #1a73e8;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.custom-start-btn:hover:not(:disabled) {
    background: #1557b0;
}

.custom-start-btn:disabled {
    background: #dadce0;
    cursor: not-allowed;
}

/* Divider */
.divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #dadce0;
    z-index: 1;
}

.divider span {
    background: #fafafa;
    padding: 0 20px;
    color: #5f6368;
    font-size: 14px;
    position: relative;
    z-index: 2;
}

.suggestion-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.suggestion-btn {
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}

.suggestion-btn:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.suggestion-btn:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #dadce0;
    overflow: hidden;
}

.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
    min-height: 300px;
}

/* Message animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.message.fade-in {
    animation: fadeInUp 0.5s ease-out;
}

.message.thinking .message-content {
    background: #f8f9fa;
    border: 1px dashed #dadce0;
    color: #5f6368;
    font-style: italic;
}

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

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Markdown styling within messages */
.message-content strong {
    font-weight: 600;
}

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

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.message.user .message-content code {
    background: rgba(255, 255, 255, 0.2);
}

/* Headers in messages */
.message-content h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 12px 0 8px 0;
    line-height: 1.2;
}

.message-content h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 10px 0 6px 0;
    line-height: 1.2;
}

.message-content h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 8px 0 4px 0;
    line-height: 1.2;
}

.message-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 6px 0 2px 0;
    line-height: 1.2;
}

.message-content h5 {
    font-size: 13px;
    font-weight: 600;
    margin: 4px 0 2px 0;
    line-height: 1.2;
}

.message-content h6 {
    font-size: 12px;
    font-weight: 600;
    margin: 4px 0 2px 0;
    line-height: 1.2;
    opacity: 0.8;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    list-style-type: disc;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: currentColor;
    opacity: 0.8;
}

.message-content a:hover {
    opacity: 1;
}

.message.user .message-content a {
    color: rgba(255, 255, 255, 0.9);
}

.message.user .message-content a:hover {
    color: white;
}

.message.user .message-content {
    background: #1a73e8;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: #f1f3f4;
    color: #202124;
    border-bottom-left-radius: 4px;
}

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

.message.user .message-avatar {
    background: #34a853;
    color: white;
}

.message.bot .message-avatar {
    background: #ea4335;
    color: white;
}



/* Input Container */
.input-container {
    padding: 20px;
    border-top: 1px solid #dadce0;
    background: #fff;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}

#messageInput {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 22px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

#messageInput:focus {
    border-color: #1a73e8;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #1a73e8;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    background: #1557b0;
}

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

.new-debate-btn {
    padding: 8px 16px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    background: #fff;
    color: #1a73e8;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-debate-btn:hover {
    background: #f8f9fa;
    border-color: #1a73e8;
}

/* Inline thinking dots */
.thinking-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5f6368;
    animation: thinking-bounce 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
.thinking-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes thinking-bounce {
    0%, 80%, 100% { 
        transform: scale(0.8); 
        opacity: 0.4; 
    }
    40% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

/* Loading (keep for input disabled state) */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: #5f6368;
}

/* Warning Dialog */
.warning-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.warning-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    margin: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.warning-content h3 {
    margin: 0 0 16px 0;
    color: #ea4335;
    font-size: 18px;
    font-weight: 500;
}

.warning-content p {
    margin: 0 0 24px 0;
    color: #5f6368;
    line-height: 1.5;
}

.warning-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.warning-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.warning-btn.cancel {
    background: #fff;
    border: 1px solid #dadce0;
    color: #3c4043;
}

.warning-btn.cancel:hover {
    background: #f8f9fa;
}

.warning-btn.confirm {
    background: #ea4335;
    border: 1px solid #ea4335;
    color: white;
}

.warning-btn.confirm:hover {
    background: #d33b2c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    .suggestion-buttons {
        grid-template-columns: 1fr;
    }
    
    .custom-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .custom-start-btn {
        height: auto;
        padding: 12px;
    }
    
    .messages {
        max-height: 50vh;
        min-height: 250px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .input-container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 24px;
    }
    
    .messages {
        padding: 16px;
        max-height: 45vh;
    }
    
    .message-content {
        max-width: 90%;
        font-size: 13px;
    }
    
    .input-wrapper {
        gap: 8px;
    }
    
    #messageInput {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}