/* ===== 기본 ===== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    overflow:hidden;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Noto Sans KR",
        sans-serif;
    background: #343541;
    color: #ececf1;
    height:100dvh;
    display:flex;
    flex-direction:column; /* .layout - height:calc(100dvh - 85px);대신 */
}

/* ===== 레이아웃 ===== */

.container{
    display:flex;
    flex-direction:column;
    height:100%;
    min-height:0;
}
.layout{
    display:flex;
    flex:1;
    min-height:0;
    /* height:calc(100dvh - 85px);; */
}

.content{
    flex:1;
    min-height:0;
    display:flex;
    flex-direction:column;
}

.header {
    font-family: "Orbitron", "Pretendard", sans-serif;
    letter-spacing: 1.5px;

    flex-shrink: 0;
    padding: 18px 24px;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 1.5px;

    color: #eaeaea;
    background: #0f1115;

    border-bottom: 1px solid rgba(124, 92, 255, 0.3);

    box-shadow:
        0 0 20px rgba(124, 92, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);

    position: relative;
    height:85px;
}

/* 네온 라인 */
.header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;

    height: 2px;
    width: 100%;

    background: linear-gradient(
        90deg,
        transparent,
        #7c5cff,
        #00d4ff,
        transparent
    );

    opacity: 0.8;
}

.sheader {
    /* font-family: "Orbitron", "Pretendard", sans-serif; */
    /* letter-spacing: 1.5px; */

    flex-shrink: 0;
    background: #80480b;
    border-bottom: 1px solid #444;
    font-weight: 600;
    font-size: 20px;
    line-height:1.1;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height:0;
}

/* ===== 메시지 ===== */

.message {
    max-width: min(800px, 85%);
    border-radius: 14px;
    padding: 20px;
    font-size: 20px;
    line-height: 1.5;
    word-break: break-word;
}

.thinking,
.content {
    white-space: pre-wrap;
}

.message.ai {
    align-self: flex-start;
    background: #444654;
}

.message.user {
    align-self: flex-end;
    background: #2b2c2f;
}

/* ===== Thinking ===== */

.thinking-box {
    margin-bottom: 10px;
    border: 1px solid #5a5a5a;
    border-radius: 8px;
    background: #2f3136;
    overflow: hidden;
}

.thinking-box summary {
    cursor: pointer;
    padding: 8px 12px;
    list-style: none;
    font-size: 30px;
    font-weight: 600;
    color: #ffd54f;
    user-select: none;
}

.thinking-box summary::-webkit-details-marker {
    display: none;
}

.thinking-box summary::before {
    content: "▶ ";
}

.thinking-box[open] summary::before {
    content: "▼ ";
}

.thinking {
    padding: 10px 12px;
    border-top: 1px solid #444;
    color: #bdbdbd;
    font-size: 30px;
    line-height: 1.5;
    word-break: break-word;
}

.content {
    line-height: 1.6;
}

/* ===== 입력 ===== */

.input-area {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    padding: 30px;
    background: #40414f;
    border-top: 1px solid #2a2b32;
}

.input-area input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    border-radius: 10px;
    padding: 20px;
    background: #343541;
    color: #ececf1;
    font-size: 30px;
    select {
        font-size: 35px;
    }
}

.input-area button {
    border: none;
    border-radius: 10px;
    padding: 20px;
    background: #19c37d;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s;
}

.input-area button:hover {
    background: #15a86c;
}

/* ===== 모델 선택 ===== */

select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #555;
    background: #2f3136;
    color: #ececf1;
    font-size: 50px;
}

/* ===== 스크롤바 ===== */

.chat-box::-webkit-scrollbar {
    width: 8px;
}

.chat-box::-webkit-scrollbar-track {
    background: transparent;
}

.chat-box::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 4px;
}

.settings-area {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: #2d2f39;
    border-bottom: 1px solid #444;
    font-size: 30px;
}

.setting-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-item label {
    font-size: 13px;
    color: #bdbdbd;
    font-size: 25px;
}

.setting-item select {
    width: 100%;
    height: 42px;

    padding: 0 12px;

    border-radius: 8px;
    border: 1px solid #555;

    background: #40414f;
    color: white;

    font-size: 30px;
}

.switch {
    margin-left: auto;

    display: flex;
    align-items: center;
    gap: 10px;

    cursor: pointer;
}

.switch input {
    display: none;
}

.slider {
    width: 48px;
    height: 26px;

    background: #666;
    border-radius: 999px;

    position: relative;

    transition: .2s;
}

.slider::before {
    content: "";

    position: absolute;

    width: 20px;
    height: 20px;

    left: 3px;
    top: 3px;

    border-radius: 50%;

    background: white;

    transition: .2s;
}

.switch input:checked + .slider {
    background: #19c37d;
}

.switch input:checked + .slider::before {
    transform: translateX(22px);
}

.switch-text {
    font-weight: 600;
    color: white;
}

/* 세션창 */
#new-chat-btn{
    width:100%;

    padding:14px;

    border:1px solid #565869;
    border-radius:8px;

    background:transparent;
    color:white;

    cursor:pointer;

    transition:.2s;
}

#new-chat-btn:hover{
    background:#2b2c2f;
}


/* 세션 사이드바 */
.sidebar{
    width:260px;
    flex-shrink:0;

    display:flex;
    flex-direction:column;

    background:#202123;
    border-right:1px solid #444;

    padding:16px;
    position: relative;
    z-index: 10;
    font-size: 30px;
}
#new-chat{
    position: relative;
    z-index: 20;

    width:100%;
    height:48px;

    margin-bottom:20px;

    border:1px solid rgba(0,212,255,0.5);
    border-radius:12px;

    background:
        linear-gradient(
            135deg,
            rgba(0,212,255,0.15),
            rgba(124,92,255,0.15)
        );

    color:#eafaff;

    font-size:20px;
    font-weight:700;

    cursor:pointer;

    letter-spacing:1px;

    box-shadow:
        0 0 10px rgba(0,212,255,0.2),
        inset 0 0 10px rgba(124,92,255,0.1);

    transition:
        0.2s ease;

    backdrop-filter: blur(10px);
}


#new-chat:hover{

    transform:translateY(-2px);

    border-color:#00d4ff;

    background:
        linear-gradient(
            135deg,
            rgba(0,212,255,0.3),
            rgba(124,92,255,0.3)
        );

    box-shadow:
        0 0 20px rgba(0,212,255,0.5),
        0 0 40px rgba(124,92,255,0.3);
}


#new-chat:active{

    transform:translateY(1px);

    box-shadow:
        0 0 8px rgba(0,212,255,0.4);
}

/* ===== 대화 목록 ===== */

.history{
    display:flex;
    flex-direction:column;
    gap:8px;

    overflow-y:auto;
    flex:1;
}


.history-item{
    position:relative;

    padding:14px 16px;

    border-radius:10px;

    background:
        rgba(255,255,255,0.03);

    border:1px solid transparent;

    color:#cfd3dc;

    font-size:18px;
    font-weight:500;

    cursor:pointer;

    transition:
        0.2s ease;

    overflow:hidden;

    white-space:nowrap;
    text-overflow:ellipsis;
}


/* 왼쪽 포인트 라인 */
.history-item::before{
    content:"";

    position:absolute;

    left:0;
    top:0;

    width:3px;
    height:100%;

    background:transparent;

    transition:.2s;
}


/* hover */
.history-item:hover{

    background:
        linear-gradient(
            135deg,
            rgba(0,212,255,0.12),
            rgba(124,92,255,0.12)
        );

    border-color:
        rgba(0,212,255,0.35);

    color:white;

    transform:translateX(3px);

    box-shadow:
        0 0 15px rgba(0,212,255,0.15);
}


.history-item:hover::before{

    background:#00d4ff;

    box-shadow:
        0 0 10px #00d4ff;
}


/* 현재 선택된 채팅 */
.history-item.active{

    background:
        linear-gradient(
            135deg,
            rgba(124,92,255,0.25),
            rgba(0,212,255,0.15)
        );

    border-color:
        rgba(124,92,255,0.5);

    color:white;

    box-shadow:
        0 0 15px rgba(124,92,255,0.2);
}


.history-item.active::before{

    background:#7c5cff;

    box-shadow:
        0 0 10px #7c5cff;
}
