/* GPT Comment Agent Styles */

/* 플로팅 버튼 */
.gpt-comment-agent-floating {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.gpt-agent-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    text-decoration: none;
}

.gpt-agent-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.gpt-agent-btn:active {
    transform: translateY(0);
}

.gpt-agent-icon {
    font-size: 18px;
    line-height: 1;
}

.gpt-agent-text {
    white-space: nowrap;
}

/* 팝업 오버레이 */
.gpt-comment-agent-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.gpt-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.gpt-popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: gpt-popup-slide-in 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes gpt-popup-slide-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 팝업 헤더 */
.gpt-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
}

.gpt-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.gpt-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.gpt-popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 팝업 컨텐츠 */
.gpt-popup-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* 컨텍스트 패널 */
.gpt-context-panel {
    width: 40%;
    padding: 25px;
    border-right: 1px solid #e1e5e9;
    overflow-y: auto;
    background: #f8f9fa;
    min-height: 0;
    flex-shrink: 0;
}

.gpt-context-panel h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.gpt-post-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
}

.gpt-post-info > div {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.gpt-post-info > div:last-child {
    margin-bottom: 0;
}

.gpt-post-info strong {
    color: #555;
    font-weight: 600;
}

.gpt-recent-comments {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    font-size: 14px;
    line-height: 1.4;
}

.gpt-loading {
    text-align: center;
    color: #666;
    font-style: italic;
}

/* 채팅 패널 */
.gpt-chat-panel {
    width: 60%;
    padding: 25px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.gpt-prompt-templates {
    margin-bottom: 20px;
}

.gpt-template-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.gpt-template-btn {
    padding: 8px 12px;
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    color: #5f6368;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.gpt-template-btn:hover {
    background: #e8eaed;
    border-color: #c4c7c5;
}

.gpt-template-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 채팅 입력 */
.gpt-chat-input {
    margin-bottom: 20px;
}

.gpt-chat-input textarea {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s ease;
    overflow-y: auto;
    box-sizing: border-box;
}

.gpt-chat-input textarea:focus {
    outline: none;
    border-color: #667eea;
}

.gpt-generate-btn {
    margin-top: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.gpt-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.gpt-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 채팅 응답 */
.gpt-chat-response {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-top: 20px;
}

.gpt-response-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.gpt-response-textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    font-family: inherit;
    resize: vertical;
    background: white;
    color: #333;
    box-sizing: border-box;
    margin: 15px 0;
}

.gpt-response-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.gpt-response-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.gpt-edit-note {
    color: #666;
    font-style: italic;
    font-size: 12px;
    margin-top: 5px;
}

.gpt-insert-btn {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.gpt-insert-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .gpt-popup-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .gpt-popup-content {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }
    
    .gpt-context-panel,
    .gpt-chat-panel {
        width: 100%;
    }
    
    .gpt-context-panel {
        border-right: none;
        border-bottom: 1px solid #e1e5e9;
    }
    
    .gpt-comment-agent-floating {
        bottom: 20px;
        right: 20px;
    }
    
    .gpt-agent-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .gpt-agent-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .gpt-popup-container {
        width: 98%;
        margin: 10px;
    }
    
    .gpt-popup-header {
        padding: 15px 20px;
    }
    
    .gpt-popup-header h3 {
        font-size: 18px;
    }
    
    .gpt-context-panel,
    .gpt-chat-panel {
        padding: 20px;
    }
    
    .gpt-template-buttons {
        flex-direction: column;
    }
    
    .gpt-template-btn {
        text-align: center;
    }
}

/* 로딩 애니메이션 */
.gpt-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: gpt-spin 1s linear infinite;
}

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

/* 에러 메시지 */
.gpt-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 10px 0;
}

/* 성공 메시지 */
.gpt-success {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
    margin: 10px 0;
}

/* 툴팁 */
.gpt-tooltip {
    position: relative;
    display: inline-block;
}

.gpt-tooltip .gpt-tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
}

.gpt-tooltip:hover .gpt-tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 디버깅 정보 스타일 */
.gpt-debug-section {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin: 15px 0;
    padding: 15px;
}

.gpt-debug-section h5 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.gpt-debug-content {
    font-size: 12px;
    line-height: 1.4;
}

.gpt-debug-content > div {
    margin-bottom: 8px;
}

.gpt-debug-content strong {
    color: #555;
    font-weight: 600;
}

.gpt-debug-content pre {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 8px;
    margin: 5px 0;
    font-size: 11px;
    line-height: 1.3;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 댓글 아이템 스타일 */
.gpt-comment-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.gpt-comment-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.gpt-comment-author {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.gpt-comment-content {
    color: #555;
    margin-bottom: 5px;
}

.gpt-comment-date {
    font-size: 12px;
    color: #888;
    font-style: italic;
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .gpt-popup-container {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .gpt-context-panel {
        background: #2d2d2d;
        border-right-color: #404040;
    }
    
    .gpt-post-info,
    .gpt-recent-comments,
    .gpt-response-content {
        background: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    .gpt-chat-input textarea {
        background: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    .gpt-response-text {
        background: #2d2d2d;
        color: #ffffff;
    }
    
    .gpt-debug-section {
        background: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    .gpt-debug-content pre {
        background: #1a1a1a;
        border-color: #404040;
        color: #ffffff;
    }
    
    .gpt-comment-item {
        border-bottom-color: #404040;
    }
    
    .gpt-comment-author {
        color: #ffffff;
    }
    
    .gpt-comment-content {
        color: #cccccc;
    }
    
    .gpt-comment-date {
        color: #aaaaaa;
    }
}
