* {
    box-sizing: border-box;
}

:root {
    --bg: #ffffff;
    --sidebar: #f9f9f9;
    --border: #e5e5e5;
    --hover: #ececec;
    --active: #e7f0eb;
    --text: #111111;
    --muted: #6b7280;
    --primary: #124734;
    --primary-soft: #e8f0eb;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

body {
    overflow: hidden;
}

.chat-layout {
    width: 100%;
    height: 100vh;
    display: flex;
}

/* SIDEBAR */

.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 14px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-inner::-webkit-scrollbar,
.messages::-webkit-scrollbar {
    width: 8px;
}

.sidebar-inner::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 8px 14px;
}

.brand-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
}

.brand h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
}

.brand p {
    margin: 1px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.side-action,
.side-link {
    width: 100%;
    min-height: 38px;
    border: 0;
    background: transparent;
    border-radius: 9px;
    padding: 8px 9px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    text-align: left;
    box-shadow: none;
}

.side-action:hover,
.side-link:hover,
.chat-item:hover {
    background: var(--hover);
}

.side-icon {
    width: 18px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: #222;
    font-size: 15px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    flex-shrink: 0;
}

.side-svg {
    width: 17px;
    height: 17px;
    display: block;
}

.side-section {
    margin-top: 16px;
}

.side-title {
    padding: 0 9px 7px;
    color: #444;
    font-size: 13px;
    font-weight: 700;
}

.side-info {
    width: 100%;
    min-height: 34px;
    border: 0;
    background: transparent;
    border-radius: 9px;
    padding: 7px 9px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
}

.side-info span:last-child {
    white-space: normal;
    word-break: break-word;
}

.search-box {
    width: calc(100% - 8px);
    margin: 0 4px 8px;
    height: 35px;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0 10px;
    background: #fff;
    outline: none;
    font-size: 13px;
}

.search-box:focus {
    border-color: #c8d4ce;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-item {
    min-height: 36px;
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 9px;
    font-size: 13.5px;
}

.chat-dot {
    color: #555;
    font-size: 12px;
    flex-shrink: 0;
}

.chat-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-chats {
    padding: 8px 9px;
    color: var(--muted);
    font-size: 13px;
}

.side-footer {
    margin-top: auto;
    padding: 14px 9px 4px;
    color: var(--muted);
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.side-footer small {
    font-size: 11px;
    color: #8a8f98;
}

/* MAIN */

.main {
    flex: 1;
    height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    position: relative;
    overflow: hidden;
}

/* Fundo institucional suave */
.main::before {
    content: "";
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 95px;
    background-image: url("../img/campus-bg.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: 0.50;
    pointer-events: none;
    z-index: 0;
}

/* Camada branca por cima para não atrapalhar a leitura */
.main::after {
    content: "";
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 95px;
    background: rgba(255, 255, 255, 0.78);
    pointer-events: none;
    z-index: 0;
}

.main-header,
.messages,
.composer-area {
    position: relative;
    z-index: 2;
}

.main-header {
    height: 64px;
    border-bottom: 1px solid var(--border);
    padding: 0 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(4px);
}

.main-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.main-header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 22px 0 120px;
    scroll-behavior: smooth;
    background: transparent;
}

.message-row {
    width: 100%;
    display: flex;
    padding: 0 24px;
    margin-bottom: 22px;
}

.message-row.bot,
.message-row.user {
    justify-content: center;
}

.message-content {
    width: min(760px, 100%);
    display: block;
}

.message-text {
    font-size: 15px;
    line-height: 1.65;
    color: #111;
    white-space: normal;
}

.user-message {
    max-width: 760px;
    margin-left: auto;
    background: rgba(244, 244, 244, 0.96);
    border-radius: 18px;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.55;
}

.message-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
    opacity: .72;
}

.message-tools button {
    border: 0;
    background: transparent;
    color: #666;
    padding: 4px 5px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 6px;
}

.message-tools button:hover {
    background: var(--hover);
    color: #111;
}

.typing {
    display: flex;
    gap: 5px;
    padding-top: 4px;
}

.typing span {
    width: 6px;
    height: 6px;
    background: #777;
    border-radius: 50%;
    opacity: .35;
    animation: blink 1.2s infinite;
}

.typing span:nth-child(2) {
    animation-delay: .18s;
}

.typing span:nth-child(3) {
    animation-delay: .36s;
}

@keyframes blink {
    0%, 80%, 100% {
        opacity: .25;
    }

    40% {
        opacity: 1;
    }
}

/* COMPOSER */

.composer-area {
    position: fixed;
    left: 260px;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, #ffffff 82%, rgba(255, 255, 255, 0));
    padding: 14px 24px 12px;
    z-index: 5;
}

.quick-suggestions {
    max-width: 760px;
    margin: 0 auto 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-suggestions button {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    color: #333;
    border-radius: 999px;
    padding: 7px 11px;
    cursor: pointer;
    font-size: 12.5px;
}

.quick-suggestions button:hover {
    background: var(--hover);
}

.composer {
    max-width: 760px;
    min-height: 54px;
    margin: 0 auto;
    border: 1px solid #d9d9d9;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    align-items: center;
    padding: 7px 8px;
}

.plus-btn {
    width: 35px;
    height: 35px;
    border: 0;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: #333;
    border-radius: 50%;
}

.plus-btn:hover {
    background: var(--hover);
}

.composer input {
    flex: 1;
    border: 0;
    outline: none;
    height: 38px;
    font-size: 15px;
    background: transparent;
    color: var(--text);
}

.send-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #111;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.send-btn:hover {
    background: #333;
}

.notice {
    max-width: 760px;
    margin: 8px auto 0;
    text-align: center;
    font-size: 11.5px;
    color: var(--muted);
}

/* TABLET */

@media (max-width: 850px) {
    .sidebar {
        width: 220px;
    }

    .composer-area {
        left: 220px;
    }

    .main::before,
    .main::after {
        background-position: center center;
    }

    .message-content,
    .composer,
    .quick-suggestions,
    .notice {
        max-width: 700px;
    }
}

/* CELULAR */

@media (max-width: 700px) {
    body {
        overflow: hidden;
    }

    .chat-layout {
        flex-direction: column;
        height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: 215px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }

    .sidebar-inner {
        padding: 10px;
        overflow-y: auto;
    }

    .brand {
        padding: 2px 8px 10px;
    }

    .brand-logo {
        width: 28px;
        height: 28px;
    }

    .side-action,
    .side-link {
        min-height: 32px;
        padding: 6px 8px;
        font-size: 13.5px;
    }

    .side-section {
        margin-top: 10px;
    }

    .side-info {
        min-height: 30px;
        padding: 5px 8px;
        font-size: 12.5px;
    }

    .search-box {
        height: 32px;
    }

    .side-footer {
        display: none;
    }

    .main {
        height: calc(100vh - 215px);
        flex: 1;
    }

    .main-header {
        height: 56px;
        padding: 0 16px;
    }

    .main-header h2 {
        font-size: 15.5px;
        line-height: 1.25;
    }

    .main::before {
        top: 56px;
        bottom: 88px;
        background-size: cover;
        background-position: center center;
        opacity: 0.36;
    }

    .main::after {
        top: 56px;
        bottom: 88px;
        background: rgba(255, 255, 255, 0.82);
    }

    .messages {
        padding: 18px 0 118px;
    }

    .message-row {
        padding: 0 14px;
        margin-bottom: 18px;
    }

    .message-text {
        font-size: 14.5px;
        line-height: 1.6;
    }

    .user-message {
        max-width: 92%;
        font-size: 14.5px;
        padding: 9px 13px;
    }

    .composer-area {
        left: 0;
        padding: 10px 12px 9px;
        background: linear-gradient(to top, #ffffff 86%, rgba(255, 255, 255, 0));
    }

    .quick-suggestions {
        display: none;
    }

    .composer {
        min-height: 50px;
        border-radius: 24px;
    }

    .composer input {
        font-size: 14.5px;
    }

    .plus-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .send-btn {
        width: 34px;
        height: 34px;
    }

    .notice {
        font-size: 10.5px;
        margin-top: 6px;
    }
}

/* CELULAR MUITO PEQUENO */

@media (max-width: 420px) {
    .sidebar {
        height: 200px;
    }

    .main {
        height: calc(100vh - 200px);
    }

    .main-header h2 {
        font-size: 14.5px;
    }

    .side-action,
    .side-link {
        font-size: 13px;
    }

    .message-row {
        padding: 0 12px;
    }

    .composer-area {
        padding-left: 10px;
        padding-right: 10px;
    }
}


.chat-link {
    color: #124734;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(18, 71, 52, 0.35);
}

.chat-link:hover {
    border-bottom-color: #124734;
}

.message-text.escrevendo::after {
    content: "▋";
    display: inline-block;
    margin-left: 2px;
    animation: cursorBlink 0.8s infinite;
    color: #124734;
}

@keyframes cursorBlink {
    0%, 45% {
        opacity: 1;
    }

    46%, 100% {
        opacity: 0;
    }
}