/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    height: 100vh;
    max-width: 100vw;
    overflow: hidden;
}

/* 사이드바 스타일 */
.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header h2 {
    color: #1976d2;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.api-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.api-info strong {
    color: #1976d2;
}

.settings {
    margin-bottom: 20px;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

.setting-item small {
    display: block;
    color: #666;
    margin-left: 20px;
    font-size: 0.8em;
}

.tools-section, .authorized-tools-section {
    margin-bottom: 20px;
}

.tools-section h3, .authorized-tools-section h3 {
    color: #1976d2;
    margin-bottom: 10px;
    font-size: 1em;
}

.tools-list, .authorized-tools {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.tool-item {
    padding: 8px;
    margin-bottom: 5px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #ddd;
    font-size: 0.9em;
}

.tool-item.authorized {
    border-left-color: #4caf50;
}

.tool-item.locked {
    border-left-color: #ff9800;
}

.tool-name {
    font-weight: 600;
    color: #1976d2;
}

.tool-description {
    color: #666;
    font-size: 0.8em;
    margin-top: 2px;
}

.authorized-tool {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

.authorized-tool:last-child {
    border-bottom: none;
}

.remove-tool {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.8em;
}

.remove-tool:hover {
    background: #d32f2f;
}

.reset-btn {
    width: 100%;
    padding: 8px 12px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: #f57c00;
}

.loading, .no-tools {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    padding: 10px;
}

/* 메인 채팅 영역 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.chat-header {
    background: #1976d2;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-header h1 {
    font-size: 1.5em;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.connection-status i {
    color: #4caf50;
    animation: pulse 2s infinite;
}

.connection-status.disconnected i {
    color: #f44336;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.welcome-message p {
    margin-bottom: 10px;
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
}

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

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

.message.user .message-avatar {
    background: #1976d2;
    color: white;
}

.message.assistant .message-avatar {
    background: #4caf50;
    color: white;
}

.message.tool .message-avatar {
    background: #ff9800;
    color: white;
}

.message.system .message-avatar {
    background: #f44336;
    color: white;
}

.message-content {
    flex: 1;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 70%;
}

.message.user .message-content {
    background: #1976d2;
    color: white;
}

.message-content pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.9em;
    margin: 10px 0;
}

.message.user .message-content pre {
    background: rgba(255,255,255,0.1);
    color: white;
}

.tool-result {
    background: #f8f9fa;
    border-left: 4px solid #ff9800;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.tool-result-header {
    font-weight: 600;
    color: #ff9800;
    margin-bottom: 8px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

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

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 채팅 입력 영역 */
.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #1976d2;
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: #1976d2;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #1565c0;
}

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

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header {
    background: #1976d2;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
}

.tool-info p {
    margin-bottom: 10px;
}

.tool-details {
    margin-top: 15px;
}

.tool-details summary {
    cursor: pointer;
    font-weight: 600;
    padding: 5px 0;
}

.tool-details pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.9em;
    margin-top: 10px;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-allow {
    background: #4caf50;
    color: white;
}

.btn-allow:hover {
    background: #45a049;
}

.btn-deny {
    background: #f44336;
    color: white;
}

.btn-deny:hover {
    background: #d32f2f;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        order: 2;
    }
    
    .chat-container {
        order: 1;
        height: 60vh;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .modal-content {
        margin: 50% auto;
        width: 95%;
    }
}

/* 에러 및 경고 스타일 */
.error {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #f44336;
    margin: 10px 0;
}

.warning {
    background: #fff8e1;
    color: #f57c00;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #ff9800;
    margin: 10px 0;
}

.success {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #4caf50;
    margin: 10px 0;
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
} 