body{
    margin:0;

    height:100vh;

    display:flex;
    justify-content:center;
    align-items:center;

    background:#f5f5f5;
}

.login-box{
    width:350px;

    padding:40px;

    background:white;

    border-radius:20px;

    box-shadow:0 0 20px rgba(0,0,0,0.1);

    text-align:center;
}

.login-box input{
    width:100%;

    padding:12px;

    box-sizing:border-box;

    border:1px solid #ddd;
    border-radius:10px;

    transition:0.2s;
}

.login-box input:focus{
    outline:none;

    border-color:#e8983d;

    box-shadow:0 0 8px rgba(232,152,61,0.3);
}

.login-btn{
    width:100%;

    padding:12px;

    border:none;

    border-radius:30px;

    color:white;

    font-size:16px;
    font-weight:bold;

    cursor:pointer;

    background:
        linear-gradient(
        to right,
        #f2a64a,
        #e8983d,
        #d97a1f
    );
}

.login-box a{
    color:#d97a1f;
    text-decoration:none;
    font-weight:bold;
}

.toast{
    position:fixed;
    top:30px;
    left:50%;

    transform:translateX(-50%);

    padding:15px 30px;

    background:linear-gradient(
        to right,
        #f2a64a,
        #e8983d,
        #d97a1f
    );

    color:white;
    border-radius:30px;
    font-weight:bold;

    box-shadow:0 4px 10px rgba(0,0,0,0.2);

    animation:toastFade 3s ease forwards;
}

@keyframes toastFade{
    0%{
        opacity:1;
        visibility:visible;
    }

    70%{
        opacity:1;
        visibility:visible;
    }

    100%{
        opacity:0;
        visibility:hidden;
    }
}


/*메인 페이지*/
.main-box {
    width: 1200px;
    max-width: 90%;

    padding: 40px;

    background: white;

    border-radius: 20px;

    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);

    box-sizing: border-box;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 30px;
}

.main-header h2 {
    margin: 0 0 10px;
}



.main-box h2{
    color:#d97a1f;
}

.welcome{
    font-size:18px;
    margin-bottom:20px;
}

.info-box{
    background:#fff7ec;

    border:1px solid #f2d2a5;

    border-radius:10px;

    padding:15px;

    margin-bottom:10px;
}

.main-box input{
    width:100%;

    padding:12px;

    margin-bottom:10px;

    box-sizing:border-box;

    border:1px solid #ddd;

    border-radius:10px;
}


.user-header{
    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-bottom:15px;
}

.user-header h3{
    margin:0;
}

.logout-btn{
    display:inline-block;

    padding:10px 20px;

    border-radius:30px;

    text-decoration:none;

    color:white;

    background:linear-gradient(
        to right,
        #999,
        #666
    );
}

/* 팝업 전체 배경 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

/* 팝업 창 */
.modal-content {
    position: relative;
    width: 360px;
    padding: 30px;
    border-radius: 12px;
    background-color: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
}

/* 닫기 버튼 */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    border: none;
    background: none;
    font-size: 28px;
    cursor: pointer;
}

/* 입력 영역 */
.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: bold;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    box-sizing: border-box;
}

/* 저장 버튼 */
.save-btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 6px;
    background-color: #333333;
    color: white;
    cursor: pointer;
}

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

.openOptionBtn {
    min-width: 100px;

    white-space: nowrap;

    padding: 10px 18px;

    border:none;

    border-radius:20px;

    color:white;

    font-size:16px;

    font-weight:bold;

    cursor:pointer;

    background:
        linear-gradient(
        to right,
        #f2a64a,
        #e8983d,
        #d97a1f
    );

     margin-bottom:20px;
     
}

.option-area {
    display: flex;
    justify-content: flex-end;
}

#logBox {
    width: 100%;
    height: 400px;

    margin: 0;
    padding: 20px;

    box-sizing: border-box;

    overflow-y: auto;

    background: #1e1e1e;
    color: #00ff66;

    border-radius: 10px;
    border: 1px solid #333;

    font-family: Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;

    white-space: pre-wrap;
    word-break: break-all;
}

.llm-menu-area {
    margin-top: 28px;
    padding: 24px;

    text-align: center;

    background: #fff7ec;
    border: 1px solid #f2d2a5;
    border-radius: 14px;
}

.llm-menu-area h3 {
    margin: 0 0 18px;

    color: #b96513;
    font-size: 26px;
}

.llm-page-btn {
    display: inline-block;
    min-width: 220px;
    padding: 14px 28px;

    border-radius: 30px;

    color: white;
    font-size: 17px;
    font-weight: bold;
    text-decoration: none;

    cursor: pointer;

    background: linear-gradient(
        to right,
        #f2a64a,
        #e8983d,
        #d97a1f
    );
    box-shadow: 0 6px 14px rgba(217, 122, 31, 0.28);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.llm-page-btn:hover {
    filter: brightness(1.04);
    transform: translateY(-2px);
}

.network-page-link {
    margin-left: 12px;
}

/* 네트워크 장비 로그 페이지 */
.network-log-page {
    width: 1200px;
    max-width: 90%;
    margin: 40px auto;
    padding: 36px;
    background: #ffffff;
    border: 1px solid #f2d2a5;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(91, 55, 24, 0.12);
}

.network-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.network-log-header h2 {
    margin: 0 0 8px;
    color: #d97a1f;
}

.network-log-header p {
    margin: 0;
    color: #6f6258;
}

.network-device-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.network-device-info div {
    padding: 18px;
    background: #fff8ef;
    border: 1px solid #f2d2a5;
    border-radius: 12px;
}

.network-device-info span,
.network-device-info strong {
    display: block;
}

.network-device-info span {
    margin-bottom: 7px;
    color: #8b7766;
    font-size: 13px;
}

.network-device-info strong {
    color: #4d3b2c;
    word-break: break-all;
}

.network-log-section {
    overflow: hidden;
    border: 1px solid #ead8c7;
    border-radius: 14px;
}

.network-log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    background: #fffaf5;
    border-bottom: 1px solid #ead8c7;
}

.network-log-toolbar h3,
.network-log-toolbar p {
    margin: 0;
}

.network-log-toolbar p {
    margin-top: 6px;
    color: #806f61;
    font-size: 14px;
}

#loadNetworkLogsBtn {
    padding: 11px 20px;
    color: #ffffff;
    background: #d97a1f;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 700;
}

#loadNetworkLogsBtn:disabled {
    cursor: wait;
    opacity: 0.65;
}

#networkLogOutput {
    box-sizing: border-box;
    width: 100%;
    min-height: 480px;
    max-height: 65vh;
    margin: 0;
    padding: 22px;
    overflow: auto;
    color: #e8edf2;
    background: #17212b;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.network-log-error {
    margin: 0;
    padding: 13px 20px;
    color: #9d2929;
    background: #fff0f0;
    border-bottom: 1px solid #efc0c0;
}

@media (max-width: 760px) {
    .network-log-page {
        box-sizing: border-box;
        margin: 18px auto;
        padding: 20px;
    }

    .network-log-header,
    .network-log-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .network-device-info {
        grid-template-columns: 1fr;
    }

    .network-page-link {
        margin-top: 10px;
        margin-left: 0;
    }
}

/* 사용자 권한 관리 */
.admin-box {
    width: min(960px, 92%);
    padding: 36px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.admin-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.admin-heading h2 { color: #d97a1f; }
.admin-notice { padding: 12px 15px; border-radius: 10px; background: #fff7ec; }
.admin-message { color: #267a38; }
.admin-message.error { color: #b42318; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
.admin-table select { padding: 8px; border: 1px solid #ddd; border-radius: 8px; }
.admin-table button { padding: 8px 16px; border: 0; border-radius: 20px; color: white; background: #d97a1f; cursor: pointer; }
.admin-table button:disabled { opacity: .55; cursor: wait; }
.admin-table td:last-child { display: flex; gap: 8px; align-items: center; }
.admin-table button.delete-user-btn { background: #b42318; }

.logout-area {
    margin-top: 30px;

    text-align: center;
}

/* LLM 대화 페이지 */
.chat-page {
    width: 900px;
    max-width: 90%;
    min-height: 650px;
    padding: 35px;

    display: flex;
    flex-direction: column;

    background: white;
    border: 1px solid #f2d2a5;
    border-radius: 20px;

    box-sizing: border-box;
    box-shadow: 0 0 20px rgba(217, 122, 31, 0.15);
}

/* 페이지 상단 */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding-bottom: 20px;
    margin-bottom: 20px;

    border-bottom: 2px solid #f2d2a5;
}

.chat-header h2 {
    margin: 0 0 8px;
    color: #d97a1f;
}

.chat-header p {
    margin: 0;
    color: #666;
}

/* 메인 페이지 이동 버튼 */
.back-btn {
    display: inline-block;

    padding: 10px 18px;

    color: white;
    text-decoration: none;
    font-weight: bold;

    border-radius: 20px;

    background: linear-gradient(
        to right,
        #f2a64a,
        #e8983d,
        #d97a1f
    );
}

/* LLM 답변 영역 */
.chat-response {
    flex: 1;
    min-height: 350px;
    padding: 25px;

    overflow-y: auto;

    background: #fff7df;
    border: 1px solid #f2d2a5;
    border-radius: 15px;

    color: #333;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 로딩 메시지 */
.llm-loading {
    margin: 12px 0 0;
    padding: 12px;

    color: #b76512;
    font-weight: bold;

    background: #fff3cd;
    border-radius: 10px;
}

/* 오류 메시지 */
.llm-error {
    margin: 12px 0 0;
    padding: 12px;

    color: #a94442;
    font-weight: bold;

    background: #ffe5e5;
    border: 1px solid #efb6b6;
    border-radius: 10px;
}

/* 질문 입력창과 전송 버튼 */
.chat-input-area {
    display: flex;
    gap: 12px;

    margin-top: 20px;
}

.chat-input-area textarea {
    flex: 1;
    padding: 15px;

    resize: vertical;

    border: 1px solid #e8b96f;
    border-radius: 12px;

    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: #e8983d;
    box-shadow: 0 0 8px rgba(232, 152, 61, 0.3);
}

/* 전송 버튼 */
#llmSendBtn {
    width: 100px;

    border: none;
    border-radius: 12px;

    color: white;
    font-size: 16px;
    font-weight: bold;

    cursor: pointer;

    background: linear-gradient(
        to bottom,
        #f2b54f,
        #e8983d,
        #d97a1f
    );
}

#llmSendBtn:hover {
    filter: brightness(0.95);
}

#llmSendBtn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 작은 화면 대응 */
@media (max-width: 600px) {
    .chat-page {
        min-height: 90vh;
        padding: 20px;
    }

    .chat-header {
        align-items: flex-start;
    }

    .chat-input-area {
        flex-direction: column;
    }

    #llmSendBtn {
        width: 100%;
        padding: 13px;
    }
}

/* 메신저형 LLM 대화 페이지 */
.messenger {
    width: min(1180px, 94vw);
    height: min(780px, 92vh);
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #f2d2a5;
    border-radius: 22px;
    box-shadow: 0 14px 40px rgba(217, 122, 31, 0.16);
}

.conversation-sidebar {
    min-width: 0;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #fff9ec 0%, #fff3d5 100%);
    border-right: 1px solid #f2d2a5;
}

.sidebar-header h2 {
    margin: 0 0 18px;
    color: #b96513;
    font-size: 23px;
}

#newConversationBtn {
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-radius: 24px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(90deg, #f2b54f, #e8983d, #d97a1f);
    box-shadow: 0 5px 12px rgba(217, 122, 31, 0.25);
    transition: transform 0.15s ease, filter 0.15s ease;
}

#newConversationBtn:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.conversation-list {
    flex: 1;
    min-height: 0;
    margin: 20px 0;
    overflow-y: auto;
}

.empty-conversation {
    padding: 20px 10px;
    color: #98785a;
    text-align: center;
    font-size: 14px;
}

.conversation-item {
    width: 100%;
    margin-bottom: 8px;
    padding: 13px 14px;
    display: block;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.62);
    color: #5d4938;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.conversation-item:hover {
    background: #ffffff;
    border-color: #f2d2a5;
}

.conversation-item.active {
    background: #ffffff;
    border-color: #e8983d;
    color: #b96513;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(217, 122, 31, 0.12);
}

.conversation-sidebar .back-btn {
    display: block;
    padding: 10px 14px;
    border: 1px solid #e8b96f;
    border-radius: 20px;
    background: #ffffff;
    color: #b96513;
    text-align: center;
    text-decoration: none;
    font-weight: 700;
}

.chat-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.chat-panel .chat-header {
    margin: 0;
    padding: 22px 28px;
    border-bottom: 1px solid #f2d2a5;
    background: #ffffff;
}

.chat-panel .chat-header h2 {
    margin: 0 0 5px;
    color: #b96513;
    font-size: 22px;
}

.chat-panel .chat-header p {
    margin: 0;
    color: #9a7a5d;
    font-size: 13px;
}

.model-selector-area {
    display: flex;
    align-items: center;
    gap: 9px;
}

.model-selector-area label {
    color: #9a7a5d;
    font-size: 13px;
}

#llmModel,
#llmQueryType {
    max-width: min(420px, 55vw);
    padding: 7px 32px 7px 10px;
    border: 1px solid #ebc58a;
    border-radius: 9px;
    background: #fffdf8;
    color: #6a4a2f;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

#llmModel:focus,
#llmQueryType:focus {
    outline: none;
    border-color: #e8983d;
    box-shadow: 0 0 0 3px rgba(232, 152, 61, 0.16);
}

#llmModel:disabled {
    cursor: wait;
    opacity: 0.65;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    padding: 26px 30px;
    overflow-y: auto;
    background: linear-gradient(180deg, #fffdf8 0%, #fff8e8 100%);
}

.chat-guide {
    margin: 70px auto;
    color: #a98a6c;
    text-align: center;
    line-height: 1.7;
}

.message-row {
    width: 100%;
    margin: 9px 0;
    display: flex;
}

.message-row.user {
    justify-content: flex-end;
}

.message-row.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: min(72%, 620px);
    padding: 11px 15px;
    border-radius: 18px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-shadow: 0 3px 9px rgba(80, 55, 30, 0.08);
}

.message-row.user .message-bubble {
    border-bottom-right-radius: 5px;
    background: linear-gradient(135deg, #f2b54f, #e8983d);
    color: #ffffff;
}

.message-row.assistant .message-bubble {
    border: 1px solid #f0d6ad;
    border-bottom-left-radius: 5px;
    background: #ffffff;
    color: #473a31;
}

.chat-panel .llm-loading,
.chat-panel .llm-error {
    margin: 10px 24px 0;
}

.chat-panel .chat-input-area {
    margin: 0;
    padding: 18px 22px;
    align-items: flex-end;
    background: #ffffff;
    border-top: 1px solid #f2d2a5;
}

.chat-panel .chat-input-area textarea {
    max-height: 140px;
    margin: 0;
    padding: 13px 16px;
    resize: none;
    border: 1px solid #ebc58a;
    border-radius: 20px;
    background: #fffdf8;
}

.chat-panel #llmSendBtn {
    min-height: 48px;
    border-radius: 24px;
    background: linear-gradient(135deg, #f2b54f, #d97a1f);
}

@media (max-width: 760px) {
    body {
        height: auto;
        min-height: 100vh;
        align-items: stretch;
    }

    .messenger {
        width: 100%;
        height: 100vh;
        grid-template-columns: 1fr;
        grid-template-rows: 210px minmax(0, 1fr);
        border: 0;
        border-radius: 0;
    }

    .conversation-sidebar {
        padding: 14px;
        border-right: 0;
        border-bottom: 1px solid #f2d2a5;
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .sidebar-header h2 {
        margin: 0;
        white-space: nowrap;
    }

    .conversation-list {
        margin: 12px 0 0;
    }

    .conversation-sidebar .back-btn {
        display: none;
    }

    .chat-messages {
        padding: 18px 14px;
    }

    .message-bubble {
        max-width: 84%;
    }
}
