body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #222222;
    color: #ececec;
    display: flex;
    font-family: '-apple-system-font', 'Malgun Gothic';
    font-size: 10pt;
    overflow-y: hidden;
}

body,
div,
span,
input,
textarea,
form,
pre,
code {
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -ms-box-sizing: border-box;
    box-sizing: border-box;
    scrollbar-color: #424242 transparent;
}

/* 사이드바 스타일 */
.sidebar {
    width: 260px;
    height: 100vh;
    max-height: 100vh;
    padding: 70px 0 0 0;
    background-color: #171717;
    border-right: 1px solid #212121;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: left 0.3s ease;
    visibility: visible;
    will-change: auto;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* 스크롤 가능하도록 설정 */
}

/* 사이드바 내부 스크롤 영역 설정 */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    padding-bottom: 20px;
    /* 푸터와의 간격 */
    -webkit-overflow-scrolling: touch;
    /* iOS에서 부드러운 스크롤 */
}

/* iOS Safari에서 100vh 문제 해결을 위한 추가 스타일 */
@supports (-webkit-touch-callout: none) {
    .sidebar {
        height: -webkit-fill-available;
        max-height: -webkit-fill-available;
    }

    body,
    html {
        height: 100%;
        overflow: hidden;
    }

    .chat-container {
        height: 100%;
        overflow: hidden;
    }
}

/* 홈 화면에 추가된 앱 모드 감지 */
@media (display-mode: standalone),
(display-mode: fullscreen) {
    .sidebar-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 260px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0));
        z-index: 1001;
        transition: left 0.3s ease;
        /* 사이드바와 동일한 트랜지션 추가 */
    }

    .sidebar-content {
        padding-bottom: 150px;
        /* 푸터 높이만큼 여백 추가 */
    }
}

/* 앱 모드에서 사이드바 숨김 시 푸터도 함께 이동 - 모든 화면 크기에 적용 */
body.sidebar-hidden .sidebar-footer {
    left: -260px !important;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

.settings-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90%;
    padding: 0;
    background-color: #1a1a1a;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow: hidden;
    max-height: 80vh;
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* 애니메이션 제거 */

#settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
}

.settings-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #222;
}

.settings-header h3 {
    margin: 0;
    font-size: 18px;
    color: #ececec;
    font-weight: 600;
}

.close-settings-btn {
    background: none;
    border: none;
    color: #ececec;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-settings-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ff5555;
    transform: rotate(90deg);
}

.settings-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #ececec;
    font-weight: 500;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.api-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.api-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background-color: #252525;
    transition: all 0.2s ease;
}

.api-item:hover {
    background-color: #2a2a2a;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.api-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.api-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.api-input-group {
    flex-grow: 1;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.save-btn {
    padding: 8px 16px;
    background-color: #4b4b4b;
    color: #ececec;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.save-btn:hover {
    background-color: #5a5a5a;
}


.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #212121;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    bottom: 0;
    z-index: 10;
    transition: left 0.3s ease;
    /* 사이드바와 동일한 트랜지션 추가 */
}

.settings-button,
.logout-button,
.shortcuts-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #ececec;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s;
}

.settings-button:hover,
.logout-button:hover,
.shortcuts-button:hover {
    background-color: #2a2a2a;
}

.logout-button {
    color: #ff7070;
}

.user-info {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #252525;
    border-radius: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #4b4b4b;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #ececec;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #ececec;
}

/* 채팅 목록 스타일 */
.chat-list {
    margin-top: 20px;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background-color: #252525;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
    /* 내용이 넘치지 않도록 설정 */
}

.chat-item:hover {
    background-color: #2a2a2a;
}

.chat-item.active {
    background-color: #3a3a3a;
    border-left: 3px solid #4b8bf4;
}

.chat-link {
    flex: 1;
    color: inherit;
    min-width: 0;
    /* flex 아이템이 내용에 따라 축소될 수 있도록 설정 */
    overflow: hidden;
    /* 내용이 넘치지 않도록 설정 */
}

.chat-title {
    font-size: 14px;
    font-weight: 500;
    color: #ececec;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    /* 최대 너비 지정 */
}

.chat-date {
    font-size: 11px;
    color: #909090;
}

.chat-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    /* 버튼 영역이 축소되지 않도록 설정 */
}

.edit-chat-btn {
    background: none;
    border: none;
    color: #909090;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.edit-chat-btn:hover {
    color: #ececec;
    background-color: #333;
}

/* 대화 편집 모달 스타일 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #ececec;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    background: #333;
    color: #ececec;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #ececec;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

#save-chat-btn {
    padding: 10px 20px;
    background-color: #4b4b4b;
    color: #ececec;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

#save-chat-btn:hover {
    background-color: #5a5a5a;
}

.hidden {
    display: none !important;
}

.sidebar-fixed .sidebar {
    position: fixed;
    top: 0;
    left: 0;
}

.sidebar input,
.settings-container input[type="password"],
.settings-container input[id*="api-key"] {
    -webkit-text-security: disc;
    width: 100%;
    padding: 12px 35px 12px 15px;
    margin: 5px 0 0;
    background: #2f2f2f;
    color: #ececec;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.settings-container input:not([type="password"]):not([id*="api-key"]) {
    width: 100%;
    padding: 12px 35px 12px 15px;
    margin: 5px 0 0;
    background: #333;
    color: #ececec;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.settings-container input {
    background: #333;
}

.sidebar input:focus,
.settings-container input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
    background: #383838;
}

.visible-text {
    -webkit-text-security: none !important;
}

/* 헤더 버튼 컨테이너 스타일 */
.header-buttons {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    z-index: 10001;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    transition: background 0.3s ease;
}

/* iPhone에서 버튼 간격 조정 */
@media screen and (max-width: 480px) {
    .header-buttons {
        gap: 5px;
    }

    .header-buttons button {
        margin: 0;
        padding: 5px 10px;
    }
}

/* 사이드바 토글 버튼 스타일 */
.toggle-sidebar {
    background: none;
    border: none;
    color: #ECECF1;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.toggle-sidebar:focus {
    outline: none;
}

.create {
    background: none;
    border: none;
    color: #ECECF1;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    /* 포커스 아웃라인 제거 */
}

.create:focus {
    outline: none;
    /* 포커스 시 아웃라인 제거 */
}

.search-button {
    background: none;
    border: none;
    color: #ECECF1;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.search-button:focus {
    outline: none;
}

/* 채팅 컨테이너 스타일 */
.chat-container {
    width: calc(100% - 260px);
    height: 100vh;
    margin-left: 260px;
    background-color: rgb(34, 34, 34);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, margin-left 0.3s ease, padding-top 0.3s ease;
}

@supports (height: 100dvh) {
    .chat-container {
        height: 100dvh;
    }
}

.sidebar-hidden .chat-container {
    width: 100%;
    margin-left: 0;
    padding-top: 60px;
}

.sidebar-hidden .sidebar {
    left: -260px;
}

/* 채팅 메시지 영역 스타일 */
.chat-messages {
    flex-grow: 1;
    padding: 0 0 20px 0;
    overflow-y: auto;
    scrollbar-color: #424242 transparent;
}

/* 메시지 공통 스타일 */
.message {
    display: flex;
    align-items: flex-start;
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 30px;
}

.message .ai_info_box {
    padding: 16px;
}

.message-content {
    max-width: 100%;
    padding: 0 16px;
    word-wrap: break-word;
    line-height: 1.6;
    border-radius: 15px;
}

/* 사용자 메시지 스타일 */
.message.user {
    justify-content: flex-end;
}

.message.user .message-content {
    padding: 12px 16px !important;
    background-color: #323232d9;
    color: white;
    border-radius: 15px 15px 0 15px;
}

/* 챗봇 메시지 스타일 */
.message.assistant {
    flex-direction: column;
    width: 100%;
}

.image-container {
    position: relative;
    display: inline-block;
    margin-right: 5px;
    /* Add some spacing between images */
}

.image-container img {
    max-width: 100px;
    max-height: 100px;
}

.close-button {
    position: absolute;
    top: -3px;
    right: -3px;
    background-color: #202020;
    color: white;
    font-size: 12px;
    width: 15px;
    height: 15px;
    line-height: 15px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 100px
}

.message.assistant .message-content {
    color: #ECECF1;
    border-radius: 15px 15px 15px 0;
    width: 100%;
    background-color: transparent;
    /* assistant message background transparent */
}

/* 요약 메시지 스타일 */
.message.assistant.summary {
    background-color: rgba(75, 75, 75, 0.2);
    border-radius: 10px;
    margin-bottom: 20px;
    padding: 15px;
}

.summary-header {
    font-weight: bold;
    margin-bottom: 10px;
    color: #b0b0b0;
}

.summary-content {
    color: #d0d0d0;
}


/* 입력 컨테이너 스타일 */
.input-container {
    display: flex;
    justify-content: center;
    flex-direction: column;
    width: 90%;
    max-width: 720px;
    margin: 0 auto 20px auto;
    padding: 10px;
    background-color: rgb(47, 47, 47);
    border-radius: 30px;
    cursor: text;
    position: relative;
}

.input-wrapper {
    width: 100%;
    max-width: 800px;
    position: relative;
}

#user-input {
    width: 100%;
    padding: 12px;
    background-color: rgb(47, 47, 47);
    color: #ECECF1;
    border: none;
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    cursor: text;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    min-height: 45px;
}

/* 전송 버튼 스타일 */
#send-button {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    right: 0;
    bottom: 0;
    width: 34px;
    height: 34px;
    padding: 0;
    transform: translateY(0%);
    background: white;
    border-radius: 100px;
    border: none;
    color: black;
    font-size: 34px;
    cursor: pointer;
}

#send-button:hover {
    opacity: .5;
}

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

/* 타이핑 표시 스타일 */
.typing-indicator {
    display: inline-block;
    position: absolute;
    top: 100px;
    /* Adjust position if needed */
    left: 46px;
    /* Adjust position if needed */
}

.dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 0;
    background-color: #909090;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.dot:nth-child(1) {
    animation-delay: 200ms;
}

.dot:nth-child(2) {
    animation-delay: 300ms;
}

.dot:nth-child(3) {
    animation-delay: 400ms;
}

@keyframes typing {
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* API 라벨 스타일 */
.api_label {
    font-size: 10pt;
    display: flex;
    align-items: center;
    gap: 5px;
}

.api_label a {
    background: #4b4b4b;
    color: white;
    border-radius: 5px;
    padding: 2px 5px;
    font-size: 8pt;
}

.api_label a:hover {
    background: #2f2f2f;
}

/* AI 정보 박스 스타일 */
.ai_info_box {
    display: flex;
    align-items: center;
}

.ai_info_box .logoimg {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border: 2px solid #3d3d3d;
    border-radius: 100px;
    background: white;
}

.anthropic_img img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 100px;
}

.model_change .anthropic_img img {
    width: 24px !important;
    height: 24px !important;
    border-radius: 100px;
}

.ai_info_box .logoimg img {
    width: 24px;
    height: 24px;
    border-radius: 100px;
}

.ai_info {
    margin-left: 10px;
    font-size: 8pt;
    font-weight: bold;
    line-height: 1;
}

.ai_company {
    font-weight: bold;
}

.ai_model {
    color: #909090;
}

.model_change .ai_model {
    width: 90px;
    white-space: nowrap;
    overflow: hidden;
}

/* 모델 변경 버튼 스타일 */
.model_change {
    display: inline-block;
    margin: 10px 0 0 0;
    padding: 5px 8px;
    background: #4b4b4b;
    border-radius: 20px;
    font-size: 8pt;
    cursor: pointer;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model_change:hover {
    background: #555;
}

/* input-bottom container 스타일 */
.input-bottom {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 모델 선택 박스 스타일 */
.model_select_box {
    position: absolute;
    z-index: 2;
    width: calc(100% + 4px);
    padding: 20px;
    inset: auto auto calc(100% + 12px) -2px;
    background: #2f2f2f;
    border-radius: 20px;
    font-size: 10pt;
}

#model_list {
    max-height: 50dvh;
    padding-top: 10px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

#model_list.no-models {
    display: block;
    grid-template-columns: none;
    gap: 0;
}

.model_select_info {
    padding: 0 0 10px 5px;
    border-bottom: 1px solid #4b4b4b;
    font-size: 12pt;
    font-weight: bold;
}

#model_list .ai_info_box {
    cursor: pointer;
}

#model_list .ai_info_box:hover {
    opacity: .5;
}

#model_list:focus {
    outline: none;
}

#model_list .ai_info_box:focus {
    outline: none;
}

#model_list .ai_info_box.keyboard-selected,
.chat-item.keyboard-selected {
    background-color: #4b4b4b;
    border-radius: 8px;
}

.input-bottom .logoimg {
    width: 24px;
    height: 24px;
}




/* 코드 하이라이트 스타일 */
.hljs {
    width: 100% !important;
    min-width: 100% !important;
    padding: 15px;
    background: #0d0d0d !important;
    border-radius: 10px;
    position: relative;
    white-space: pre-wrap;
}

pre,
code {
    width: 100% !important;
    min-width: 100% !important;
    position: relative;
    background: #0d0d0d !important;
}


/* 코드 복사 버튼 스타일 */
.code_copy {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px;
    background: #2f2f2f;
    color: #b4b4b4;
    border-radius: 10px;
    font-size: 8pt;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.code_copy .copy_icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}


/* Thinking box style */
.thinking_box {
    display: none;
}

.thinking_content {
    padding: 0 30px;
    position: relative;
    color: #a6a6a6;
    font-size: 8pt;
    max-height: 60px;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.thinking_content.show-all {
    max-height: none;
    overflow: visible;
}

.thinking_content:not(.show-all)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: linear-gradient(to bottom, rgba(34, 34, 34, 0), rgba(34, 34, 34, 1));
}

.thinking_hide {
    opacity: .5;
}

.thinking_time {
    margin: 0 0 0 30px;
    padding: 5px 10px;
    background: #4b4b4b;
    border-radius: 10px;
    font-size: 8pt;
    display: inline-block;
}

.thinking_time:hover {
    background: #7b7b7b;
    cursor: pointer;
}

#images {
    padding-left: 10px;
}

#images img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    position: relative;
}

/* 파일 업로드 버튼 스타일 */
.upload_file {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #4b4b4b;
    border-radius: 100px;
    border: none;
    color: white;
    font-size: 34px;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.upload_file:hover {
    opacity: .5;
}

/* 웹 검색 토글 버튼 스타일 */
.web-search-button {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    background-color: #4b4b4b;
    /* 기본 배경색 */
    border-radius: 100px;
    border: none;
    color: white;
    /* 아이콘 기본 색상 */
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: background-color 0.2s ease, color 0.2s ease;
    /* 부드러운 색상 전환 */
}

.web-search-button:hover {
    background-color: #5a5a5a;
    /* 호버 시 배경색 */
}

.web-search-button.active {
    background-color: #689fde;
    /* 활성화 시 배경색 (예: 파란색 계열) */
    color: white;
    /* 활성화 시 아이콘 색상 */
}

.web-search-button.hidden {
    display: none;
}

/* 대화 비우기 버튼 스타일 */
.clear_chat {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #4b4b4b;
    border-radius: 100px;
    border: none;
    color: white;
    font-size: 34px;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.clear_chat:hover {
    opacity: .5;
}

.upload_icon {
    width: 20px;
    color: white;
}

.file_badge {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 2;
    background: #c92e2e;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 14px;
    height: 14px;
    border-radius: 100px;
    display: none;
    font-size: 8pt;
    font-family: Arial;
}

.citations {
    display: none;
    padding: 15px;
}

.citations_info {
    display: flex;
    gap: 5px;
}

.citations_list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 10px 0 10px;
}

.citation {
    background: #3e3e3e;
    padding: 5px 10px;
    border-radius: 10px;
    transition-duration: .2s;
}

.citation:hover {
    background: #515151;
    cursor: pointer;
}

.citation a {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.citation img {
    border-radius: 100px;
    width: 18px;
    height: 18px;
    background: white;
}

/* 웹 검색 결과 스타일 (접고 펴기 기능 추가) */
.web-search-results-container {
    margin-bottom: 15px;
    background-color: #2a2a2a;
    border-radius: 10px;
    border-left: 3px solid #4b8bf4;
    overflow: hidden;
    width: 100%;
    font-size: 8pt;
}

.web-search-results-header {
    padding: 10px 15px;
    color: #ececec;
    font-size: 9pt;
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
    /* 텍스트 선택 방지 */
    border-bottom: 1px solid transparent;
    /* 닫혔을 때 경계선 없음 */
    transition: background-color 0.2s;
}

.web-search-results-header:hover {
    background-color: #333333;
}

.web-search-results-container .web-search-results-content.expanded+.web-search-results-header {
    border-bottom-color: #333;
    /* 열렸을 때 내용과 구분선 */
}


.web-search-arrow {
    margin-right: 8px;
    transition: transform 0.2s ease-in-out;
    display: inline-block;
    font-size: 10px;
    /* 화살표 크기 조정 */
    line-height: 1;
}

.web-search-results-content {
    padding: 0 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.web-search-results-content.expanded {
    max-height: 500px;
    /* 충분한 높이, 필요시 조절 */
    padding: 15px;
    border-top: 1px solid #383838;
    /* 헤더와의 구분선 */
}

.web-search-links {
    /* 이 클래스는 이제 .web-search-results-content 내부에 직접 적용되지 않음 */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.web-search-link {
    padding: 6px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.web-search-link:hover {
    background-color: #444;
}

.web-search-link a {
    color: #7ab7ff;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 검색 모달 스타일 */
#search-input {
    width: 100%;
    padding: 12px 15px;
    background: #333;
    color: #ececec;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 15px;
}

#search-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
    background: #383838;
}

.search-results {
    height: 300px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    border-radius: 10px;
    background-color: #1d1d1d;
    padding: 10px;
}

.search-result-item {
    padding: 12px 15px;
    margin-bottom: 10px;
    background-color: #252525;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background-color: #2a2a2a;
}

.search-result-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #ececec;
}

.search-result-content {
    color: #b0b0b0;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

.search-highlight {
    background-color: rgba(255, 255, 0, 0.3);
    padding: 0 2px;
    border-radius: 2px;
}

.no-results {
    text-align: center;
    padding: 20px;
    color: #909090;
}

/* 단축키 스타일 */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 5px;
}

kbd {
    display: inline-block;
    padding: 3px 6px;
    font-family: monospace;
    font-size: 12px;
    color: #ececec;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 2px 0 #222;
    min-width: 16px;
    text-align: center;
}

.shortcut-desc {
    color: #ececec;
    font-size: 14px;
}

a {
    text-decoration: none;
    color: #7ab7ff;
}

th,
td {
    border: 1px solid #505050;
    padding: 5px 10px;
}

table {
    border-collapse: collapse;
}

/* 미디어 쿼리 (반응형 디자인) */
@media (max-width: 1230px) {
    #model_list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 860px) {
    #model_list {
        grid-template-columns: repeat(2, 1fr);
    }

    .api-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        margin-left: 0;
    }

    /* 모바일 환경에서 사이드바 개선 */
    .sidebar {
        -webkit-overflow-scrolling: touch;
        /* iOS에서 부드러운 스크롤 */
        height: 100%;
        max-height: 100%;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* 모바일 환경에서 사이드바 푸터 개선 */
    .sidebar-footer {
        position: sticky;
        bottom: 0;
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0));
        /* 기본 패딩 + 안전 영역 */
        background-color: #1a1a1a;
        margin-top: auto;
        /* 푸터를 항상 하단에 배치 */
        z-index: 100;
        width: 100%;
    }

    /* 모바일 환경에서 사이드바 콘텐츠 영역 개선 */
    .sidebar-content {
        flex: 1 1 auto;
        max-height: calc(100% - 130px);
        /* 푸터 높이를 고려한 최대 높이 설정 */
    }

    /* 앱 모드에서 사이드바 푸터 개선 */
    body.app-mode .sidebar-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 260px;
        z-index: 1001;
        padding-bottom: 15px;
        transition: left 0.3s ease;
        /* 사이드바와 동일한 트랜지션 추가 */
    }

    body.app-mode.sidebar-hidden .sidebar-footer {
        left: -260px;
    }



    body.app-mode.has-safe-area .sidebar-footer {
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0));
    }
}

@media (max-width: 470px) {
    #model_list {
        grid-template-columns: repeat(1, 1fr);
    }
}

pre {
    background: black;
    border-radius: 10px;
    padding: 10px;
    font-size: 9pt;
    overflow-x: auto;
}

/* 토스트 메시지 스타일 */
.toast-message {
    position: fixed;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast-message.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Image Overlay Styles */
#image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* Darker overlay */
    display: none;
    /* Initially hidden */
    justify-content: center;
    align-items: center;
    z-index: 1000001;
    /* Ensure it's above other elements */
    cursor: pointer;
    /* Indicate clicking closes it */
}

#image-overlay.show {
    display: flex;
}

#overlay-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    /* Maintain aspect ratio */
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: default;
    /* Default cursor for the image itself */
}

#overlay-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 30px;
    color: white;
    cursor: pointer;
    line-height: 1;
}

/* Style for clickable generated images */
.generated-images img {
    cursor: pointer;
    transition: transform 0.2s ease;
    border-radius: 10px;
}

.generated-images img:hover {
    transform: scale(1.05);
    /* Slight zoom effect on hover */
}
