/* 리서치 관련 CSS 스타일 */

/* 리서치 작성 컨테이너 */
.research-write-container {
    max-width: 600px;
    margin: 0;
    padding: 0px;
    background-color: #1e1e1e;
    color: #e2e2e2;
    font-size: 15px;
    min-height: 100vh;
}

/* 임시저장 완료 안내 문구 */
.temp-save-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #2a2a2a;
    color: #e2e2e2;
    padding: 16px 24px;
    border-radius: 8px;
    border: 1px solid #404040;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.temp-save-notification.show {
    opacity: 1;
}

.temp-save-notification.hide {
    opacity: 0;
}

.research-write-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #e2e2e2;
    font-size: 18px;
    font-weight: 600;
}

/* 수정 모드일 때 제목 색상 변경 */
.research-write-container.edit-mode h1 {
    color: #4ade80;
}

/* 리서치 폼 */
.research-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 폼 그룹 */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #e2e2e2;
    font-size: 15px;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid #404040;
    border-radius: 8px;
    background-color: #2a2a2a;
    color: #e2e2e2;
    font-size: 15px;
    transition: border-color 0.3s ease;
    resize: vertical;
    min-height: 50px;
}

.form-group textarea {
    font-family: inherit;
    line-height: 1.5;
}

.form-group textarea#updateSummary {
    min-height: 150px; /* 업데이트 요약만 더 길게 */
    line-height: 1.6;
}

.form-group textarea::-webkit-scrollbar {
    width: 8px;
}

.form-group textarea::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.form-group textarea::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 4px;
}

.form-group textarea::-webkit-scrollbar-thumb:hover {
    background: #505050;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e1e03f;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #888;
}

/* 날짜 그룹 */
.date-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-group label {
    font-weight: 600;
    color: #e2e2e2;
    font-size: 15px;
}

.date-group input {
    padding: 12px;
    border: 2px solid #404040;
    border-radius: 8px;
    background-color: #2a2a2a;
    color: #e2e2e2;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.date-group input:focus {
    outline: none;
    border-color: #e1e03f;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

/* 도움말 텍스트 */
.help-text {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* 버튼 그룹 */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #404040;
}

/* 버튼 스타일 */
.cancel-btn,
.temp-save-btn,
.save-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    flex: 1;
}

.cancel-btn {
    background-color: #404040;
    color: #e2e2e2;
}

.cancel-btn:hover {
    background-color: #505050;
}

.temp-save-btn {
    background-color: #404040;
    color: #fff;
}

.temp-save-btn:hover {
    background-color: #505050;
}

.save-btn {
    background-color: #e1e03f;
    color: #1e1e1e;
}

.save-btn:hover {
    background-color: #bbba33;
}

/* TinyMCE 에디터 커스터마이징 */
.tox-tinymce {
    border: 2px solid #404040 !important;
    border-radius: 8px !important;
}

.tox .tox-toolbar {
    background-color: #2a2a2a !important;
    border-bottom: 1px solid #404040 !important;
}

.tox .tox-tbtn {
    background-color: #2a2a2a !important;
    color: #e2e2e2 !important;
}

.tox .tox-tbtn:hover {
    background-color: #404040 !important;
}

.tox .tox-edit-area {
    background-color: #2a2a2a !important;
}

.tox .tox-edit-area__iframe {
    background-color: #2a2a2a !important;
}

/* 테이블 캡션 스타일 */
.tox .tox-edit-area__iframe body caption {
    display: block !important;
    caption-side: bottom !important; /* 하단 캡션만 사용 */
    text-align: left !important;
    font-weight: normal !important;
    color: #e2e2e2 !important;
    margin-top: 1px !important;
    margin-bottom: 0 !important;
    padding: 1px !important;
    background-color: #353535 !important;
    border-radius: 4px !important;
    border: 1px solid #505050 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}

/* 하단 캡션 전용 스타일 */
.tox .tox-edit-area__iframe body caption.bottom {
    caption-side: bottom !important;
    margin-top: 1px !important;
    margin-bottom: 0 !important;
    background-color: #353535 !important;
    border-color: #505050 !important;
}

.tox .tox-edit-area__iframe body caption:focus {
    outline: 2px solid #e1e03f !important;
    outline-offset: 2px !important;
}

/* 테이블 캡션 편집 시 스타일 */
.tox .tox-edit-area__iframe body caption[contenteditable="true"]:hover {
    background-color: #505050 !important;
    cursor: text !important;
}

/* TinyMCE 경고 알림 숨기기 */
.tox .tox-notification--warning {
    display: none !important;
}

.tox .tox-notification__body {
    display: none !important;
}

/* 리서치 페이지 컨테이너 */
.research-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #1e1e1e;
    color: #e2e2e2;
    font-size: 15px;
    min-height: 100vh;
}

.research-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #e2e2e2;
    font-size: 24px;
    font-weight: 600;
}

.research-content {
    text-align: center;
    line-height: 1.6;
}

.research-content p {
    margin-bottom: 15px;
    color: #e2e2e2;
}

/* 임시저장 데이터 선택 팝업 */
.temp-data-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.temp-data-popup {
    background-color: #1e1e1e;
    border: 2px solid #404040;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.temp-data-popup h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #e2e2e2;
    font-size: 20px;
    font-weight: 600;
}

.temp-data-list {
    margin-bottom: 25px;
    max-height: 300px;
    overflow-y: auto;
}

.temp-data-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #2a2a2a;
    border: 1px solid #404040;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.temp-data-item:hover {
    background-color: #353535;
    border-color: #505050;
}

.temp-data-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.temp-data-item input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
}

.temp-data-item label {
    flex: 1;
    cursor: pointer;
}

/* 삭제 버튼 스타일 */
.delete-btn {
    background-color: #e1e03f;
    color: 1e1e1e;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 15px;
    flex-shrink: 0;
}

.delete-btn:hover {
    background-color: #a2a12b;
    transform: scale(1.1);
}

.delete-btn:active {
    transform: scale(0.95);
}

.delete-icon {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

.temp-data-title {
    font-weight: 600;
    color: #e2e2e2;
    font-size: 16px;
    margin-bottom: 5px;
}

.temp-data-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #888;
}

.stock-name {
    background-color: #404040;
    padding: 4px 8px;
    border-radius: 4px;
    color: #e2e2e2;
}

.created-date {
    color: #aaa;
}

.popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

.popup-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    flex: 1;
    max-width: 120px;
}

.popup-buttons .cancel-btn {
    background-color: #404040;
    color: #e2e2e2;
}

.popup-buttons .cancel-btn:hover {
    background-color: #505050;
}

.popup-buttons .confirm-btn {
    background-color: #e1e03f;
    color: #1e1e1e;
}

.popup-buttons .confirm-btn:hover {
    background-color: #bbba33;
}

.popup-buttons .new-btn {
    background-color: #e1e03f;
    color: #1e1e1e;
}

.popup-buttons .new-btn:hover {
    background-color: #bbba33;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .research-write-container,
    .research-container {
        padding: 15px;
        margin: 0;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .cancel-btn,
    .temp-save-btn,
    .save-btn {
        width: 100%;
        min-width: auto;
    }
}

/* 입력 필드 포커스 효과 */
.form-group input:focus,
.form-group textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.2);
}

/* 버튼 활성화 효과 */
.cancel-btn:active,
.temp-save-btn:active,
.save-btn:active {
    transform: translateY(1px);
}

/* 로딩 상태 */
.form-group input:disabled,
.form-group textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 에러 상태 */
.form-group input.error,
.form-group textarea.error {
    border-color: #ff3b30;
}

.form-group .error-message {
    color: #ff3b30;
    font-size: 13px;
    margin-top: 4px;
}

/* TinyMCE 에디터 컨테이너 */
.tiny-editor-container {
    border: 2px solid #404040;
    border-radius: 8px;
    overflow: hidden;
}

.tiny-editor-container:focus-within {
    border-color: #e1e03f;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

/* 링크 스타일 */
.tox .tox-edit-area__iframe body a {
    color: #4a9eff;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.tox .tox-edit-area__iframe body a:hover {
    color: #66b3ff;
    text-decoration: underline;
}

.tox .tox-edit-area__iframe body a:visited {
    color: #8a5cf6;
}

.tox .tox-edit-area__iframe body a.external-link {
    color: #10b981;
    font-weight: 500;
}

.tox .tox-edit-area__iframe body a.external-link::after {
    content: " ↗";
    font-size: 12px;
    opacity: 0.7;
}

.tox .tox-edit-area__iframe body a.internal-link {
    color: #f59e0b;
    font-weight: 500;
}

.tox .tox-edit-area__iframe body a.button-link {
    display: inline-block;
    padding: 6px 12px;
    background-color: #4a9eff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.tox .tox-edit-area__iframe body a.button-link:hover {
    background-color: #66b3ff;
    text-decoration: none;
}

/* 링크 도구 모음 스타일 */
.tox .tox-toolbar__group:has(.tox-tbtn[aria-label="Insert/edit link"]) {
    border-right: 1px solid #404040;
    margin-right: 8px;
    padding-right: 8px;
}

.tox .tox-tbtn[aria-label="Insert/edit link"] {
    background-color: #4a9eff !important;
    color: white !important;
}

.tox .tox-tbtn[aria-label="Insert/edit link"]:hover {
    background-color: #66b3ff !important;
}

.tox .tox-tbtn[aria-label="Remove link"] {
    background-color: #ef4444 !important;
    color: white !important;
}

.tox .tox-tbtn[aria-label="Remove link"]:hover {
    background-color: #f87171 !important;
}