/* استایل ثبت نام و چت کاربر */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background: #f7f9fb;
    font-family: Tahoma, sans-serif;
    margin: 0;
    padding: 0;
}

/* -------- فرم ثبت نام -------- */
.info-box {
    width: 100%;
    max-width: 340px;
    margin: 90px auto 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    padding: 36px 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.info-box h2 {
    margin-bottom: 22px;
    color: #234;
    font-weight: 600;
}
.info-box input {
    width: 100%;
    padding: 12px 10px;
    margin-bottom: 16px;
    border: 1.2px solid #ddd;
    border-radius: 9px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}
.info-box input:focus {
    border-color: #00BCD4;
}
.info-box button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #00BCD4 30%, #2196F3 100%);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 17px;
    cursor: pointer;
    margin-top: 6px;
    font-weight: 600;
    transition: background 0.25s;
}
.info-box button:hover {
    background: linear-gradient(90deg, #1e88e5 40%, #26c6da 100%);
}
.errors {
    color: #d11b1b;
    background: #ffeded;
    border-radius: 7px;
    padding: 9px 11px;
    margin-bottom: 15px;
    font-size: 15px;
}

@media (max-width: 420px) {
    .info-box {
        margin-top: 20px;
    }
}

/* -------- باکس چت -------- */
.chat-container {
    width: 398px;
    height: 670px;
    max-width: 100vw;
    max-height: 100vh;
    min-width: 320px;
    min-height: 400px;
    background: url('../img/1.png') no-repeat center center;
    background-size: cover;
    border-radius: 25px;
    box-shadow: 0 2px 28px #0002;
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 99999;
    border: 0.5px solid #e3e7ee;
    transition: box-shadow .22s;
    overflow: hidden;
}

.header-support {
    background: linear-gradient(90deg, #26c6da 30%, #169df7 100%);
    color: #fff;
    border-radius: 22px 22px 0 0;
    font-size: 1.16rem;
    font-weight: 700;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
    padding: 17px 22px 13px 10px;
    min-height: 62px;
    text-align: right;
    position: relative;
}
.header-support img {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.7px #26c6da44;
}
.header-support .title {
    flex: 1 1 auto;
    text-align: right;
    font-weight: 700;
    font-size: 1.09rem;
    line-height: 1.6;
}

#messages {
    flex: 1 1 auto;
    min-height: 100px;
    max-height: none;
    overflow-y: auto;
    margin: 0;
    padding: 0 10px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: none;
    overscroll-behavior: contain;
}
.bubble {
    display: flex;
    align-items: flex-end;
    margin: 0;
}
.bubble.user-bubble {
    justify-content: flex-end;
}
.bubble.operator-bubble {
    justify-content: flex-start;
}
.user-msg {
    background: linear-gradient(120deg, #17a9ff 60%, #01c0e8 100%);
    color: #fff;
    border-radius: 17px 17px 4px 17px;
    margin-left: 6px;
    max-width: 76%;
    padding: 10px 16px 8px 16px;
    font-size: 1.03rem;
    word-break: break-word;
    box-shadow: 0 2px 10px #69e5f824;
    font-weight: 400;
    text-align: right;
}
.operator-msg {
    background: linear-gradient(120deg, #fff 70%, #e3f1fc 100%);
    color: #26334d;
    border-radius: 17px 17px 17px 4px;
    margin-right: 6px;
    max-width: 76%;
    padding: 10px 16px 8px 16px;
    font-size: 1.03rem;
    word-break: break-word;
    border: 1px solid #e9e9e9;
    font-weight: 400;
    text-align: right;
}
.msg-time {
    font-size: 0.78em;
    color: #adb5bd;
    margin: 0 0 0 8px;
    align-self: flex-end;
    direction: ltr;
}
.exit-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    background: transparent;
    color: #fff;
    border: none;
    border-radius: 99px;
    font-size: 1.2rem;
    padding: 0;
    cursor: pointer;
    z-index: 99;
    transition: background .16s;
}
.exit-btn:hover {
    background: #e1f1ff33;
    color: #169df7;
}

form#chatForm {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    background: #fff;
    border-top: 1px solid #f0f3fa;
    box-shadow: 0px 3px 18px #30caf407;
    z-index: 10;
    right: 0;
    bottom: 0;
    padding: 14px 12px 12px 9px;
    border-radius: 0 0 22px 22px;
}
form#chatForm input[type="text"] {
    flex-grow: 1;
    padding: 10px 15px;
    border-radius: 13px;
    border: 1.2px solid #b9d3ef;
    font-size: 15px;
    margin-left: 8px;
    margin-right:15px;
    outline: none;
    background: #f8fbfd;
    transition: border .16s;
}
form#chatForm input:focus {
    border: 1.2px solid #17a9ff;
}
form#chatForm button {
    background: linear-gradient(135deg, #00BCD4 0%, #17a9ff 100%);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    margin-right: 0;
    margin-left: 3px;
    box-shadow: 0 2px 12px #03a9f421;
    cursor: pointer;
    transition: background 0.18s;
}
form#chatForm button svg {
    vertical-align: middle;
    width: 22px;
    height: 22px;
}
form#chatForm button:active, form#chatForm button:focus {
    background: linear-gradient(135deg, #26c6da 10%, #169df7 90%);
}
.file-upload {
    position: relative;
    width: 54px;
    height: 44px;
    margin-right: 6px;
    display: flex;
    align-items: center;
}
.file-upload input[type="file"] {
    position: absolute;
    right: 0;
    top: 0;
    opacity: 0;
    width: 54px;
    height: 44px;
    z-index: 4;
    cursor: pointer;
}
.file-upload label {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    width: 54px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.14s;
    outline: none;
    z-index: 3;
    font-size: 20px;
}
.file-upload label:active, .file-upload label:focus {
    background: #e4f3ff;
}
#filenameLabel {
    margin-right: 3px;
    max-width: 80px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}

@media (max-width: 550px) {
    .chat-container {
        width: 100vw !important;
        height: 100vh !important;
        right: 0;
        left: 0;
        bottom: 0;
        border-radius: 0;
        max-width: 100vw;
        max-height: 100vh;
    }
    .header-support {
        padding: 14px 8px 10px 2px;
        font-size: 1rem;
    }
    #messages {
        padding-left:4px;
        padding-right:4px;
    }
    form#chatForm {
        border-radius: 0 0 18px 18px;
        width: 100vw;
        max-width: 100vw;
    }
}
