*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

html{
    scroll-behavior:smooth;
}

body{
    font-family:'Montserrat',sans-serif;
    background:#f6f6f3;
    color:#404040;
    min-height:100vh;
}

/* =========================
   ESTRUTURA PRINCIPAL
========================= */

.app-layout{
    min-height:100vh;
}

.main-content{
    min-width:0;
}

/* =========================
   BARRA LATERAL
========================= */

.sidebar{
    position:fixed;
    top:0;
    left:0;
    width:285px;
    height:100vh;
    background:#f1f1ed;
    border-right:1px solid #e2e2dc;
    padding:24px 18px;
    display:flex;
    flex-direction:column;
    z-index:2000;
    overflow-y:auto;
}

.sidebar-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:22px;
}

.sidebar-logo{
    text-decoration:none;
    color:#1f1f1f;
    font-size:24px;
    font-weight:800;
}

.menu-close{
    display:none;
    width:38px;
    height:38px;
    border:none;
    border-radius:50%;
    background:white;
    color:#333;
    cursor:pointer;
    font-size:17px;
}

.new-chat{
    width:100%;
    border:none;
    background:#222;
    color:white;
    padding:14px 18px;
    border-radius:999px;
    font-family:inherit;
    font-size:14px;
    font-weight:700;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    margin-bottom:25px;
    transition:.25s;
}

.new-chat:hover{
    transform:translateY(-2px);
}

.sidebar-menu{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.sidebar-link{
    text-decoration:none;
    color:#404040;
    padding:12px 14px;
    border-radius:14px;
    display:flex;
    align-items:center;
    gap:12px;
    font-size:15px;
    font-weight:600;
    transition:.2s;
}

.sidebar-link:hover,
.sidebar-link.active{
    background:white;
    color:#111;
}

.sidebar-icon{
    width:24px;
    text-align:center;
}

.conversation-history{
    margin-top:28px;
}

.history-title{
    color:#8a8a84;
    font-size:13px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:1px;
    margin:0 10px 12px;
}

.history-item{
    width:100%;
    border:none;
    background:transparent;
    color:#4b4b4b;
    font-family:inherit;
    text-align:left;
    padding:11px 12px;
    border-radius:12px;
    cursor:pointer;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    transition:.2s;
}

.history-item:hover{
    background:white;
    color:#111;
}

.sidebar-footer{
    margin-top:auto;
    padding-top:24px;
}

.sidebar-settings{
    width:100%;
    border:none;
    background:transparent;
    color:#555;
    font-family:inherit;
    font-size:14px;
    font-weight:600;
    text-align:left;
    padding:12px 14px;
    border-radius:12px;
    cursor:pointer;
}

.sidebar-settings:hover{
    background:white;
}

.sidebar-overlay{
    display:none;
}

/* =========================
   CONTEÚDO À DIREITA
========================= */

.main-content{
    margin-left:285px;
    min-height:100vh;
}

/* =========================
   CABEÇALHO
========================= */

.ai-header{
    width:100%;
    padding:22px 30px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:white;
    border-bottom:1px solid #ececec;
}

.header-left{
    display:flex;
    align-items:center;
    gap:14px;
}

.menu-button{
    display:none;
    width:42px;
    height:42px;
    border:none;
    border-radius:50%;
    background:#f3f3f0;
    color:#333;
    cursor:pointer;
    font-size:20px;
}

.back-link{
    text-decoration:none;
    color:#555;
    font-size:28px;
    font-weight:bold;
}

.ai-logo{
    text-decoration:none;
    color:#111;
    font-size:30px;
    font-weight:800;
}

.ai-status{
    background:#222;
    color:white;
    padding:8px 16px;
    border-radius:999px;
    font-size:14px;
    font-weight:700;
}

/* =========================
   ÁREA PRINCIPAL
========================= */

.ai-main{
    max-width:900px;
    margin:auto;
    padding:60px 20px;
}

.intro-label{
    letter-spacing:2px;
    font-size:13px;
    font-weight:700;
    color:#777;
    margin-bottom:10px;
}

h1{
    font-size:64px;
    margin-bottom:20px;
}

.intro-text{
    font-size:20px;
    color:#666;
    max-width:700px;
    line-height:1.7;
}

.suggestions{
    margin-top:45px;
    display:flex;
    flex-wrap:wrap;
    gap:15px;
}

.suggestion-button{
    border:none;
    cursor:pointer;
    background:white;
    border-radius:40px;
    padding:15px 22px;
    font-family:inherit;
    font-size:15px;
    transition:.3s;
    box-shadow:0 6px 18px rgba(0,0,0,.05);
}

.suggestion-button:hover{
    transform:translateY(-2px);
}

.chat-card{
    margin-top:40px;
    background:white;
    border-radius:24px;
    padding:25px;
    box-shadow:0 10px 30px rgba(0,0,0,.06);
}

.chat-messages{
    min-height:180px;
    margin-bottom:20px;
}

.message{
    max-width:82%;
    margin-bottom:16px;
    padding:18px;
    border-radius:18px;
    line-height:1.6;
    animation:messageAppear .25s ease;
}

.ai-message,
.loading-message{
    background:#f3f3f3;
    margin-right:auto;
}

.user-message{
    background:#222;
    color:white;
    margin-left:auto;
}

.message-name{
    display:block;
    font-weight:800;
    margin-bottom:8px;
}

.message p{
    white-space:pre-wrap;
    overflow-wrap:anywhere;
}

textarea{
    width:100%;
    min-height:140px;
    border:none;
    resize:none;
    outline:none;
    background:#fafafa;
    border-radius:16px;
    padding:20px;
    font-family:inherit;
    font-size:16px;
}

textarea:focus{
    box-shadow:0 0 0 2px #e2e2dc;
}

.form-footer{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-top:20px;
}

.input-hint{
    color:#777;
    font-size:14px;
}

#send-button{
    border:none;
    cursor:pointer;
    background:#222;
    color:white;
    padding:14px 28px;
    border-radius:999px;
    font-family:inherit;
    font-weight:700;
}

#send-button:disabled{
    cursor:not-allowed;
    opacity:.55;
}

.ai-warning{
    margin-top:25px;
    color:#777;
    font-size:14px;
}

.ai-footer{
    padding:40px;
    text-align:center;
    color:#777;
}

.sr-only{
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0,0,0,0);
    white-space:nowrap;
    border:0;
}

/* =========================
   ANIMAÇÕES
========================= */

.loading-message p::after{
    content:"";
    display:inline-block;
    width:18px;
    animation:analyzingDots 1.2s infinite;
}

@keyframes messageAppear{
    from{
        opacity:0;
        transform:translateY(8px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }
}

@keyframes analyzingDots{
    0%{
        content:"";
    }

    25%{
        content:".";
    }

    50%{
        content:"..";
    }

    75%,
    100%{
        content:"...";
    }
}

/* =========================
   CELULAR E TABLET
========================= */

@media(max-width:900px){

    .sidebar{
        transform:translateX(-100%);
        transition:transform .3s ease;
        box-shadow:12px 0 35px rgba(0,0,0,.12);
    }

    .sidebar.open{
        transform:translateX(0);
    }

    .sidebar-overlay{
        position:fixed;
        inset:0;
        background:rgba(0,0,0,.28);
        z-index:1500;
    }

    .sidebar-overlay.active{
        display:block;
    }

    .menu-close{
        display:block;
    }

    .main-content{
        margin-left:0;
    }

    .menu-button{
        display:block;
    }
}

@media(max-width:768px){

    .sidebar{
        width:min(82vw, 320px);
    }

    .ai-header{
        padding:16px 18px;
    }

    .ai-logo{
        font-size:22px;
    }

    .ai-status{
        padding:7px 13px;
        font-size:12px;
    }

    .back-link{
        font-size:24px;
    }

    .ai-main{
        padding:38px 16px;
    }

    h1{
        font-size:42px;
    }

    .intro-text{
        font-size:17px;
    }

    .suggestions{
        margin-top:30px;
        gap:10px;
    }

    .suggestion-button{
        padding:13px 17px;
        font-size:13px;
    }

    .chat-card{
        margin-top:30px;
        padding:18px;
        border-radius:20px;
    }

    .message{
        max-width:95%;
    }

    .form-footer{
        flex-direction:column;
        gap:15px;
        align-items:flex-start;
    }

    #send-button{
        width:100%;
    }
}