* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #dbe4ee;
    color: #1a1a1a;
}

a {
    color: #4c2c8c;
}

.page-shell {
    max-width: 1240px;
    margin: 18px auto;
    border: 1px solid #5f7288;
    background: #edf3fb;
    box-shadow: 0 8px 24px rgba(36, 57, 79, 0.15);
}

.site-header {
    min-height: 110px;
    border-bottom: 1px solid #5f7288;
    background: linear-gradient(180deg, #d6e1ef 0%, #c3d3e6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
}

.logo-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-logo-image {
    max-width: 100%;
    max-height: 90px;
    display: block;
    object-fit: contain;
}

.site-logo-svg {
    width: 100%;
    height: 90px;
}

.svg-logo-text {
    font-size: 42px;
    font-weight: bold;
    fill: url(#logoGradient);
    animation: logoPulse 3s ease-in-out infinite;
    letter-spacing: 0.5px;
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.95;
    }
    50% {
        transform: scale(1.01);
        opacity: 1;
    }
}

.main-layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 680px;
}

.sidebar {
    border-right: 1px solid #5f7288;
    background: #d9e1ec;
    padding: 14px;
}

.main-menu {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.menu-link {
    display: block;
    padding: 9px 10px;
    text-decoration: none;
    color: #1f2230;
    border: 1px solid transparent;
    font-weight: bold;
}

.menu-link:hover,
.menu-link.active {
    background: #eef4fb;
    border-color: #7c8ea3;
    color: #5b2b98;
}

.admin-box,
.site-info-box {
    margin-top: 18px;
    background: #eef4fb;
    border: 1px solid #7c8ea3;
    padding: 12px;
}

.admin-box h3,
.site-info-box h3 {
    margin: 0 0 12px;
    font-size: 18px;
}

.login-form,
.upload-form,
.editor-form,
.chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-form input,
.chat-form input,
.upload-form input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #8799ab;
    background: #fff;
}

.button {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid #446688;
    background: #7fb2e4;
    color: #102336;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: #98c3eb;
}

.button-secondary {
    background: #d9dce7;
}

.button-full {
    width: 100%;
    text-align: center;
}

.content-area {
    background: #dbe6f3;
    padding: 18px;
}

.flash {
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid;
}

.flash-error {
    background: #ffe3e3;
    border-color: #d26464;
}

.flash-success {
    background: #e2f6e7;
    border-color: #5f9c69;
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    background: #eef4fb;
    border: 1px solid #7c8ea3;
    padding: 12px;
    margin-bottom: 16px;
}

.upload-form {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}

.panel {
    background: #edf4fb;
    border: 1px solid #7c8ea3;
    padding: 18px;
}

.panel h1,
.panel h2 {
    margin-top: 0;
    color: #16344f;
}

.subpanel {
    margin-top: 18px;
}

textarea {
    width: 100%;
    min-height: 330px;
    padding: 12px;
    border: 1px solid #8799ab;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
}

.content-html {
    line-height: 1.6;
    font-size: 16px;
}

.content-html iframe {
    width: 100%;
    min-height: 420px;
    border: 0;
}

.map-content iframe {
    min-height: 480px;
}

.helper-text {
    margin-top: 0;
    color: #304f6e;
}

.chatbot-layout {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 20px;
    align-items: start;
}

.chat-entry {
    margin-top: 14px;
}

.chat-label {
    font-size: 13px;
    font-weight: bold;
    color: #34536f;
    margin-bottom: 6px;
}

.chat-bubble {
    background: #ffffff;
    border: 1px solid #91a6bd;
    padding: 14px;
    min-height: 56px;
}

.bot-bubble {
    background: #ebfff1;
}

.bot-avatar-box {
    position: relative;
    min-height: 260px;
    border: 1px solid #90a6c0;
    background: #eef4fb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}

.bot-avatar-face {
    font-size: 72px;
    z-index: 2;
    animation: bob 2.4s ease-in-out infinite;
}

.bot-avatar-orbit {
    position: absolute;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px dashed #7ab0d9;
    animation: spin 10s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.history-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.history-card {
    background: #fff;
    border: 1px solid #8fa4ba;
    padding: 14px;
}

.history-card.compact {
    display: grid;
    gap: 6px;
}

.history-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 14px;
    margin-bottom: 10px;
    color: #36526b;
}

.history-block {
    margin-top: 8px;
}

.bot-answer-list ul {
    margin: 8px 0 0 18px;
}

.admin-status {
    margin: 0 0 12px;
}

.site-info-box p {
    margin: 6px 0;
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid #5f7288;
    }

    .chatbot-layout {
        grid-template-columns: 1fr;
    }
}
