* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.privacy-notice {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
    color: #4a5568;
    font-size: 0.95em;
    line-height: 1.6;
}

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

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

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

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #48bb78;
    color: white;
    margin-bottom: 20px;
}

.btn-secondary:hover {
    background: #38a169;
}

.btn-analyze {
    background: #ed8936;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-analyze:hover {
    background: #dd6b20;
}

.hidden {
    display: none !important;
}

.status {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.status.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.status.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.status.info {
    background: #bee3f8;
    color: #2c5282;
    border: 1px solid #90cdf4;
}

.chats-container {
    display: grid;
    gap: 15px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s;
}

.chat-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.chat-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e2e8f0;
}

.chat-info {
    flex: 1;
}

.chat-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.chat-type {
    display: inline-block;
    padding: 4px 12px;
    background: #edf2f7;
    color: #4a5568;
    border-radius: 12px;
    font-size: 0.85em;
    text-transform: capitalize;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #718096;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #2d3748;
}

.modal-compact {
    max-width: 400px;
}

.chat-header-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.chat-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #667eea;
    margin-bottom: 12px;
}

.chat-header-modal h2 {
    margin: 0;
    font-size: 1.3em;
    color: #2d3748;
    text-align: center;
}

.modal-subtitle {
    color: #4a5568;
    font-size: 1.1em;
    margin-bottom: 15px;
    text-align: center;
}

.analysis-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-option {
    background: #f7fafc;
    color: #2d3748;
    border: 2px solid #e2e8f0;
    padding: 16px 20px;
    text-align: left;
    font-size: 15px;
}

.btn-option:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 1.1em;
}

.analysis-result {
    line-height: 1.6;
    color: #2d3748;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    color: #1a202c;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
}

.markdown-content h1 { font-size: 1.5em; }
.markdown-content h2 { font-size: 1.3em; }
.markdown-content h3 { font-size: 1.1em; }

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content ul,
.markdown-content ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.markdown-content li {
    margin-bottom: 0.5em;
}

.markdown-content strong {
    color: #1a202c;
    font-weight: 600;
}

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

.markdown-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1em;
    margin: 1em 0;
    color: #4a5568;
    background: #f7fafc;
    padding: 0.5em 1em;
    border-radius: 0 8px 8px 0;
}

.markdown-content code {
    background: #edf2f7;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1.5em 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}