/* ====== Reset & Body ====== */
body{
    margin:0;
    padding:0;
    direction:rtl;
    font-family:Tahoma,Arial,sans-serif;
    background:linear-gradient(120deg,#eef3f9,#ffffff);
    height:100vh;
    overflow:hidden;
}

/* ====== Login ====== */
#loginBox{
    height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
}

.loginCard{
    width:90%;
    max-width:360px;
    padding:20px;
    border-radius:16px;
    background:rgba(255,255,255,0.8);
    backdrop-filter:blur(15px);
    box-shadow:0 8px 20px rgba(0,0,0,0.08);
    text-align:center;
}

.logo{
    font-size:36px;
    margin-bottom:10px;
}

.loginCard h1{
    font-size:18px;
    margin:10px 0 15px;
}

.loginCard input{
    width:100%;
    padding:10px;
    margin-top:8px;
    border-radius:10px;
    border:none;
    outline:none;
    background:rgba(255,255,255,0.95);
    box-shadow:0 0 0 1px rgba(0,0,0,0.05);
    font-size:14px;
}

.loginCard button{
    margin-top:12px;
    width:100%;
    padding:10px;
    border:none;
    border-radius:10px;
    background:#4da3ff;
    color:white;
    cursor:pointer;
    font-size:14px;
    transition:.2s;
}

.loginCard button:hover{
    background:#3a8ce0;
}

/* ====== Chat Page ====== */
#chatPage{
    display:none;
    flex-direction:column;
    height:100vh;
}

/* Header */
#chatHeader{
    padding:10px 12px;
    background:rgba(255,255,255,0.75);
    backdrop-filter:blur(12px);
    border-bottom:1px solid rgba(0,0,0,0.05);
}

.groupTitle{
    font-weight:bold;
    font-size:16px;
}

/* Messages */
#messages{
    flex:1;
    overflow-y:auto;
    padding:8px 10px;
    display:flex;
    flex-direction:column;
    gap:4px;
    scroll-behavior:smooth;
}

/* Message bubble */
.msg{
    max-width:75%;
    min-width:60px;
    padding:6px 10px;
    border-radius:12px;
    background:rgba(255,255,255,0.75);
    backdrop-filter:blur(10px);
    position:relative;
    word-wrap:break-word;
    line-height:1.3;
    font-size:14px;
}

/* Own message */
.me{
    margin-left:auto;
    background:rgba(205,230,255,0.9);
    text-align:right;
}

/* Other message */
.other{
    margin-right:auto;
    text-align:right;
}

/* Author */
.author{
    font-size:11px;
    font-weight:bold;
    margin-bottom:2px;
    opacity:.8;
    text-align:right;
}

/* Reply preview inside bubble */
.replyInline{
    font-size:12px;
    color:#555;
    opacity:.7;
    display:inline-block;
    margin-bottom:3px;
}

/* Message footer: time & edit */
.msgFooter{
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:4px;
    font-size:10px;
    color:#666;
    margin-top:2px;
}

/* Timestamp outside bubble */
.time{
    font-size:10px;
    color:#777;
}

/* Edit & Reply buttons small */
.editBtnSmall, .replyBtnSmall{
    font-size:12px;
    cursor:pointer;
    opacity:0.6;
}

/* Reply box preview */
#replyBox{
    padding:4px 10px;
    margin-bottom:4px;
}

.replyPreview{
    background:#e8f2ff;
    padding:4px 6px;
    border-radius:8px;
    font-size:12px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    max-width:80%;
}

/* Image preview small */
.imgPreviewSmall{
    max-width:120px;
    max-height:120px;
    border-radius:6px;
    object-fit:cover;
    cursor:pointer;
}

/* File link small */
.fileIconSmall{
    display:inline-block;
    padding:4px 6px;
    background:#d3e3ff;
    border-radius:6px;
    text-decoration:none;
    color:#000;
    font-size:12px;
    margin-top:2px;
}

/* Input Bar fixed bottom */
#inputBar{
    display:flex;
    align-items:center;
    gap:6px;
    padding:6px 8px;
    background:rgba(255,255,255,0.85);
    backdrop-filter:blur(12px);
    border-top:1px solid rgba(0,0,0,0.05);
    position:sticky;
    bottom:0;
    z-index:50;
}

/* Textarea */
#msg{
    flex:1;
    height:36px;
    border:none;
    outline:none;
    border-radius:8px;
    padding:6px 8px;
    resize:none;
    background:rgba(255,255,255,0.95);
    box-shadow:0 0 0 1px rgba(0,0,0,0.05);
    font-size:14px;
}

/* Buttons in input bar */
#inputBar button{
    border:none;
    background:transparent;
    font-size:20px;
    cursor:pointer;
    padding:2px;
}

/* Send button arrow */
#sendBtn{
    font-size:20px;
}

/* Hidden file input */
#file{
    display:none;
}

/* Emoji panel */
#emojiPanel{
    display:none;
    position:absolute;
    bottom:50px;
    right:12px;
    background:white;
    border-radius:10px;
    padding:6px;
    box-shadow:0 6px 15px rgba(0,0,0,0.15);
    max-width:180px;
}

#emojiPanel span{
    font-size:18px;
    padding:2px;
    cursor:pointer;
    display:inline-block;
}

/* Modal for large image */
#imgModal{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.75);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:9999;
}

#imgModal img{
    max-width:90%;
    max-height:90%;
    border-radius:8px;
}

#imgModal div{
    position:absolute;
    top:10px;
    right:20px;
    font-size:24px;
    color:white;
    cursor:pointer;
}

/* Scrollbar */
#messages::-webkit-scrollbar{
    width:5px;
}

#messages::-webkit-scrollbar-thumb{
    background:rgba(0,0,0,0.15);
    border-radius:10px;
}

/* ====== Mobile adjustments ====== */
@media screen and (max-width:600px){
    .loginCard{
        width:90%;
        padding:18px;
    }
    .logo{
        font-size:33px;
    }
    .loginCard h1{
        font-size:16px;
    }
    #messages{
        padding:6px 8px;
        gap:3px;
    }
    .msg{
        max-width:65%;
        font-size:15px;
        padding:5px 8px;
    }
    .imgPreviewSmall{
        max-width:100px;
        max-height:100px;
    }
    #msg{
        height:34px;
        font-size:13px;
    }
    #inputBar button{
        font-size:18px;
    }
    #emojiPanel{
        max-width:160px;
        padding:4px;
    }
}
