/* =========================================================
   LEGAL PAGES
========================================================= */

.legal-box {
    position: relative;
    z-index: 2;

    width: 100%;
    max-width: 850px;

    max-height: calc(100vh - 50px);

    overflow-y: auto;

    padding: 42px;

    border: 1px solid #174966;
    border-radius: 22px;

    background:
        linear-gradient(
            145deg,
            rgba(10, 34, 51, 0.97),
            rgba(5, 20, 31, 0.97)
        );

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.48);

    backdrop-filter: blur(18px);
}

.legal-box::-webkit-scrollbar {
    width: 7px;
}

.legal-box::-webkit-scrollbar-track {
    background: transparent;
}

.legal-box::-webkit-scrollbar-thumb {
    background: #174a65;
    border-radius: 20px;
}


/* Legal brand */

.legal-logo {
    width: 43px;
    height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            #08759a,
            #18a0d0
        );

    color: #ffffff;

    font-size: 22px;
    font-weight: 800;

    text-decoration: none;

    box-shadow:
        0 8px 28px rgba(19, 131, 173, 0.30);
}

.legal-brand-link {
    text-decoration: none;
}


/* Legal header */

.legal-header {
    text-align: center;

    margin-bottom: 35px;
}

.legal-header h1 {
    margin-bottom: 9px;

    color: #f1fbff;

    font-size: 30px;
    font-weight: 750;

    letter-spacing: -0.5px;
}

.legal-header p {
    color: #7895a8;

    font-size: 14px;
}

.legal-date {
    margin-top: 12px;

    color: #557588;

    font-size: 11px;
}


/* Legal content */

.legal-content {
    color: #b9d1dd;

    font-size: 14px;
    line-height: 1.75;
}

.legal-content h2 {
    margin-top: 28px;
    margin-bottom: 9px;

    color: #e7f8ff;

    font-size: 17px;
    font-weight: 700;
}

.legal-content h2:first-child {
    margin-top: 0;
}

.legal-content p {
    margin-bottom: 13px;
}

.legal-content ul {
    margin: 8px 0 18px 22px;
}

.legal-content li {
    margin-bottom: 7px;
}

.legal-content a {
    color: #75c9ea;

    text-decoration: none;
}

.legal-content a:hover {
    color: #b1e9ff;
    text-decoration: underline;
}


/* Contact */

.legal-contact {
    font-weight: 600;
}


/* Navigation */

.legal-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-top: 35px;
    padding-top: 22px;

    border-top: 1px solid #15354a;
}

.legal-navigation a {
    color: #75c9ea;

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;
}

.legal-navigation a:hover {
    color: #b1e9ff;
    text-decoration: underline;
}


/* Legal mobile */

@media (max-width: 700px) {

    .legal-box {
        max-height: calc(100vh - 30px);

        padding: 28px 21px;

        border-radius: 18px;
    }

    .legal-header h1 {
        font-size: 25px;
    }

    .legal-content {
        font-size: 13px;
    }

    .legal-content h2 {
        font-size: 16px;
    }

    .legal-navigation {
        flex-direction: column;
        align-items: stretch;

        text-align: center;
    }
}



/* =========================================================
   ECHOAI — GLOBAL
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: #06111c;
    color: #eaf7ff;
}


/* =========================================================
   MAIN APP
========================================================= */

.app {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    width: 275px;
    min-width: 275px;

    display: flex;
    flex-direction: column;

    padding: 18px;

    background:
        linear-gradient(
            180deg,
            #071724 0%,
            #05121d 100%
        );

    border-right: 1px solid #15354a;
    color: #ffffff;

    transition:
        width 0.25s ease,
        min-width 0.25s ease,
        transform 0.25s ease;
}


/* =========================================================
   SIDEBAR HEADER
========================================================= */

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 22px;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}


/* =========================================================
   SIDEBAR TOGGLE
========================================================= */

.sidebar-toggle {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #1a4862;
    border-radius: 10px;

    background: #0a2233;
    color: #dff6ff;

    font-size: 20px;
    cursor: pointer;

    transition: 0.2s ease;
}

.sidebar-toggle:hover {
    background: #10354d;
    border-color: #28779c;
}

.open-toggle {
    display: none;
    margin-right: 14px;
    font-size: 18px;
}


/* =========================================================
   SIDEBAR BUTTONS
========================================================= */

.sidebar > button:not(.sidebar-toggle) {
    width: 100%;

    padding: 12px 13px;
    margin-bottom: 9px;

    border: 1px solid #16445d;
    border-radius: 10px;

    background: #0a2233;
    color: #d9eff9;

    font-size: 14px;
    text-align: left;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.sidebar > button:not(.sidebar-toggle):hover {
    background: #0d2d43;
    border-color: #216482;
    transform: translateY(-1px);
}


/* =========================================================
   NEW CHAT
========================================================= */

.new-chat-button {
    background:
        linear-gradient(
            135deg,
            #08759a,
            #139dcc
        ) !important;

    border-color: #26a9d5 !important;
    color: #ffffff !important;
    font-weight: 700;
}


/* =========================================================
   HISTORY
========================================================= */

.history-section {
    flex: 1;
    min-height: 0;

    display: flex;
    flex-direction: column;

    margin-top: 16px;
    overflow: hidden;
}

.history-title {
    margin: 5px 5px 10px;

    color: #7594a8;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-list {
    overflow-y: auto;
    padding-right: 3px;
}

.chat-list::-webkit-scrollbar {
    width: 5px;
}

.chat-list::-webkit-scrollbar-thumb {
    background: #1b506c;
    border-radius: 20px;
}


/* =========================================================
   CHAT ITEMS
========================================================= */

.chat-item {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 9px;

    margin-bottom: 5px;
    padding: 10px;

    border-radius: 9px;

    color: #c9e2ed;

    cursor: pointer;
    transition: 0.2s ease;
}

.chat-item:hover {
    background: #0b293d;
}

.chat-item.active {
    background: #0e354d;
    border: 1px solid #18506d;
}

.chat-item-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.chat-item-title {
    flex: 1;
    min-width: 0;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: 14px;
}

.delete-chat {
    width: 25px;
    height: 25px;

    flex-shrink: 0;

    border: none;
    border-radius: 7px;

    background: transparent;
    color: #668798;

    cursor: pointer;
    opacity: 0;

    transition: 0.2s ease;
}

.chat-item:hover .delete-chat {
    opacity: 1;
}

.delete-chat:hover {
    background: #3b2028;
    color: #ff8fa0;
}


/* =========================================================
   EMPTY HISTORY
========================================================= */

.empty-history {
    padding: 12px 7px;

    color: #557385;

    font-size: 13px;
    line-height: 1.5;
}


/* =========================================================
   SIDEBAR BOTTOM
========================================================= */

.sidebar-bottom {
    padding-top: 15px;
    margin-top: 10px;

    border-top: 1px solid #15354a;

    color: #718d9e;
    line-height: 1.6;
}

.sidebar-bottom small {
    font-size: 11px;
}


/* =========================================================
   CHAT AREA
========================================================= */

.chat-area {
    flex: 1;
    min-width: 0;

    display: flex;
    flex-direction: column;

    background:
        radial-gradient(
            circle at 100% 0%,
            rgba(19, 131, 173, 0.20),
            transparent 34%
        ),
        radial-gradient(
            circle at 0% 100%,
            rgba(11, 78, 108, 0.10),
            transparent 30%
        ),
        #061622;
}


/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    height: 70px;
    flex-shrink: 0;

    display: flex;
    align-items: center;

    padding: 0 28px;

    border-bottom: 1px solid #15354a;

    background: rgba(5, 18, 29, 0.78);

    backdrop-filter: blur(14px);
}

.topbar h1 {
    margin-bottom: 3px;

    font-size: 21px;
    font-weight: 700;
}

.topbar span {
    color: #78b9d3;
    font-size: 13px;
}


/* =========================================================
   MESSAGES
========================================================= */

.messages {
    flex: 1;

    overflow-y: auto;

    padding: 35px;

    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
    width: 7px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: #174a65;
    border-radius: 20px;
}

.message {
    display: flex;

    gap: 13px;

    max-width: 850px;

    margin-bottom: 25px;
}

.avatar {
    min-width: 32px;
    font-size: 25px;
}

.bubble {
    padding: 14px 18px;

    border-radius: 16px;

    font-size: 15px;
    line-height: 1.65;

    word-wrap: break-word;
    white-space: pre-wrap;
}


/* =========================================================
   AI MESSAGE
========================================================= */

.ai-message .bubble {
    background:
        linear-gradient(
            135deg,
            #0b273b,
            #0c2d43
        );

    border: 1px solid #174a65;
    color: #e7f8ff;

    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.16);
}


/* =========================================================
   USER MESSAGE
========================================================= */

.user-message {
    margin-left: auto;
    flex-direction: row-reverse;
}

.user-message .bubble {
    background:
        linear-gradient(
            135deg,
            #096488,
            #1186ad
        );

    border: 1px solid #2496bd;
    color: #ffffff;

    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.16);
}


/* =========================================================
   INPUT AREA
========================================================= */

.input-area {
    display: flex;

    gap: 10px;

    padding: 18px 25px 22px;

    border-top: 1px solid #15354a;

    background: rgba(5, 18, 29, 0.90);

    backdrop-filter: blur(14px);
}

.input-area input {
    flex: 1;
    min-width: 0;

    padding: 15px 17px;

    border: 1px solid #1b4e69;
    border-radius: 13px;

    outline: none;

    background: #092236;
    color: #ffffff;

    font-size: 16px;

    transition: 0.2s ease;
}

.input-area input::placeholder {
    color: #708e9f;
}

.input-area input:focus {
    border-color: #35abd6;

    box-shadow:
        0 0 0 3px rgba(53, 171, 214, 0.12);
}

.input-area button {
    width: 55px;

    border: 1px solid #2496bd;
    border-radius: 13px;

    background:
        linear-gradient(
            135deg,
            #0b769b,
            #1396c1
        );

    color: #ffffff;

    font-size: 21px;

    cursor: pointer;
    transition: 0.2s ease;
}

.input-area button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}


/* =========================================================
   TEACH PANEL
========================================================= */

.teach-panel {
    margin: 20px 35px;

    padding: 20px;

    background: #092337;

    border: 1px solid #174a65;
    border-radius: 15px;
}

.teach-panel h2 {
    margin-bottom: 8px;
}

.teach-panel p {
    margin-bottom: 15px;
    color: #7895a8;
}

.teach-panel input,
.teach-panel textarea {
    width: 100%;

    padding: 12px;
    margin-bottom: 10px;

    border: 1px solid #174a65;
    border-radius: 9px;

    outline: none;

    background: #061a29;
    color: #ffffff;
}

.teach-panel textarea {
    min-height: 100px;
    resize: vertical;
}

.teach-buttons {
    display: flex;
    gap: 10px;
}

.teach-buttons button {
    padding: 10px 15px;

    border: none;
    border-radius: 9px;

    cursor: pointer;
}


/* =========================================================
   LOGIN / SIGNUP PAGE
========================================================= */

.auth-screen {
    width: 100%;
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;

    padding: 30px 18px;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 15% 15%,
            rgba(19, 131, 173, 0.20),
            transparent 32%
        ),
        radial-gradient(
            circle at 85% 85%,
            rgba(37, 150, 189, 0.15),
            transparent 32%
        ),
        #061522;
}


/* =========================================================
   LOGIN GLOW
========================================================= */

.auth-background-glow {
    position: absolute;

    width: 420px;
    height: 420px;

    border-radius: 50%;

    background: rgba(19, 131, 173, 0.08);

    filter: blur(90px);

    pointer-events: none;
}


/* =========================================================
   LOGIN CARD
========================================================= */

.auth-box {
    position: relative;
    z-index: 2;

    width: 100%;
    max-width: 430px;

    padding: 38px;

    border: 1px solid #174966;
    border-radius: 22px;

    background:
        linear-gradient(
            145deg,
            rgba(10, 34, 51, 0.96),
            rgba(5, 20, 31, 0.96)
        );

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.48);

    backdrop-filter: blur(18px);
}


/* =========================================================
   LOGIN BRAND
========================================================= */

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    margin-bottom: 28px;
}

.auth-logo {
    width: 43px;
    height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            #08759a,
            #18a0d0
        );

    color: #ffffff;

    font-size: 22px;
    font-weight: 800;

    box-shadow:
        0 8px 28px rgba(19, 131, 173, 0.30);
}

.auth-brand-name {
    color: #f1fbff;

    font-size: 25px;
    font-weight: 750;

    letter-spacing: -0.5px;
}


/* =========================================================
   LOGIN HEADING
========================================================= */

.auth-heading {
    text-align: center;
    margin-bottom: 28px;
}

.auth-heading h1 {
    margin-bottom: 8px;

    color: #f1fbff;

    font-size: 25px;
    font-weight: 700;

    line-height: 1.25;
}

.auth-heading p {
    color: #7895a8;
    font-size: 14px;
}


/* =========================================================
   LOGIN FIELDS
========================================================= */

.auth-field {
    margin-bottom: 18px;
}

.auth-field label {
    display: block;

    margin-bottom: 8px;

    color: #cce8f5;

    font-size: 13px;
    font-weight: 600;
}

.auth-field input {
    width: 100%;
    height: 50px;

    padding: 0 14px;

    border: 1px solid #174966;
    border-radius: 11px;

    outline: none;

    background: #061a29;
    color: #f2fbff;

    font-size: 14px;

    transition: 0.2s ease;
}

.auth-field input::placeholder {
    color: #557588;
}

.auth-field input:hover {
    border-color: #23627f;
}

.auth-field input:focus {
    border-color: #36a9d6;

    box-shadow:
        0 0 0 3px rgba(54, 169, 214, 0.12);
}


/* =========================================================
   PASSWORD
========================================================= */

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 65px;
}

.password-toggle {
    position: absolute;

    right: 7px;
    top: 50%;

    transform: translateY(-50%);

    padding: 7px;

    border: none;
    border-radius: 6px;

    background: transparent;

    color: #75b9d8;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}

.password-toggle:hover {
    background: #0b2b40;
    color: #a9e4fa;
}


/* =========================================================
   FORGOT PASSWORD
========================================================= */

.auth-forgot {
    display: flex;
    justify-content: flex-end;

    margin-top: -5px;
    margin-bottom: 18px;
}

.auth-forgot button {
    padding: 4px;

    border: none;

    background: transparent;

    color: #75b9d8;

    font-size: 12px;

    cursor: pointer;
}

.auth-forgot button:hover {
    color: #b1e9ff;
    text-decoration: underline;
}


/* =========================================================
   MAIN AUTH BUTTON
========================================================= */

.auth-main-button {
    width: 100%;
    height: 50px;

    border: 1px solid #2496bd;
    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            #08759a,
            #139dcc
        );

    color: #ffffff;

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 10px 28px rgba(19, 131, 173, 0.22);

    transition: 0.2s ease;
}

.auth-main-button:hover {
    transform: translateY(-1px);

    filter: brightness(1.08);

    box-shadow:
        0 14px 32px rgba(19, 131, 173, 0.30);
}

.auth-main-button:active {
    transform: translateY(0);
}


/* =========================================================
   AUTH MESSAGE
========================================================= */

.auth-message {
    min-height: 20px;

    margin-top: 12px;

    text-align: center;

    color: #79c7e5;

    font-size: 13px;
    line-height: 1.5;
}


/* =========================================================
   DIVIDER
========================================================= */

.auth-divider {
    display: flex;
    align-items: center;

    gap: 12px;

    margin: 24px 0 18px;

    color: #557588;

    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";

    flex: 1;

    height: 1px;

    background: #15354a;
}

.auth-divider span {
    flex-shrink: 0;
}


/* =========================================================
   SWITCH AUTH
========================================================= */

.switch-button {
    width: 100%;

    padding: 11px 10px;

    border: 1px solid #164766;
    border-radius: 10px;

    background: #0a2537;

    color: #a9cddd;

    font-size: 13px;

    cursor: pointer;

    transition: 0.2s ease;
}

.switch-button:hover {
    background: #0d3047;

    border-color: #21617f;

    color: #e5f8ff;
}

.switch-button strong {
    color: #75c9ea;
}


/* =========================================================
   AUTH FOOTER
========================================================= */

.auth-footer {
    margin-top: 22px;

    color: #557588;

    font-size: 11px;
    line-height: 1.6;

    text-align: center;
}

.auth-footer a {
    color: #75b9d8;
    text-decoration: none;
}

.auth-footer a:hover {
    color: #a9e4fa;
    text-decoration: underline;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {

    .sidebar {
        position: fixed;

        z-index: 100;

        top: 0;
        bottom: 0;
        left: 0;

        transform: translateX(-100%);

        box-shadow:
            15px 0 45px rgba(0, 0, 0, 0.40);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .open-toggle {
        display: flex;
    }

    .messages {
        padding: 20px 15px;
    }

    .message {
        max-width: 95%;
    }

    .input-area {
        padding: 12px;
    }

    .topbar {
        padding: 0 18px;
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 500px) {

    .input-area input {
        font-size: 14px;
    }

    .input-area button {
        width: 48px;
    }

    .auth-screen {
        padding: 18px 12px;
    }

    .auth-box {
        padding: 28px 21px;
        border-radius: 18px;
    }

    .auth-heading h1 {
        font-size: 22px;
    }

    .auth-logo {
        width: 39px;
        height: 39px;
        font-size: 20px;
    }

    .auth-brand-name {
        font-size: 22px;
    }
}