/* =========================
   MODERN DARK UI - SHRINKAI
========================= */

:root{

    --bg:#09090b;
    --bg2:#111827;
    --card:#111318;
    --card2:#171a21;

    --border:rgba(255,255,255,.07);

    --text:#f3f4f6;
    --muted:#9ca3af;

    --primary:#8b5cf6;
    --primary2:#7c3aed;

    --ai:#1d4ed8;
    --user:#059669;

    --danger:#ef4444;

    --shadow:
        0 10px 35px rgba(0,0,0,.35);

    --radius:22px;
}

/* =========================
   RESET
========================= */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

html,
body{
    width:100%;
    height:100%;
    overflow:hidden;
}

body{

    font-family:
        Inter,
        system-ui,
        sans-serif;

    background:
        radial-gradient(
            circle at top,
            rgba(139,92,246,.16),
            transparent 25%
        ),

        linear-gradient(
            180deg,
            #09090b 0%,
            #0f172a 100%
        );

    color:var(--text);
}

/* =========================
   GLOBAL
========================= */

img{
    width:42px;
    height:42px;
    border-radius:0;
}

button,
textarea,
input{
    font-family:inherit;
}

button{
    border:none;
    cursor:pointer;

    transition:
        transform .18s ease,
        opacity .18s ease,
        background .18s ease;
}

button:hover{
    transform:translateY(-1px);
}

button:active{
    transform:scale(.97);
}

a{
    text-decoration:none;
    color:inherit;
}

/* =========================
   APP
========================= */

.app-wrapper{

    height:100vh;

    display:flex;
    flex-direction:column;

    overflow:hidden;
}

/* =========================
   NAVBAR
========================= */

.navbar{

    height:72px;

    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:0 22px;

    background:
        rgba(10,10,12,.7);

    backdrop-filter:blur(20px);

    border-bottom:
        1px solid var(--border);

    z-index:20;

    flex:none;
}

.brand{
    display:flex;
    align-items:center;
    gap:12px;
}

.brand h1{
    font-size:20px;
    font-weight:700;
}

.nav-actions{
    display:flex;
    align-items:center;
    gap:10px;
}

/* =========================
   BUTTONS
========================= */

.btn-back,
.info-btn,
.premium-open{

    height:42px;

    border-radius:14px;

    padding:0 16px;

    color:white;

    display:flex;
    align-items:center;
    justify-content:center;

    background:
        rgba(255,255,255,.06);

    border:
        1px solid rgba(255,255,255,.05);
}

.info-btn{
    width:42px;
    padding:0;
}

.premium-open{

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary2)
        );

    box-shadow:
        0 10px 30px rgba(139,92,246,.25);

    font-weight:600;
}

.premium-open:hover{

    box-shadow:
        0 14px 35px rgba(139,92,246,.4);
}

/* =========================
   LAYOUT
========================= */

.content-layout{

    flex:1;

    display:flex;

    overflow:hidden;

    min-height:0;
}

/* =========================
   SIDEBAR
========================= */

.sidebar{

    width:280px;
    min-width:280px;

    background:
        rgba(255,255,255,.025);

    border-right:
        1px solid var(--border);

    overflow-y:auto;
}

.sidebar-content{
    padding:20px;
}

.sidebar-content h3{

    font-size:15px;
    font-weight:600;

    color:var(--muted);

    margin-bottom:16px;
}

.sidebar-content > button{

    width:100%;
    height:48px;

    border-radius:16px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary2)
        );

    color:white;

    font-weight:600;

    margin-bottom:20px;
}

/* =========================
   HISTORY ITEMS
========================= */

.chat-item-wrapper{

    display:flex;
    align-items:center;

    gap:8px;

    margin-bottom:10px;
}

.chat-item{

    flex:1;

    background:
        rgba(255,255,255,.03);

    border:
        1px solid rgba(255,255,255,.04);

    padding:14px;

    border-radius:16px;

    font-size:14px;

    transition:.2s ease;

    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.chat-item:hover{

    background:
        rgba(255,255,255,.06);

    transform:translateX(3px);
}

.delete-chat-btn{

    width:34px;
    height:34px;

    min-width:34px;

    border-radius:12px;

    background:
        rgba(239,68,68,.15);

    color:#f87171;

    font-size:12px;
}

.delete-chat-btn:hover{
    background:
        rgba(239,68,68,.25);
}

/* =========================
   CHAT AREA
========================= */

.chat-area{

    flex:1;

    display:flex;
    flex-direction:column;

    padding:18px;

    gap:16px;

    min-width:0;
    min-height:0;

    overflow:hidden;
}

/* =========================
   CHAT
========================= */

#chat{

    flex:1;

    min-height:0;

    overflow-y:auto;
    overflow-x:hidden;

    scroll-behavior:smooth;

    -webkit-overflow-scrolling:touch;

    display:flex;
    flex-direction:column;

    gap:16px;

    padding:22px;

    border-radius:28px;

    background:
        rgba(255,255,255,.025);

    border:
        1px solid var(--border);
}

/* =========================
   MESSAGES
========================= */

.msg{

    max-width:720px;

    padding:16px 18px;

    border-radius:24px;

    line-height:1.65;

    font-size:15px;

    animation:fade .25s ease;

    box-shadow:var(--shadow);

    word-break:break-word;
}

@keyframes fade{

    from{
        opacity:0;
        transform:translateY(10px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }
}

.msg.ai{

    align-self:flex-start;

    background:
        linear-gradient(
            180deg,
            #1e3a8a,
            #1d4ed8
        );

    border-bottom-left-radius:8px;
}

.msg.user{

    align-self:flex-end;

    background:
        linear-gradient(
            180deg,
            #047857,
            #059669
        );

    border-bottom-right-radius:8px;
}

.msg.thinking{

    opacity:.7;

    animation:pulse 1.2s infinite;
}

@keyframes pulse{

    0%{
        opacity:.4;
    }

    50%{
        opacity:1;
    }

    100%{
        opacity:.4;
    }
}

/* =========================
   INPUT
========================= */

#zonaInput{

    display:flex;
    align-items:flex-end;

    gap:12px;

    padding:12px;

    border-radius:24px;

    background:
        rgba(255,255,255,.03);

    border:
        1px solid var(--border);

    flex:none;
}

textarea,
input{

    width:100%;

    border:none;
    outline:none;

    resize:none;

    color:white;

    background:
        rgba(255,255,255,.04);

    border:
        1px solid transparent;

    border-radius:18px;

    padding:16px;

    font-size:15px;

    transition:.2s ease;
}

textarea{

    min-height:58px;
    max-height:140px;
}

textarea:focus,
input:focus{

    border-color:
        rgba(139,92,246,.6);

    background:
        rgba(255,255,255,.06);

    box-shadow:
        0 0 0 4px rgba(139,92,246,.12);
}

textarea::placeholder,
input::placeholder{
    color:#9ca3af;
}

/* =========================
   SEND BUTTON
========================= */

#zonaInput button{

    width:56px;
    height:56px;

    min-width:56px;

    border-radius:18px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary2)
        );

    color:white;

    display:flex;
    align-items:center;
    justify-content:center;

    box-shadow:
        0 10px 30px rgba(139,92,246,.3);
}

#zonaInput button:hover{

    box-shadow:
        0 15px 40px rgba(139,92,246,.45);
}

#zonaInput button span{
    font-size:24px;
}

/* =========================
   MODALS
========================= */

.seo-modal,
.premium-modal{

    position:fixed;
    inset:0;

    background:
        rgba(0,0,0,.7);

    display:none;

    justify-content:center;
    align-items:center;

    padding:20px;

    z-index:999;
}

.seo-box,
.premium-box{

    width:100%;
    max-width:920px;

    max-height:90vh;

    overflow-y:auto;

    border-radius:30px;

    background:
        linear-gradient(
            180deg,
            #111827,
            #0f172a
        );

    border:
        1px solid var(--border);

    padding:34px;

    position:relative;

    animation:modal .25s ease;
}

@keyframes modal{

    from{
        opacity:0;
        transform:translateY(16px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }
}

#closeInfo,
#closePremium{

    position:absolute;

    top:18px;
    right:18px;

    width:40px;
    height:40px;

    border-radius:12px;

    background:
        rgba(255,255,255,.06);

    color:white;
}

/* =========================
   PREMIUM CARDS
========================= */

.plans{

    display:grid;

    grid-template-columns:
        repeat(auto-fit,minmax(280px,1fr));

    gap:20px;

    margin-top:30px;
}

.plan-card{

    border-radius:24px;

    padding:28px;

    background:
        rgba(255,255,255,.03);

    border:
        1px solid var(--border);

    transition:.25s ease;

    position:relative;
}

.plan-card:hover{

    transform:translateY(-6px);

    border-color:
        rgba(139,92,246,.4);
}

.plan-card h3{

    font-size:28px;

    margin-bottom:14px;
}

.price{

    font-size:38px;

    font-weight:800;

    margin-bottom:24px;

    color:#c4b5fd;
}

.plan-card ul{
    list-style:none;
}

.plan-card li{

    margin-bottom:12px;

    color:#d1d5db;
}

.plan-btn{

    width:100%;
    height:50px;

    border-radius:16px;

    margin-top:20px;

    font-weight:600;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary2)
        );

    color:white;
}

.badge{

    position:absolute;

    top:16px;
    right:16px;

    padding:6px 12px;

    border-radius:999px;

    background:
        linear-gradient(
            135deg,
            #8b5cf6,
            #7c3aed
        );

    font-size:11px;
    font-weight:700;
}

/* =========================
   SCROLLBAR
========================= */

::-webkit-scrollbar{
    width:8px;
    height:8px;
}

::-webkit-scrollbar-thumb{

    background:
        rgba(255,255,255,.12);

    border-radius:999px;
}

/* =========================
   TABLET
========================= */

@media(max-width:900px){

    .sidebar{
        width:230px;
        min-width:230px;
    }

    .msg{
        max-width:90%;
    }
}

/* =========================
   MOBILE
========================= */

@media(max-width:768px){

    .navbar{

        height:auto;

        padding:12px;

        gap:12px;

        flex-wrap:wrap;
    }

    .brand h1{
        font-size:18px;
    }

    .nav-actions{

        width:100%;

        display:grid;

        grid-template-columns:
            repeat(3,1fr);

        gap:8px;
    }

    .btn-back,
    .premium-open,
    .info-btn{

        width:100%;

        height:42px;

        font-size:13px;
    }

    /* SIDEBAR ARRIBA */

    .content-layout{
        flex-direction:column;
    }

    .sidebar{

        width:100%;
        min-width:100%;

        max-height:none;

        border-right:none;

        border-bottom:
            1px solid var(--border);

        overflow:hidden;

        flex:none;
    }

    .sidebar-content{

        display:flex;
        align-items:center;

        gap:10px;

        overflow-x:auto;
        overflow-y:hidden;

        padding:12px;

        white-space:nowrap;

        scrollbar-width:none;
    }

    .sidebar-content::-webkit-scrollbar{
        display:none;
    }

    .sidebar-content h3{
        display:none;
    }

    .sidebar-content > button{

        width:auto;

        min-width:max-content;

        padding:0 18px;

        height:44px;

        margin:0;

        flex:none;
    }

    .chat-item-wrapper{

        width:auto;

        min-width:unset;

        flex:none;

        margin:0;
    }

    .chat-item{

        min-width:170px;
        max-width:220px;

        margin:0;

        padding:12px 14px;

        border-radius:16px;

        font-size:13px;

        white-space:nowrap;

        overflow:hidden;
        text-overflow:ellipsis;

        backdrop-filter:blur(10px);

        background:
            rgba(255,255,255,.045);

        border:
            1px solid rgba(255,255,255,.06);
    }

    .chat-item:hover{
        transform:none;
    }

    .delete-chat-btn{

        width:28px;
        height:28px;

        min-width:28px;

        border-radius:10px;

        font-size:10px;

        margin-left:2px;
    }

    .chat-area{

        padding:10px;

        gap:10px;
    }

    #chat{

        padding:14px;

        border-radius:20px;
    }

    .msg{

        max-width:100%;

        font-size:14px;

        line-height:1.5;
    }

    #zonaInput{

        padding:10px;

        border-radius:20px;
    }

    textarea{

        min-height:52px;

        padding:14px;

        font-size:14px;
    }

    #zonaInput button{

        width:50px;
        height:50px;
        min-width:50px;

        border-radius:16px;
    }

    .seo-box,
    .premium-box{

        padding:22px;

        border-radius:24px;
    }

    .premium-box h2{
        font-size:28px !important;
    }

    .plans{
        grid-template-columns:1fr;
    }
}

/* =========================
   SMALL MOBILE
========================= */

@media(max-width:480px){

    .navbar{
        padding:10px;
    }

    .brand h1{
        font-size:16px;
    }

    img{
        width:36px;
        height:36px;
    }

    .btn-back,
    .premium-open,
    .info-btn{

        height:40px;

        font-size:12px;
    }

    .sidebar-content{
        padding:10px;
        gap:8px;
    }

    .chat-item{

        min-width:145px;
        max-width:180px;

        padding:10px 12px;

        font-size:12px;
    }

    .sidebar-content > button{

        height:40px;

        padding:0 14px;

        font-size:12px;
    }

    .delete-chat-btn{

        width:24px;
        height:24px;

        min-width:24px;

        border-radius:8px;
    }

    #chat{
        padding:10px;
    }

    .msg{

        padding:12px;

        font-size:13px;

        border-radius:18px;
    }

    textarea{

        font-size:13px;

        border-radius:16px;
    }

    #zonaInput button{

        width:46px;
        height:46px;
        min-width:46px;
    }

    .seo-box,
    .premium-box{

        padding:18px;
    }

    .premium-box h2{
        font-size:22px !important;
    }

    .price{
        font-size:30px;
    }
}