﻿/* message-dialog-plugin.css */

/* 悬浮按钮 - 桌面端 */
.message-entry-img {
    position: fixed;
    top: calc(60% + 40px);
    right: 20px;
    z-index: 1000;
    cursor: pointer;
    height: auto;
    transition: transform 0.2s;

}

    .message-entry-img:hover {
        transform: scale(1.05);
    }

/* 悬浮按钮 - 移动端优化 */
@media (max-width: 768px) {
    .message-entry-img {
        top: calc(70% + 20px); /* 避免与底部导航栏冲突 */
        right: 15px;
        width: 17vw;
    }
}

/* 对话框整体样式 */
#messageDialog {
    border: none;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: #fff;
    padding: 0;
    overflow: hidden;
    /*position: fixed !important;*/ /* 关键：固定定位 */
    margin: auto;
}

/* 响应式：在大屏幕上固定宽度 */
/*@media (min-width: 769px) {
    #messageDialog {
        width: 500px;*/ /* 桌面端固定宽度 */
    /*}
}*/

.form-header-m {
    padding: 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

    .form-header-m .form-title-m {
        margin: 0 0 4px 0;
        font-size: 18px;
        color: #333;
        font-weight: 600;
    }

    .form-header-m p {
        margin: 0;
        font-size: 13px;
        color: #666;
    }

/* 关闭按钮 - 桌面端 */
.close-btn-m {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

    .close-btn-m:hover {
        opacity: 1;
    }

/* 关闭按钮 - 移动端优化 */
@media (max-width: 768px) {
    .close-btn-m {
        top: 16px;
        right: 16px;
        width: 24px; /* 更大，更易点击 */
        height: 24px;
    }
}

.form-body-m {
    padding: 20px;
}

.form-group-m {
    margin-bottom: 16px;
    position: relative;
}

/* 表单控件通用样式 */
.form-control-m {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    background-color: #fff;
    transition: border-color 0.2s;
}

    .form-control-m:focus {
        outline: none;
        border-color: #0078d4;
        box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
    }

.form-control-m-h1 {
    height: 40px;
    font-size: 14px;
}

.form-control-m-h2 {
    height: 80px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.4;
}

/* 错误信息 */
.error-message {
    font-size: 12px;
    color: #d43b3b;
    margin-top: 4px;
    display: block;
}

/* 提交错误信息 */
.submit-error {
    color: #d43b3b;
    font-size: 14px;
    margin-bottom: 10px;
    display: none;
    padding: 10px;
    background-color: #fdf2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
}

/* 城市选择器容器 */
.styled-select-container {
    display: flex;
    gap: 10px;
}

/* 城市选择器下拉框 */
.styled-select {
    flex: 1;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    appearance: none; /* 移除默认样式 */
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); /* 添加自定义下拉箭头 */
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

    .styled-select:focus {
        outline: none;
        border-color: #0078d4;
    }

/* 表单底部按钮 */
.form-footer-m {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.btn-m {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-cancel-m {
    background: #f1f1f1;
    color: #333;
}

    .btn-cancel-m:hover {
        background: #e5e5e5;
    }

.btn-submit-m {
    background: #0078d4;
    color: #fff;
}

    .btn-submit-m:hover {
        background: #005a9e;
    }

    .btn-submit-m:disabled {
        background: #8eaacb;
        cursor: not-allowed;
    }

/* 响应式：在小屏幕上堆叠按钮和选择器 */
@media (max-width: 576px) {
    /* 城市选择器：在极小屏幕上堆叠 */
    .styled-select-container {
        flex-direction: column;
        gap: 8px;
    }

    /* 按钮：在极小屏幕上堆叠 */
    .form-footer-m {
        flex-direction: column;
    }

    .btn-m {
        width: 100%;
        justify-content: center;
    }

    /* 表单内边距减小 */
    .form-body-m {
        padding: 16px;
    }

    .form-header-m {
        padding: 16px;
    }

        /* 字体稍大，便于阅读 */
        .form-header-m .form-title-m {
            font-size: 17px;
        }

        .form-header-m p {
            font-size: 12px;
        }

    .form-control-m {
        font-size: 15px; /* 移动端常用字体大小 */
    }
}

/* 针对 iPhone X 等带安全区域的设备 */
@media (max-width: 480px) {
    .message-entry-img {
        /* 避免被底部Home Indicator遮挡 */
        width: 15vw;
    }
}

/* 确保 dialog 在移动端能正确显示 */
#messageDialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

dialog::backdrop {
    display: flex;
    align-items: center;
    justify-content: center;
}
