:root{
    --bg:#080c18;
    --sidebar:#0c1120;
    --card:#111827;

    --violet:#7c5cfc;
    --violet-mid:#9d7dfd;
    --violet-soft:rgba(124,92,252,.12);
    --violet-glow:rgba(124,92,252,.35);

    --rose:#f25c8a;

    --text:#eef2ff;
    --muted:#7c87a0;

    --border:rgba(255,255,255,.07);
}

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'DM Sans','Segoe UI',sans-serif;
}

body{
    height:100vh;
    overflow:hidden;
    background:
        radial-gradient(circle at top left,#0f1428,#080c18 40%),
        radial-gradient(circle at bottom right,#0a0616,#080c18 50%);
    color:var(--text);
}

.app{
    display:flex;
    height:100vh;
}

/* =====================
   SIDEBAR
===================== */

.sidebar{
    width:250px;
    background:rgba(12,17,32,.9);
    backdrop-filter:blur(20px);
    border-right:1px solid var(--border);
    padding:20px;
    display:flex;
    flex-direction:column;
}

.brand{
    margin-bottom:25px;
}

.brand h2{
    font-family:'Sora',sans-serif;
    font-size:22px;
    font-weight:700;
    margin-bottom:8px;
    color:var(--text);
    letter-spacing:-0.3px;
}

.brand p{
    color:var(--muted);
    font-size:13px;
    line-height:1.5;
}

.upload-btn{
    width:100%;
    padding:14px;
    border:none;
    border-radius:14px;
    cursor:pointer;
    font-family:'Sora',sans-serif;
    font-weight:700;
    font-size:13px;
    background:linear-gradient(135deg, var(--violet), var(--violet-mid));
    color:#fff;
    transition:.3s;
    box-shadow:
        0 0 10px var(--violet-soft),
        0 0 25px rgba(124,92,252,.1);
}

.upload-btn:hover{
    transform:translateY(-2px);
    box-shadow:
        0 0 20px var(--violet-glow),
        0 0 40px rgba(124,92,252,.2);
}

.documents-section{
    margin-top:30px;
    overflow-y:auto;
}

.documents-section h3{
    margin-bottom:15px;
    font-family:'Sora',sans-serif;
    font-size:13px;
    font-weight:600;
    letter-spacing:.8px;
    text-transform:uppercase;
    color:var(--muted);
}

#documentsList{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.document-card{
    background:rgba(255,255,255,.03);
    border:1px solid rgba(255,255,255,.06);
    backdrop-filter:blur(10px);
    border-radius:12px;
    padding:12px;
    cursor:pointer;
    transition:.3s;
    color:var(--text);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    font-size:13px;
}

.document-card:hover{
    border-color:rgba(124,92,252,.4);
    background:var(--violet-soft);
    transform:translateY(-2px);
}

/* =====================
   MAIN
===================== */

.main{
    flex:1;
    display:flex;
    flex-direction:column;
    height:100vh;
}

/* =====================
   HERO
===================== */

.hero{
    text-align:center;
    margin-top:160px;
    animation:fadeIn 1s ease;
}

.hero h1{
    font-family:'Sora',sans-serif;
    font-size:72px;
    font-weight:800;
    margin-bottom:12px;
    letter-spacing:-3px;
    background:linear-gradient(135deg,#ffffff 0%,#b9a8ff 55%,var(--rose) 100%);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
}

.hero p{
    font-size:18px;
    color:var(--muted);
}

/* =====================
   CHAT
===================== */

.chat-container{
    flex:1;
    overflow-y:auto;
    padding:40px 80px;
}

.user-message{
    display:flex;
    justify-content:flex-end;
    margin-bottom:25px;
    animation:fadeIn .4s ease;
}

.user-bubble{
    max-width:60%;
    padding:16px 20px;
    background:linear-gradient(135deg, var(--violet), var(--violet-mid));
    color:#fff;
    border-radius:20px;
    font-weight:500;
    box-shadow:0 0 15px var(--violet-soft);
}

.ai-message{
    display:flex;
    justify-content:flex-start;
    margin-bottom:25px;
    animation:fadeIn .4s ease;
}

.ai-bubble{
    max-width:75%;
    padding:20px;
    background:rgba(255,255,255,.03);
    backdrop-filter:blur(20px);
    border:1px solid rgba(255,255,255,.08);
    border-radius:20px;
    color:var(--text);
    line-height:1.8;
    box-shadow:0 0 20px rgba(255,255,255,.03);
}

/* =====================
   SOURCES
===================== */

.sources{
    margin-top:15px;
    padding-top:12px;
    border-top:1px solid rgba(255,255,255,.08);
}

.sources-title{
    margin-bottom:10px;
    color:var(--muted);
    font-size:13px;
}

.source-item{
    color:#a78bfa;
    margin-bottom:5px;
    font-size:14px;
}

/* =====================
   INPUT
===================== */

.input-wrapper{
    padding:25px;
}

.input-box{
    max-width:900px;
    margin:auto;
    display:flex;
    align-items:center;
    gap:10px;
    background:rgba(255,255,255,.03);
    backdrop-filter:blur(20px);
    border:1px solid rgba(255,255,255,.08);
    border-radius:24px;
    padding:12px;
    box-shadow:0 0 30px rgba(124,92,252,.06);
    transition:border-color .25s;
}

.input-box:focus-within{
    border-color:rgba(124,92,252,.4);
}

textarea{
    flex:1;
    border:none;
    outline:none;
    resize:none;
    height:40px;
    background:none;
    color:var(--text);
    font-size:15px;
    font-family:'DM Sans',sans-serif;
    padding:10px;
}

textarea::placeholder{
    color:#3d4a5c;
}

#sendBtn{
    width:50px;
    height:50px;
    border:none;
    border-radius:50%;
    background:linear-gradient(135deg, var(--violet), var(--violet-mid));
    color:white;
    cursor:pointer;
    font-size:18px;
    font-weight:bold;
    transition:.3s;
    box-shadow:0 0 15px var(--violet-glow);
}

#sendBtn:hover{
    transform:scale(1.08);
    box-shadow:0 0 25px var(--violet-glow);
}

/* =====================
   THINKING
===================== */

.typing{
    display:flex;
    gap:6px;
}

.typing span{
    width:8px;
    height:8px;
    border-radius:50%;
    background:var(--violet);
    animation:bounce 1.4s infinite;
}

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

@keyframes bounce{
    0%,80%,100%{ transform:translateY(0);    opacity:.4; }
    40%         { transform:translateY(-6px); opacity:1;  }
}

@keyframes fadeIn{
    from{ opacity:0; transform:translateY(10px); }
    to  { opacity:1; transform:translateY(0);    }
}

/* =====================
   SCROLLBAR
===================== */

::-webkit-scrollbar{ width:6px; }

::-webkit-scrollbar-thumb{
    background:rgba(124,92,252,.2);
    border-radius:20px;
}

::-webkit-scrollbar-thumb:hover{
    background:rgba(124,92,252,.35);
}

/* =====================
   MOBILE
===================== */

@media(max-width:768px){

    .sidebar{ display:none; }

    .chat-container{ padding:20px; }

    .hero{ margin-top:120px; }

    .hero h1{ font-size:48px; }

    .user-bubble,
    .ai-bubble{ max-width:90%; }
}

.content-wrapper{
    display:flex;
    height:100%;
}

.chat-section{
    flex:1;
    display:flex;
    flex-direction:column;
}

.pdf-panel{
    width:0;
    overflow:hidden;
    background:#070b16;
    display:flex;
    flex-direction:column;
    transition:all .3s ease;
    border-left:none;
}

.pdf-panel.active{
    width:40%;
    border-left:1px solid var(--border);
}

.close-preview{
    background:none;
    border:none;
    color:var(--muted);
    font-size:18px;
    cursor:pointer;
    transition:color .2s;
}

.close-preview:hover{
    color:var(--rose);
}

.pdf-header{
    padding:20px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    border-bottom:1px solid var(--border);
}

.pdf-header h3{
    font-family:'Sora',sans-serif;
    font-size:14px;
    font-weight:600;
    color:var(--text);
}

#pdfViewer{
    flex:1;
    width:100%;
    border:none;
    background:white;
}


.history-section{

    margin-top:25px;

    overflow-y:auto;
}

.history-section h3{

    margin-bottom:15px;

    color:white;
}

#historyList{

    display:flex;

    flex-direction:column;

    gap:8px;
}

.history-item{

    padding:10px;

    background:rgba(255,255,255,.04);

    border:1px solid rgba(255,255,255,.06);

    border-radius:10px;

    cursor:pointer;

    color:#cbd5e1;

    font-size:13px;

    transition:.3s;
}

.history-item:hover{

    border-color:#00d9ff;

    color:white;
}

.history-section hr{
    border:none;
    border-top:1px solid rgba(255,255,255,.1);
    margin:20px 0;
}

.history-item{

    position:relative;

    padding:12px;

    background:rgba(255,255,255,.04);

    border:1px solid rgba(255,255,255,.06);

    border-radius:10px;

    cursor:pointer;

    transition:.3s;
}

.history-item:hover{

    border-color:#7c5cfc;

    background:rgba(124,92,252,.08);

}

.document-selector{

    max-width:900px;
    margin:0 auto 12px auto;

}

#selectedDocument{

    width:100%;

    padding:12px;

    border-radius:12px;

    background:#111827;

    color:white;

    border:1px solid rgba(255,255,255,.1);

    outline:none;

    cursor:pointer;
}

.chat-actions{

    max-width:900px;

    margin:0 auto 12px auto;

    display:flex;

    justify-content:flex-end;

}

.clear-chat-btn{

    padding:10px 15px;

    border:none;

    border-radius:10px;

    cursor:pointer;

    background:rgba(255,255,255,.05);

    color:#cbd5e1;

    border:1px solid rgba(255,255,255,.08);

    transition:.3s;
}

.clear-chat-btn:hover{

    border-color:#ef4444;

    color:#ef4444;
}

.empty-state{

    padding:15px;

    text-align:center;

    color:var(--muted);

    font-size:13px;

    border:1px dashed rgba(255,255,255,.08);

    border-radius:10px;

    background:rgba(255,255,255,.02);
}

.hero-hint{

    margin-top:25px;

    color:var(--muted);

    line-height:1.8;

    font-size:14px;
}

:root{
    --bg:#080c18;
    --sidebar:#0c1120;
    --card:#111827;

    --violet:#0d9488;
    --violet-mid:#14b8a6;
    --violet-soft:rgba(13,148,136,.12);
    --violet-glow:rgba(13,148,136,.35);

    --rose:#f472b6;

    --text:#eef2ff;
    --muted:#7c87a0;

    --border:rgba(255,255,255,.07);
}

#logoutBtn{
    width:100%;
    padding:11px;
    border:none;
    border-radius:14px;
    cursor:pointer;
    font-family:'Sora',sans-serif;
    font-weight:700;
    font-size:13px;
    background:linear-gradient(135deg,#e11d48,#f43f5e);
    color:#fff;
    transition:.3s;
    margin-bottom:10px;
    box-shadow:0 0 10px rgba(225,29,72,.15);
}

#logoutBtn:hover{
    transform:translateY(-2px);
    box-shadow:0 0 20px rgba(225,29,72,.35);
}

/* Toast Notification */

#toast{
    position: fixed;
    top: 25px;
    right: 25px;
    min-width: 300px;
    max-width: 380px;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 15px;
    opacity: 0;
    transform: translateX(120%);
    transition: all .35s ease;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(0,0,0,.25);
}

#toast.show{
    opacity: 1;
    transform: translateX(0);
}

#toast.success{
    background:#16a34a;
}

#toast.error{
    background:#dc2626;
}

#toast.info{
    background:#2563eb;
}