* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
}

body {
    font-family: 'NanumSquare', sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    line-height: 1.6;
}

.container {
    width: 100vw;
    min-height: 100vh;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    padding-top: 0;
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 0;
    position: relative;
    top: 0;
}

.logo {
    max-width: 320px;
    width: 30vw;
    min-width: 200px;
    height: auto;
    transition: max-width 0.5s, width 0.5s, margin 0.5s;
}

.chat-interface {
    background: #2d2d2d;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-top: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    transition: margin-top 0.5s;
    left: unset;
    transform: unset;
    width: 100%;
}

/* 메시지 영역 스크롤 개선 */
.messages {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: calc(100vh - 140px); /* 채팅 인터페이스 높이에서 입력 영역 높이를 뺀 값 */
    overflow-y: auto !important; /* 스크롤 강제 적용 */
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 20px;
    max-width: 80%;
}

.message p {
    padding: 10px 15px;
    border-radius: 15px;
    display: inline-block;
}

.message img {
    max-width: 300px;
    border-radius: 10px;
    margin-top: 10px;
}

.message.user {
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
}

.message.user p {
    background-color: #4CEDC4;
    color: #000000;
}

.message.assistant p {
    background-color: #3d3d3d;
    color: #ffffff;
}

.message.system p {
    background-color: #333333;
    color: #cccccc;
    font-style: italic;
}

.input-area {
    width: 100%;
    max-width: 700px;
    box-sizing: border-box;
    padding: 20px;
    margin: 0 auto;
    background: #333333;
    border-top: 1px solid #404040;
}

.message-form {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.file-btn {
    cursor: pointer;
    padding: 10px;
    background: #404040;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    min-width: 40px;
    min-height: 40px;
}

.file-btn:hover {
    background-color: #4d4d4d;
}

textarea {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #404040;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    min-height: 40px;
    max-height: 120px;
    background-color: #404040;
    color: #ffffff;
}

textarea::placeholder {
    color: #999999;
}

.send-btn {
    background: #4CEDC4;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.send-btn:hover {
    background-color: #3dbda3;
}

.preview-container {
    position: relative;
    margin-bottom: 10px;
    display: inline-block;
}

.preview-container img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #dc3545;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-btn:hover {
    background-color: #c82333;
}

.hidden {
    display: none;
}

.typing {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: #3d3d3d;
    border-radius: 15px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999999;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* 중앙 프롬프트만 보이는 상태 */
.initial .chat-interface,
.initial #chat-interface {
    display: none;
}
.initial .prompt-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: auto;
    animation: fadeIn 0.7s;
}

.prompt-center {
    max-width: 700px;
    width: 90vw;
    margin: 0 auto;
    box-sizing: border-box;
}

#prompt-input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    transition: box-shadow 0.4s, border-color 0.4s;
}

#prompt-form {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
}

/* 채팅 인터페이스가 나타날 때 애니메이션 및 위치 조정 */
.show-chat .chat-interface,
.chat-interface {
    display: flex;
    margin-top: 20px;
    position: relative;
    top: 0;
    max-width: 700px;
    width: 90vw;
    min-height: 60vh;
    height: calc(100vh - 40px); /* 전체 높이에서 약간의 마진만 제외 */
    flex-direction: column;
    margin: 0 auto;
}

/* 채팅 화면에서 로고 영역 숨기기 */
.show-chat .prompt-center {
    display: none !important;
}

/* 로고 컨테이너 숨기기 */
.logo-container.hide {
    display: none !important;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 채팅창과 입력창 길이, 정렬, 말풍선 위치 수정 */
#prompt-input, .chat-interface, .prompt-center {
    max-width: 700px;
}

/* 채팅창 중앙정렬 */
.container, .chat-interface, .prompt-center {
    align-items: center;
}

/* 채팅 말풍선 좌/우 정렬 */
.message.assistant {
    align-self: flex-start;
    margin-right: auto;
    margin-left: 0;
}

/* 채팅 인터페이스 슬라이드 업 애니메이션 */
.show-chat .chat-interface {
    animation: slideUp 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

/* 채팅 인터페이스가 나타날 때 애니메이션 및 위치 조정 */
.show-chat .container {
    justify-content: flex-start;
    padding-top: 20px; /* 패딩 줄임 */
    transition: all 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

.container.show-chat {
    align-items: center;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 에러 메시지 스타일 */
.error-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #dc3545;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* 비활성화된 버튼 스타일 */
.send-btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.send-btn:disabled svg path {
  stroke: #666666;
}

.show-chat .logo-container {
    display: none !important;
}

/* 스크롤바 디자인 커스텀 */
::-webkit-scrollbar {
    width: 10px;
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #b0b0b0;
    border-radius: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

/* 파이어폭스용 */
* {
    scrollbar-width: thin;
    scrollbar-color: #b0b0b0 #1a1a1a;
}

.container,
.prompt-center,
.chat-interface {
    max-width: 700px;
    width: 90vw;
    margin: 0 auto;
    box-sizing: border-box;
}

#prompt-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#prompt-input:focus,
#prompt-input:hover {
    box-shadow: 0 0 0 2px #4CEDC4;
    border: 1px solid #4CEDC4;
    outline: none;
}