﻿* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
    color: #243042;
    background: #ffffff;
}

/* =========================================================
   홈페이지 Header
   ========================================================= */
.site-header {
    border-bottom: 1px solid #e3e8ef;
}

.head {
    height: 72px;
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 34px;
    padding: 0 18px;
}

.brand {
    color: #2375df;
    font-size: 24px;
    font-weight: 800;
    text-decoration: none;
}

.head nav {
    display: flex;
    flex: 1;
    gap: 32px;
}

.head nav a {
    color: #243042;
    text-decoration: none;
}

.portal-btn {
    padding: 7px 12px;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    background: #050505;
    border-radius: 18px;
}

.home {
    max-width: 1100px;
    margin: 60px auto;
}

/* =========================================================
   Portal 공통
   ========================================================= */
.portal-page {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px 14px;
    background: #f3f6f8;
}

.login-card,
.db-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e0e6ec;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(16, 24, 40, 0.08);
}

.login-card {
    width: 440px;
    padding: 34px 36px;
}

.db-card {
    width: 560px;
    padding: 34px 36px;
}

.close {
    position: absolute;
    top: 16px;
    right: 18px;
    color: #667085;
    font-size: 25px;
    line-height: 1;
    text-decoration: none;
}

.close:hover {
    color: #087d73;
}

/* =========================================================
   로그인
   ========================================================= */
.mode {
    margin: 6px 0 22px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

.mode label {
    margin-right: 20px;
}

.login-card h1 {
    margin: 8px 0 12px;
    color: #172b4d;
    font-size: 29px;
    font-weight: 800;
    text-align: center;
    letter-spacing: 9px;
}

.login-card h3 {
    margin: 0 0 28px;
    color: #172b4d;
    font-size: 18px;
    text-align: center;
}

.login-card > label {
    display: block;
    margin: 13px 0 6px;
    color: #475467;
    font-size: 14px;
    font-weight: 700;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    height: 40px;
    padding: 8px 11px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #d0d7e2;
    border-radius: 6px;
    outline: none;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
    border-color: #13a89e;
    box-shadow: 0 0 0 2px rgba(19, 168, 158, 0.10);
}

.keep-login {
    margin-top: 10px;
    color: #475467;
    font-size: 14px;
}

.login-card input[type="submit"] {
    min-height: 38px;
    padding: 8px 16px;
    margin-top: 12px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.login-card input[type="submit"]:hover {
    background: #f8fafc;
}

.primary {
    color: #ffffff !important;
    background: #008f80 !important;
    border-color: #008f80 !important;
}

.settings {
    color: #087d73;
}

.login-footer {
    margin-top: 12px;
    color: #667085;
    font-size: 12px;
    text-align: center;
}

.error,
.status {
    display: block;
    margin-top: 12px;
    color: #d92d20;
    font-size: 13px;
    line-height: 1.5;
}

/* =========================================================
   관리자 확인 Modal
   ========================================================= */
.modal-back {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.42);
}

.modal {
    width: 370px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e0e6ec;
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.modal h2 {
    margin: 0 0 12px;
    color: #172b4d;
    font-size: 22px;
}

.modal p {
    margin: 0 0 16px;
    color: #667085;
    font-size: 14px;
}

.modal label {
    display: block;
    margin-bottom: 6px;
    color: #475467;
    font-size: 14px;
    font-weight: 700;
}

.modal input[type="password"] {
    width: 100%;
    height: 40px;
    padding: 8px 11px;
    border: 1px solid #d0d7e2;
    border-radius: 6px;
}

/* =========================================================
   DB 환경설정
   ========================================================= */
.db-card h2 {
    margin: 0 0 24px;
    color: #087d73;
    font-size: 24px;
    font-weight: 800;
}

.db-card h2 small {
    margin-left: 6px;
    color: #667085;
    font-size: 12px;
    font-weight: 700;
}

.setting-row,
.crypto-setting-row,
.crypto-button-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.setting-row > label,
.crypto-setting-row > label {
    margin: 0;
    color: #52647a;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.setting-row > .keylabel {
    color: #d92d20;
}

.setting-row > input[type="text"],
.setting-row > input[type="password"],
.crypto-setting-row > input[type="text"],
.crypto-setting-row > input[type="password"] {
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 8px 11px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #d0d7e2;
    border-radius: 6px;
    outline: none;
}

.setting-row > input[type="text"]:focus,
.setting-row > input[type="password"]:focus,
.crypto-setting-row > input[type="text"]:focus,
.crypto-setting-row > input[type="password"]:focus {
    border-color: #13a89e;
    box-shadow: 0 0 0 2px rgba(19, 168, 158, 0.10);
}

.password-field {
    position: relative;
    width: 100%;
}

.password-field input[type="text"],
.password-field input[type="password"] {
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 8px 48px 8px 11px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #d0d7e2;
    border-radius: 6px;
    outline: none;
}

.password-field input[type="text"]:focus,
.password-field input[type="password"]:focus {
    border-color: #13a89e;
    box-shadow: 0 0 0 2px rgba(19, 168, 158, 0.10);
}

.password-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 42px;
    height: 38px;
    padding: 0;
    color: #667085;
    font-size: 18px;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    background: #ffffff;
    border: 0;
    border-left: 1px solid #d0d7e2;
    border-radius: 0 6px 6px 0;
}

.password-toggle:hover {
    background: #f8fafc;
}

.password-toggle:disabled {
    color: #aab3c0;
    cursor: default;
    opacity: 0.65;
    background: #f2f4f7;
}

.info-box {
    margin-top: 14px;
    padding: 12px 14px;
    color: #98a2b3;
    font-size: 13px;
    background: #f2f5f8;
    border-radius: 7px;
}

/* =========================================================
   AES 암호화 / 복호화
   ========================================================= */
.crypto-box {
    margin-top: 22px;
    padding: 18px 16px;
    background: #fbfcfd;
    border: 1px solid #dde3ea;
    border-radius: 8px;
}

.crypto-box h3 {
    margin: 0 0 14px;
    color: #087d73;
    font-size: 15px;
    font-weight: 800;
}

.crypto-setting-row {
    grid-template-columns: 120px minmax(0, 1fr);
}

.crypto-setting-row input:disabled {
    color: #98a2b3;
    background: #f2f4f7;
}

.crypto-setting-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.crypto-button-row {
    margin-top: 10px;
}

.row {
    display: flex;
    gap: 8px;
}

.crypto-button-row .row {
    margin: 0;
}

.crypto-box input[type="submit"] {
    min-height: 36px;
    padding: 7px 13px;
    color: #344054;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
}

.crypto-box input[type="submit"]:hover {
    background: #f8fafc;
}

.result-row {
    margin-top: 12px;
}

.crypto-help {
    margin: 15px 0 0;
    color: #8a94a3;
    font-size: 12px;
    line-height: 1.7;
}

/* =========================================================
   하단 버튼
   ========================================================= */
.bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
}

.bottom span {
    flex: 1;
}

.bottom input[type="submit"] {
    min-height: 38px;
    padding: 8px 16px;
    color: #344054;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.bottom input[type="submit"]:hover {
    background: #f8fafc;
}

.small {
    width: auto !important;
    padding: 8px 20px !important;
}

/* =========================================================
   반응형
   ========================================================= */
@media (max-width: 640px) {
    .portal-page {
        padding: 10px;
    }

    .login-card,
    .db-card {
        width: 100%;
        padding: 26px 20px;
    }

    .setting-row,
    .crypto-setting-row,
    .crypto-button-row {
        grid-template-columns: 105px minmax(0, 1fr);
        gap: 8px;
    }

    .login-card h1 {
        font-size: 25px;
        letter-spacing: 6px;
    }
}

@media (max-width: 430px) {
    .setting-row,
    .crypto-setting-row,
    .crypto-button-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .crypto-button-row > span {
        display: none;
    }

    .row {
        flex-wrap: wrap;
    }
}
