/* FULL MOBILE RESPONSIVE STYLE.CSS */

*{box-sizing:border-box}

html,body{
    margin:0;
    min-height:100%;
    font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    color:#172033;
}

body{background:#f5f7fb}
a{color:inherit}
button,input,textarea{font:inherit}

.auth-page{
    min-height:100vh;
    background:radial-gradient(circle at 20% 10%,#dfe8ff 0,transparent 32%),
               radial-gradient(circle at 85% 85%,#ffe7d2 0,transparent 32%),
               #f7f9fc;
    overflow-x:hidden;
    overflow-y:auto;
}

.auth-wrap{
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:28px;
}

.glass-card{
    background:rgba(255,255,255,.9);
    backdrop-filter:blur(18px);
    border:1px solid rgba(255,255,255,.72);
    box-shadow:0 24px 70px rgba(33,51,99,.14);
    border-radius:28px;
}

.brand-badge{
    width:68px;height:68px;border-radius:20px;
    display:grid;place-items:center;
    margin:0 auto 20px;
    background:linear-gradient(135deg,#3457f1,#7548ee);
    color:#fff;font-weight:800;letter-spacing:.08em;
    box-shadow:0 12px 30px rgba(62,79,214,.28)
}

.brand-badge.small{
    width:42px;height:42px;border-radius:13px;margin:0;font-size:12px
}

.eyebrow{
    display:inline-block;text-transform:uppercase;letter-spacing:.16em;
    font-size:12px;font-weight:800;color:#5d6fa8;margin-bottom:10px
}

.auth-card{width:min(720px,100%);padding:34px}
.auth-card h1{font-size:34px;line-height:1.08;margin:8px 0 10px;color:#111a2c}
.account-helper{color:#778195;font-size:14px;margin:0 0 8px}
.back-link{display:inline-block;margin-bottom:18px;text-decoration:none;color:#6d7890}

.auth-tabs{
    display:grid;grid-template-columns:1fr 1fr;background:#eef2f8;
    border-radius:14px;padding:5px;margin-bottom:26px
}

.auth-tabs a{
    text-align:center;text-decoration:none;padding:11px;border-radius:10px;
    font-weight:750;color:#707a8f
}

.auth-tabs a.active{
    background:#fff;color:#3148b6;box-shadow:0 5px 14px rgba(29,45,99,.08)
}

.form-stack,.form-grid{display:grid;gap:16px;margin-top:22px}
.form-grid{grid-template-columns:1fr 1fr}
.span-2{grid-column:1/-1}

label{display:grid;gap:8px;font-size:13px;font-weight:750;color:#4e596e}
.optional{font-weight:500;color:#8a93a6}

input,textarea{
    width:100%;border:1px solid #dfe4ee;background:#fff;border-radius:13px;
    padding:13px 14px;outline:0;transition:border .2s,box-shadow .2s;color:#162034
}

input:focus,textarea:focus{
    border-color:#6177f2;box-shadow:0 0 0 4px rgba(81,103,237,.1)
}

.password-wrap{position:relative}
.password-wrap input{padding-right:72px}

.icon-btn{
    position:absolute;right:8px;top:50%;transform:translateY(-50%);
    border:0;background:#edf1f8;color:#53617a;border-radius:9px;
    padding:7px 10px;font-size:12px;cursor:pointer
}

.strength{height:5px;background:#edf0f6;border-radius:20px;overflow:hidden}
.strength span{
    height:100%;width:0;display:block;
    background:linear-gradient(90deg,#ef476f,#f7b32b,#2ec4b6);transition:.2s
}

.alert{padding:12px 14px;border-radius:12px;margin:12px 0;font-size:14px}
.alert.error{background:#fff0f2;color:#a32943;border:1px solid #ffd4dc}
.auth-switch{text-align:center;color:#778198;font-size:14px;margin:20px 0 0}
.auth-switch a{color:#4059d8;font-weight:800}

.btn{
    border:0;border-radius:14px;padding:14px 20px;text-decoration:none;
    font-weight:800;cursor:pointer;display:inline-flex;align-items:center;
    justify-content:center;transition:.2s transform,.2s box-shadow
}

.btn:hover{transform:translateY(-2px)}
.btn-primary{
    background:linear-gradient(135deg,#3457f1,#6a45e8);
    color:#fff;box-shadow:0 12px 26px rgba(68,79,223,.24)
}
.btn.full{width:100%}

/* CHAT */

.chat-page{
    height:100vh;height:100dvh;overflow:hidden;background:#eef2f7
}

.chat-app{
    display:grid;grid-template-columns:290px minmax(0,1fr);
    width:100%;height:100vh;height:100dvh;overflow:hidden
}

.chat-sidebar{
    background:#111827;color:#fff;padding:22px 18px;
    display:flex;flex-direction:column;justify-content:space-between;
    border-right:1px solid rgba(255,255,255,.06);
    overflow-y:auto;overflow-x:hidden
}

.brand-lockup{display:flex;gap:12px;align-items:center;margin-bottom:24px}
.brand-lockup strong,.brand-lockup span{display:block}
.brand-lockup strong{font-size:14px}
.brand-lockup span{font-size:11px;color:#9aa6bd;margin-top:2px}

.new-chat-btn{
    width:100%;border:1px solid #2a3850;background:#192335;color:#fff;
    border-radius:12px;padding:12px;text-align:left;cursor:pointer;font-weight:700
}

.sidebar-section{margin-top:26px}
.sidebar-label{
    display:block;font-size:11px;text-transform:uppercase;letter-spacing:.14em;
    color:#6f7e98;margin:0 4px 10px
}

.topic-chip{
    width:100%;text-align:left;border:0;background:transparent;color:#cbd4e4;
    padding:10px;border-radius:10px;cursor:pointer
}
.topic-chip:hover{background:#1b2639;color:#fff}

.sidebar-user{
    display:flex;align-items:center;gap:10px;padding-top:14px;border-top:1px solid #263249
}
.avatar{
    width:38px;height:38px;border-radius:12px;background:#4355dc;
    display:grid;place-items:center;font-weight:900
}
.user-meta{min-width:0;flex:1}
.user-meta strong,.user-meta span{
    display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap
}
.user-meta strong{font-size:13px}
.user-meta span{font-size:11px;color:#8e9bb2;margin-top:2px}
.logout-mini{text-decoration:none;color:#93a1b7}

.chat-main{
    min-width:0;width:100%;height:100%;
    background:#f7f9fc;display:grid;
    grid-template-rows:70px minmax(0,1fr) auto;
    overflow:hidden
}

.chat-header{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:12px;
    width:100%;
    min-width:0;
    padding:0 24px;
    border-bottom:1px solid #e5e9f1;
    background:rgba(255,255,255,.88);
    backdrop-filter:blur(12px)
}

.chat-title-wrap{min-width:0}
.chat-title-wrap strong{
    display:block;font-size:14px;white-space:nowrap;
    overflow:hidden;text-overflow:ellipsis
}

.online{font-size:11px;color:#718099}
.online i{
    display:inline-block;width:7px;height:7px;background:#31c48d;
    border-radius:50%;margin-right:5px
}

.header-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;
    min-width:0;
    margin-left:auto
}
.header-account-link{
    text-decoration:none;font-size:13px;font-weight:800;color:#4057df;
    padding:8px 12px;border-radius:10px;white-space:nowrap
}
.header-account-link:hover{background:#eef1ff}
.logged-in-label{font-size:12px;color:#738097}

.mobile-menu,.theme-toggle{
    border:0;background:#edf1f6;border-radius:10px;
    width:38px;height:38px;cursor:pointer
}
.mobile-menu{display:none}

.messages{
    min-width:0;min-height:0;overflow-y:auto;overflow-x:hidden;
    padding:28px clamp(18px,4vw,60px);scroll-behavior:smooth
}

.welcome-panel{max-width:850px;margin:7vh auto 0;text-align:center}
.bot-orb{
    width:66px;height:66px;border-radius:22px;margin:0 auto 18px;
    display:grid;place-items:center;
    background:linear-gradient(135deg,#4057e8,#8357ef);
    color:#fff;font-size:28px;box-shadow:0 15px 34px rgba(71,80,216,.25)
}
.welcome-panel h1{font-size:36px;margin:0 0 10px}
.welcome-panel>p{color:#778195;margin:0}

.guest-counter,.unlimited-badge{
    margin:14px auto 0;display:inline-block;background:#eef1ff;color:#4057df;
    padding:8px 14px;border-radius:999px;font-size:12px;font-weight:800
}
.unlimited-badge{background:#eafaf3;color:#25845d}

.quick-grid{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;margin-top:30px
}
.quick-grid button{
    min-width:0;padding:18px;border:1px solid #e3e7ef;background:#fff;
    border-radius:16px;text-align:left;cursor:pointer;transition:.2s
}
.quick-grid button:hover{
    transform:translateY(-2px);box-shadow:0 10px 24px rgba(40,50,90,.08)
}
.quick-grid span{font-size:22px}
.quick-grid strong,.quick-grid small{display:block}
.quick-grid strong{margin-top:9px}
.quick-grid small{color:#8a94a8;margin-top:4px}

.message-row{
    width:100%;max-width:900px;min-width:0;margin:0 auto 18px;
    display:flex;gap:10px;align-items:flex-start
}
.message-row.user{justify-content:flex-end}
.message-row.bot{justify-content:flex-start}

.message-bubble{
    width:auto;max-width:min(76%,720px);min-width:0;
    padding:14px 16px;border-radius:18px;line-height:1.55;font-size:14px;
    white-space:normal;overflow-wrap:anywhere;word-break:break-word;
    box-shadow:0 7px 18px rgba(35,48,85,.05)
}
.message-row.user .message-bubble{
    background:#4357df;color:#fff;border-bottom-right-radius:6px
}
.message-row.bot .message-bubble{
    background:#fff;color:#253047;border:1px solid #e5e9f1;
    border-bottom-left-radius:6px
}

.message-avatar{
    width:32px;min-width:32px;height:32px;border-radius:10px;
    background:#e8ebff;color:#4557d8;display:grid;place-items:center;
    font-size:14px;font-weight:900
}

.typing{display:inline-flex;gap:4px;align-items:center}
.typing i{
    width:6px;height:6px;border-radius:50%;background:#9aa4b6;
    animation:bounce 1s infinite
}
.typing i:nth-child(2){animation-delay:.14s}
.typing i:nth-child(3){animation-delay:.28s}
@keyframes bounce{
    0%,80%,100%{transform:translateY(0);opacity:.5}
    40%{transform:translateY(-5px);opacity:1}
}

.composer-wrap{
    min-width:0;width:100%;padding:10px clamp(18px,4vw,60px) 18px;
    background:#f7f9fc;overflow:hidden
}

.suggestions{
    max-width:900px;width:100%;min-width:0;margin:0 auto 8px;
    display:flex;gap:7px;overflow-x:auto;overflow-y:hidden;
    -webkit-overflow-scrolling:touch
}
.suggestions button{
    flex:0 0 auto;white-space:nowrap;border:1px solid #dee4ee;background:#fff;
    border-radius:999px;padding:8px 11px;font-size:11px;color:#59667d;cursor:pointer
}
.suggestions button:hover{border-color:#7282ec;color:#4057df}

.composer{
    max-width:900px;width:100%;min-width:0;margin:0 auto;
    display:grid;grid-template-columns:42px minmax(0,1fr) 46px;
    align-items:end;gap:8px;background:#fff;border:1px solid #dfe4ed;
    border-radius:18px;padding:8px;box-shadow:0 13px 35px rgba(30,43,80,.09)
}
.composer textarea{
    min-width:0;width:100%;border:0;box-shadow:none;padding:10px 4px;
    resize:none;max-height:130px;background:transparent
}
.composer textarea:focus{box-shadow:none}
.composer-icon,.send-btn{
    border:0;border-radius:12px;height:42px;cursor:pointer
}
.composer-icon{background:#f0f3f8}
.send-btn{background:#4057df;color:#fff;font-size:18px}

.composer-meta{
    max-width:900px;width:100%;margin:6px auto 0;
    display:flex;justify-content:space-between;
    font-size:10px;color:#98a1b0;padding:0 5px
}

/* MOBILE */
@media screen and (max-width:768px){
    html,body{
        width:100%;max-width:100%;overflow-x:hidden!important
    }

    body.chat-page{
        width:100vw!important;max-width:100vw!important;
        height:100dvh!important;overflow:hidden!important
    }

    .chat-app{
        display:block!important;width:100vw!important;max-width:100vw!important;
        height:100dvh!important;overflow:hidden!important
    }

    .chat-sidebar{
        position:fixed!important;top:0!important;bottom:0!important;
        left:-285px!important;width:280px!important;max-width:82vw!important;
        height:100dvh!important;z-index:9999!important;
        transition:left .25s ease!important;
        box-shadow:12px 0 28px rgba(0,0,0,.18)
    }

    .chat-sidebar.open{left:0!important}

    .chat-main{
        display:grid!important;
        grid-template-rows:64px minmax(0,1fr) auto!important;
        width:100vw!important;max-width:100vw!important;min-width:0!important;
        height:100dvh!important;margin:0!important;padding:0!important;
        overflow:hidden!important
    }

    .chat-header{
        width:100%!important;max-width:100%!important;min-width:0!important;
        height:64px!important;display:grid!important;
        grid-template-columns:44px minmax(0,1fr) auto!important;
        align-items:center!important;gap:8px!important;
        padding:0 10px!important;margin:0!important;overflow:hidden!important
    }

    .mobile-menu{
        display:grid!important;place-items:center!important;
        width:42px!important;height:42px!important;min-width:42px!important
    }

    .chat-title-wrap{
        width:100%!important;min-width:0!important;overflow:hidden!important
    }

    .chat-title-wrap strong{
        display:block!important;width:100%!important;
        white-space:nowrap!important;overflow:hidden!important;
        text-overflow:ellipsis!important;font-size:13px!important
    }

    .header-actions{
        width:auto!important;min-width:0!important;gap:4px!important
    }

    .header-account-link{
        max-width:105px!important;padding:6px 7px!important;
        font-size:10px!important;white-space:nowrap!important;
        overflow:hidden!important;text-overflow:ellipsis!important
    }

    .logged-in-label{display:none!important}

    .theme-toggle{
        width:36px!important;height:36px!important;min-width:36px!important
    }

    .messages{
        width:100%!important;max-width:100%!important;min-width:0!important;
        min-height:0!important;margin:0!important;padding:16px 10px!important;
        overflow-y:auto!important;overflow-x:hidden!important
    }

    .message-row{
        width:100%!important;max-width:100%!important;min-width:0!important;
        margin:0 0 14px!important;padding:0!important
    }

    .message-row.user{
        justify-content:flex-end!important;padding-left:35px!important
    }

    .message-row.bot{
        justify-content:flex-start!important;padding-right:0!important
    }

    .message-avatar{
        width:32px!important;min-width:32px!important;height:32px!important
    }

    .message-bubble{
        width:auto!important;max-width:calc(100vw - 64px)!important;
        min-width:0!important;padding:12px 13px!important;
        font-size:14px!important;line-height:1.5!important;
        white-space:normal!important;overflow-wrap:anywhere!important;
        word-break:break-word!important;box-sizing:border-box!important
    }

    .message-row.user .message-bubble{
        max-width:calc(100vw - 50px)!important
    }

    .welcome-panel{
        width:100%!important;max-width:100%!important;
        margin:18px auto 0!important;padding:0!important
    }

    .welcome-panel h1{font-size:26px!important}

    .quick-grid{
        width:100%!important;grid-template-columns:1fr!important;
        gap:10px!important;margin-top:20px!important
    }

    .quick-grid button{
        width:100%!important;min-width:0!important
    }

    .composer-wrap{
        width:100%!important;max-width:100%!important;min-width:0!important;
        margin:0!important;padding:7px 9px 10px!important;overflow:hidden!important
    }

    .suggestions{
        width:100%!important;max-width:100%!important;min-width:0!important;
        margin:0 0 7px!important;padding:0 0 3px!important;gap:7px!important;
        overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none
    }

    .suggestions::-webkit-scrollbar{display:none}

    .suggestions button{
        flex:0 0 auto!important;max-width:80vw!important;
        white-space:nowrap!important;overflow:hidden!important;
        text-overflow:ellipsis!important
    }

    .composer{
        display:grid!important;
        grid-template-columns:38px minmax(0,1fr) 42px!important;
        gap:6px!important;width:100%!important;max-width:100%!important;
        min-width:0!important;margin:0!important;padding:7px!important;
        box-sizing:border-box!important
    }

    .composer textarea{
        display:block!important;width:100%!important;max-width:100%!important;
        min-width:0!important;margin:0!important;padding:9px 4px!important;
        font-size:16px!important;box-sizing:border-box!important
    }

    .composer-icon{
        width:38px!important;min-width:38px!important;height:40px!important
    }

    .send-btn{
        width:42px!important;min-width:42px!important;height:40px!important
    }

    .composer-meta{
        width:100%!important;max-width:100%!important;
        margin:4px 0 0!important;padding:0 3px!important
    }

    .composer-meta span:first-child{display:none!important}
    .composer-meta span:last-child{margin-left:auto!important}

    .auth-wrap{padding:16px;align-items:start}
    .auth-card{
        width:100%;max-height:none;margin:10px 0;padding:22px 18px;
        overflow:visible
    }
    .form-grid{grid-template-columns:1fr}
    .span-2{grid-column:auto}
}

/* DESKTOP HEADER ALIGNMENT FIX */
@media screen and (min-width:769px){
    .mobile-menu{
        display:none !important;
    }

    .chat-header{
        grid-template-columns:minmax(0,1fr) auto !important;
    }

    .chat-title-wrap{
        grid-column:1;
        min-width:0;
    }

    .header-actions{
        grid-column:2;
        margin-left:auto;
        justify-content:flex-end;
    }
}
