/* =========================
GLOBAL
========================= */

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body{
    background: #f4f5f7;
    color: #1f2937;
    overflow-x: hidden;
}

/* =========================
LAYOUT
========================= */

.layout{
    display: flex;
    min-height: 100vh;
}

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

.sidebar{
    width: 220px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 14px;

    display: flex;
    flex-direction: column;
    justify-content: flex-start;

    flex-shrink: 0;
}

.help-box{
    background: #f8faf8;
    border: 1px solid #e5e7eb;
    border-radius: 20px;

    padding: 16px;
    text-align: center;

    margin-bottom: 15px;
}

.help-box img{
    width: 100px;
    height: 100px;
    object-fit: cover;

    margin-bottom: 10px;
}

.help-box h4{
    font-size: 18px;
    margin-bottom: 8px;
    color: #111827;
}

.help-box p{
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;

    margin-bottom: 14px;
}

.help-btn{
    width: 100%;
    height: 40px;

    border: none;
    border-radius: 12px;

    background: #16a34a;
    color: white;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    text-decoration: none;
}

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

.main{
    flex: 1;
    padding: 10px;

    min-width: 0;
}

/* =========================
NAVBAR
========================= */

.topbar{
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;

    padding: 12px 16px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: relative;

    margin-bottom: 12px;
}

/* LEFT */

.topbar-left{
    display: flex;
    align-items: center;
    gap: 10px;

    min-width: 0;
}

.back-btn{
    text-decoration: none;
    color: #374151;

    font-size: 18px;

    flex-shrink: 0;
}

.logo-img{
    width: 38px;
    height: 38px;

    object-fit: cover;

    flex-shrink: 0;
}

.logo-text{
    font-size: 20px;
    font-weight: 700;
    color: #14532d;

    white-space: nowrap;
}

/* MENU */

.topbar-right{
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-link{
    text-decoration: none;
    color: #374151;

    font-size: 14px;
    font-weight: 500;

    transition: 0.2s;
}

.nav-link:hover{
    color: #16a34a;
}

/* BURGER */

.mobile-menu-btn{
    display: none;

    width: 42px;
    height: 42px;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    background: white;

    align-items: center;
    justify-content: center;

    cursor: pointer;

    color: #374151;
    font-size: 18px;
}

/* =========================
CONTENT
========================= */

.content{
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;

    align-items: stretch;

    height: calc(100vh - 90px);
}

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

.chat-wrapper{
    background: white;
    border-radius: 22px;
    border: 1px solid #e5e7eb;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    min-width: 0;
}

/* HEADER */

.chat-header{
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

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

.chat-icon{
    width: 40px;
    height: 40px;

    border-radius: 50%;

    background: #ecfdf3;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #16a34a;
    font-size: 20px;

    flex-shrink: 0;
}

.chat-header h2{
    font-size: 18px;
    margin-bottom: 2px;
}

.chat-header p{
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
}

.reset-btn{
    height: 40px;
    padding: 0 16px;

    border: 1px solid #b7e0c2;
    border-radius: 12px;

    background: white;
    color: #16a34a;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
}

.reset-btn i{
    margin-right: 8px;
}

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

.chat-body{
    flex: 1;

    overflow-y: auto;

    padding: 14px;
    background: #fcfcfc;
}

.message-row{
    display: flex;
    gap: 10px;

    margin-bottom: 18px;
}

.message-row.user{
    justify-content: flex-end;
}

.bot-avatar{
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: #ecfdf3;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #16a34a;
    font-size: 18px;

    flex-shrink: 0;
}

.bubble{
    max-width: 75%;

    padding: 14px 16px;
    border-radius: 20px;

    font-size: 14px;
    line-height: 1.8;

    word-break: break-word;
}

.bot-bubble{
    background: white;
    border: 1px solid #e5e7eb;
}

.user-bubble{
    background: #ecfdf3;
    border: 1px solid #d7f1de;
}

.chat-time{
    margin-top: 8px;

    font-size: 12px;
    color: #9ca3af;
}

.detail-btn{
    margin-top: 12px;

    height: 38px;
    padding: 0 16px;

    border-radius: 12px;
    border: 1px solid #cce9d4;

    background: white;
    color: #16a34a;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

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

.chat-input{
    border-top: 1px solid #f0f0f0;
    padding: 12px;

    background: white;
}

.input-wrapper{
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-input textarea{
    flex: 1;
    min-width: 0;

    height: 44px;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    padding: 10px 14px;

    font-size: 14px;

    resize: none;
    outline: none;

    line-height: 1.4;
}

.send-btn{
    height: 44px;
    min-width: 110px;

    padding: 0 18px;

    border: none;
    border-radius: 14px;

    background: #16a34a;
    color: white;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
}

.send-btn i{
    margin-right: 8px;
}

.safe-text{
    margin-top: 8px;
    text-align: center;

    font-size: 12px;
    color: #6b7280;

    line-height: 1.6;
}

/* =========================
RIGHT PANEL
========================= */

.right-panel{
    display: flex;
    flex-direction: column;
    gap: 12px;

    min-width: 0;
}

.green-card{
    background-image:
        linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.35)),
        url('/images/chatbot3.png');

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    border-radius: 22px;

    padding: 18px;

    color: white;

    aspect-ratio: 4/3;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.green-card h3{
    font-size: 20px;
    margin-bottom: 8px;
}

.green-card p{
    font-size: 13px;
    line-height: 1.7;
    color: #d1fae5;
}

/* =========================
INFO CARD
========================= */

.info-card{
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;

    padding: 16px;
}

.info-item{
    display: flex;
    gap: 12px;

    margin-bottom: 16px;
}

.info-item:last-child{
    margin-bottom: 0;
}

.info-icon{
    width: 40px;
    height: 40px;

    border-radius: 50%;

    background: #ecfdf3;
    color: #16a34a;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
}

.info-item h4{
    font-size: 14px;
    margin-bottom: 4px;
}

.info-item p{
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;
}

.tips-list li{
    display: flex;
    align-items: flex-start;
    gap: 8px;

    margin-bottom: 10px;

    font-size: 13px;
    line-height: 1.6;

    color: #374151;
}

.tips-list li i{
    color: #16a34a;

    margin-top: 3px;

    flex-shrink: 0;
}

.hasil-penyakit-card{
    border: 1px solid #e5e7eb;
    border-radius: 18px;

    padding: 16px;

    display: flex;
    align-items: flex-start;
    gap: 16px;

    margin-bottom: 16px;
}

.hasil-penyakit-card img{
    width: 220px;
    height: 160px;

    object-fit: cover;

    border-radius: 14px;

    flex-shrink: 0;
}

.hasil-penyakit-info{
    flex: 1;
    min-width: 0;
}

.hasil-penyakit-info h3{
    font-size: 24px;
    margin-bottom: 10px;
}

.hasil-penyakit-info p{
    font-size: 14px;
    line-height: 1.7;
    color: #4b5563;
}

/* =========================
MODAL
========================= */

.modal{
    position: fixed;
    inset: 0;

    background: rgba(0,0,0,0.5);

    display: none;
    align-items: center;
    justify-content: center;

    z-index: 999;
}

.hasil-modal{
    width: 92%;
    max-width: 920px;
    max-height: 88vh;

    overflow-y: auto;

    background: white;

    border-radius: 20px;

    padding: 18px;
}

.hasil-header{
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 18px;
}

.hasil-header h2{
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.close-modal{
    width: 42px;
    height: 42px;

    border: none;
    border-radius: 12px;

    background: #f3f4f6;
    color: #374151;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    flex-shrink: 0;

    transition: 0.2s;
}

.close-modal:hover{
    background: #e5e7eb;
}

.close-modal i{
    font-size: 16px;
    line-height: 1;
}

/* =========================
RESPONSIVE TABLET
========================= */

@media(max-width:1200px){

    .sidebar{
        display: none;
    }

    .content{
        grid-template-columns: 1fr;
        height: auto;
    }

    .right-panel{
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

}

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

@media(max-width:768px){

    body{
        overflow-x: hidden;
    }

    .layout{
        flex-direction: column;
    }

    .main{
        width: 100%;
        padding: 8px;
    }

    /* NAVBAR */

    .topbar{
        flex-wrap: wrap;
        padding: 12px;
    }

    .logo-text{
        font-size: 16px;
    }

    .logo-img{
        width: 32px;
        height: 32px;
    }

    .mobile-menu-btn{
        display: flex;
    }

    .topbar-right{
        display: none;

        width: 100%;

        flex-direction: column;
        align-items: flex-start;

        gap: 12px;

        margin-top: 14px;
        padding-top: 14px;

        border-top: 1px solid #f0f0f0;
    }

    .topbar-right.show{
        display: flex;
    }

    .nav-link{
        width: 100%;
        font-size: 14px;
    }

    /* CONTENT */

    .content{
        display: flex;
        flex-direction: column;

        gap: 10px;

        height: auto;
    }

    .chat-wrapper{
        min-height: 70vh;
        border-radius: 18px;
    }

    .right-panel{
        grid-template-columns: 1fr;
    }

    .green-card{
        aspect-ratio: auto;
        min-height: 220px;
    }

    /* CHAT */

    .chat-header{
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-body{
        min-height: 300px;
        padding: 12px;
    }

    .bubble{
        max-width: 100%;
        font-size: 13px;
    }

    .input-wrapper{
        flex-direction: column;
        align-items: stretch;
    }

    .chat-input textarea{
        width: 100%;
    }

    .send-btn{
        width: 100%;
    }

    /* MODAL */

    .hasil-modal{
        width: 96%;
        padding: 14px;
    }

    .hasil-penyakit-card{
        flex-direction: column;
    }

    .hasil-penyakit-card img{
        width: 100%;
        height: 220px;
    }

}

/* =========================
EXTRA SMALL DEVICE
========================= */

@media(max-width:480px){

    .topbar{
        border-radius: 14px;
    }

    .logo-text{
        font-size: 15px;
    }

    .chat-header h2{
        font-size: 16px;
    }

    .chat-header p{
        font-size: 12px;
    }

    .green-card h3{
        font-size: 18px;
    }

    .green-card p{
        font-size: 12px;
    }

}

/* =========================================
FIX HASIL DIAGNOSIS MODAL
========================================= */

.hasil-modal *{
    box-sizing: border-box;
}

.hasil-alert{
    width: 100%;

    background: #ecfdf3;
    border: 1px solid #b7e0c2;

    padding: 16px 18px;
    border-radius: 16px;

    margin-bottom: 18px;

    display: flex;
    align-items: flex-start;
    gap: 12px;

    font-size: 14px;
    line-height: 1.7;

    color: #166534;
}

.hasil-alert i{
    color: #16a34a;
    font-size: 18px;

    margin-top: 2px;

    flex-shrink: 0;
}

.hasil-alert div{
    flex: 1;
}

/* CARD PENYAKIT */

.hasil-penyakit-card{
    display: flex;
    align-items: flex-start;
    gap: 18px;

    border: 1px solid #e5e7eb;
    border-radius: 20px;

    padding: 18px;

    margin-bottom: 18px;

    background: white;
}

.hasil-penyakit-card img{
    width: 220px;
    height: 160px;

    object-fit: cover;

    border-radius: 16px;

    flex-shrink: 0;

    display: block;
}

.hasil-penyakit-info{
    flex: 1;
    min-width: 0;
}

.hasil-penyakit-info h3{
    font-size: 32px;
    font-weight: 700;

    margin-bottom: 10px;

    color: #111827;
}

.hasil-penyakit-info p{
    font-size: 15px;
    line-height: 1.8;

    color: #4b5563;

    margin-bottom: 12px;
}

.badge-persentase{
    display: inline-flex;
    align-items: center;
    gap: 8px;

    background: #ecfdf3;
    color: #16a34a;

    padding: 8px 14px;

    border-radius: 12px;

    font-size: 14px;
    font-weight: 600;
}

/* GRID */

.hasil-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 16px;

    margin-top: 18px;
}

/* BOX */

.hasil-box{
    border: 1px solid #e5e7eb;
    border-radius: 18px;

    padding: 18px;

    background: white;
}

.hasil-box h4{
    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 18px;
    font-weight: 700;

    margin-bottom: 16px;

    color: #111827;
}

/* GEJALA */

.gejala-list{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gejala-item{
    background: #f0fdf4;
    border: 1px solid #bbf7d0;

    color: #166534;

    padding: 8px 12px;

    border-radius: 10px;

    font-size: 13px;
    font-weight: 600;

    line-height: 1.5;
}

/* SOLUSI */

.solusi-item{
    display: flex;
    align-items: flex-start;
    gap: 10px;

    margin-bottom: 12px;

    font-size: 14px;
    line-height: 1.7;

    color: #374151;
}

.solusi-item i{
    color: #16a34a;

    margin-top: 4px;

    flex-shrink: 0;
}

/* FOOTER */

.hasil-footer{
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-secondary,
.btn-primary{
    flex: 1;
    height: 46px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    gap: 6px;
}

.btn-secondary{
    background: white;
    border: 1px solid #16a34a;
    color: #16a34a;
}

.btn-primary{
    background: #16a34a;
    border: none;
    color: white;
}

/* MOBILE */

@media(max-width:768px){

    .hasil-penyakit-card{
        flex-direction: column;
    }

    .hasil-penyakit-card img{
        width: 100%;
        height: 220px;
    }

    .hasil-grid{
        grid-template-columns: 1fr;
    }

    .hasil-footer{
        flex-direction: column;
    }

    .btn-secondary,
    .btn-primary{
        width: 100%;
    }

}