/* Main stylesheet - Chat Interface */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: hsl(0 0% 100%);
    min-height: 100vh;
}

.chat-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    max-height: 800px;
    background: white;
    border: 1px solid hsl(214.3 31.8% 91.4%);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 20px auto;
}

.chat-header {
    padding: 24px 28px;
    background: hsl(222.2 47.4% 11.2%);
    color: white;
    border-bottom: 1px solid hsl(214.3 31.8% 91.4%);
    text-align: center;
}

.chat-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.chat-header .subtitle {
    margin: 8px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

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

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

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

.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
    width: 100%;
    max-width: 700px;
}

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

.bot-message {
    flex-direction: row;
    justify-content: flex-end;
}

.user-message {
    flex-direction: row;
    justify-content: flex-start;
}

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

.bot-message .message-avatar {
    background: hsl(222.2 47.4% 11.2%);
    color: white;
}

.user-message .message-avatar {
    background: #e9ecef;
    color: #495057;
}

.message-content {
    flex: 1;
    max-width: 75%;
    display: flex;
    flex-direction: column;
}

.bot-message .message-content {
    align-items: flex-end;
    text-align: right;
}

.user-message .message-content {
    align-items: flex-start;
    text-align: left;
}

.message-text {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 0.95rem;
}

.bot-message .message-text {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
}

.user-message .message-text {
    background: hsl(222.2 47.4% 11.2%);
    color: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 4px;
    padding: 0 4px;
}

.chat-input-container {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: center;
}

.chat-form {
    width: 100%;
    max-width: 700px;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 8px 8px 16px;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s;
    justify-content: center;
}

.input-wrapper:focus-within {
    border-color: hsl(222.2 47.4% 11.2%);
}

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.95rem;
    font-family: inherit;
    color: #333;
    padding: 8px 0;
    max-height: 120px;
    overflow-y: auto;
    outline: none;
}

.message-input::placeholder {
    color: #adb5bd;
}

.send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: hsl(222.2 47.4% 11.2%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.send-button:active:not(:disabled) {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading indicator */
.message.loading .message-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.message.loading .message-text::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.4s ease-in-out infinite;
}

.message.loading .message-text::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.4s ease-in-out infinite 0.2s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* File Upload Styles */
.file-upload-container {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    width: 100%;
}

.file-upload-section h4 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    color: #495057;
    font-weight: 600;
}

.file-upload-item {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-upload-item:last-child {
    margin-bottom: 0;
}

.file-upload-item label {
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

.file-upload-item input[type="file"] {
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-upload-item input[type="file"]:hover {
    border-color: hsl(222.2 47.4% 11.2%);
}

.file-upload-item input[type="file"]:focus {
    outline: none;
    border-color: hsl(222.2 47.4% 11.2%);
    box-shadow: 0 0 0 3px hsl(222.2 47.4% 11.2% / 0.1);
}

.file-status {
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.file-status.uploading {
    color: hsl(222.2 47.4% 11.2%);
    background: hsl(222.2 47.4% 11.2% / 0.1);
}

.file-status.success {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.file-status.error {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.file-upload-note {
    margin: 12px 0 0 0;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* Download Link Styles */
.download-link {
    color: hsl(222.2 47.4% 11.2%);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.download-link:hover {
    color: hsl(222.2 47.4% 20%);
    text-decoration: none;
}

.download-link:visited {
    color: hsl(222.2 47.4% 20%);
}

/* Agent Selection Screen Styles */
.agent-selection-container {
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    margin: 0 auto;
}

.agent-selection-header {
    text-align: center;
    margin-bottom: 60px;
}

.agent-selection-header h1 {
    margin: 0;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: hsl(222.2 47.4% 11.2%);
}

.agent-selection-header .subtitle {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 400;
    color: hsl(215.4 16.3% 46.9%);
}

.agent-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 800px;
}

.agent-card {
    background: hsl(0 0% 100%);
    border: 1px solid hsl(214.3 31.8% 91.4%);
    border-radius: 0.5rem;
    padding: 32px 24px;
    text-decoration: none;
    color: hsl(222.2 84% 4.9%);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.agent-card:hover {
    border-color: hsl(222.2 84% 4.9% / 0.5);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.agent-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 0.5rem;
    background: hsl(222.2 47.4% 11.2%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.agent-card:hover .agent-card-icon {
    opacity: 0.9;
}

.agent-card h2 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(222.2 84% 4.9%);
}

.agent-card p {
    margin: 0;
    font-size: 0.875rem;
    color: hsl(215.4 16.3% 46.9%);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .agent-selection-header h1 {
        font-size: 2rem;
    }

    .agent-selection-header .subtitle {
        font-size: 1rem;
    }

    .agent-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .agent-card {
        padding: 24px 20px;
    }
}

/* Coldmail 전용 스타일 */
.mail-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
}

.mail-header h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.mail-subject {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-size: 14px;
}

.mail-content {
    margin-bottom: 15px;
    font-size: 14px;
}

.mail-body {
    background: white;
    padding: 15px;
    border-radius: 4px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.mail-sources {
    margin-bottom: 15px;
    font-size: 14px;
}

.mail-sources ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.mail-sources li {
    margin-bottom: 5px;
}

.mail-sources a {
    color: hsl(222.2 47.4% 11.2%);
    text-decoration: none;
}

.mail-sources a:hover {
    text-decoration: underline;
}

.mail-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.copy-btn {
    background: hsl(222.2 47.4% 11.2%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.copy-btn:hover {
    opacity: 0.9;
}

.copy-btn:active {
    opacity: 0.8;
}

/* Company News 전용 스타일 */
.news-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
}

.news-summary {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

.news-summary h1 {
    font-size: 22px;
    color: #333;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid hsl(222.2 47.4% 11.2%);
}

.news-summary h2 {
    font-size: 18px;
    color: #444;
    margin: 20px 0 12px 0;
    font-weight: 600;
}

.news-summary h3 {
    font-size: 16px;
    color: #555;
    margin: 16px 0 10px 0;
    font-weight: 600;
}

.news-summary ul {
    margin: 10px 0;
    padding-left: 20px;
}

.news-summary li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.news-summary strong {
    color: #333;
    font-weight: 600;
}

.news-summary a {
    color: #2196F3;
    text-decoration: none;
    transition: color 0.2s;
}

.news-summary a:hover {
    color: #1976D2;
    text-decoration: underline;
}

.news-sources {
    margin-top: 20px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 0.5rem;
    border-left: 4px solid hsl(222.2 47.4% 11.2%);
}

.news-sources strong {
    color: #333;
    font-size: 15px;
}

.news-sources ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
    list-style-type: none;
}

.news-sources li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 0;
}

.news-sources li::before {
    content: "📎";
    position: absolute;
    left: -20px;
}

.news-sources a {
    color: #2196F3;
    text-decoration: none;
    transition: color 0.2s;
}

.news-sources a:hover {
    color: #1976D2;
    text-decoration: underline;
}
