/**
 * Twikoo Emotion 样式 - jQuery弹出式表情选择器
 */

/* 表情包装器 */
.twe-emotion-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 10px;
    margin-bottom: 0;
	width: 100%;
}

/* 表情触发按钮 */
.twe-emotion-trigger {
	border: 0;
	background: 0;
    cursor: pointer !important;
    font-size: 16px !important;
    transition: all 0.2s ease !important;
}

.twe-emotion-trigger:hover {
    background: #e0e0e0 !important;
    transform: scale(1.02) !important;
}

.twe-emotion-trigger svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

button.twe-emotion-trigger:hover {
	background-color: transparent !important;
}

/* 弹出层 - 改用 absolute 定位，相对于 .twe-emotion-wrapper */
.twe-emotion-popup {
    display: none;
    position: relative;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000000;
    width: 98%;
    left: 0;
    /* 默认显示在按钮上方 */
    bottom: 100%;
    margin-bottom: 10px;
}

/* 当弹出层显示在按钮下方时 */
.twe-emotion-popup.twe-popup-below {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 10px;
}

/* 弹出层头部 */
.twe-emotion-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.twe-emotion-popup-header span {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.twe-emotion-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0 6px;
    transition: color 0.2s;
}

.twe-emotion-popup-close:hover {
    color: #333;
}

/* 弹出层主体 */
.twe-emotion-popup-body {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

/* 表情网格 - 每行自动适配 */
.twe-emotion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 1px;
}

/* 表情项 */
.twe-emotion-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1px;
    cursor: pointer;
    border-radius: 1px;
    transition: all 0.2s ease;
    background: #fafafa;
}

.twe-emotion-item:hover {
    background: #e3f2fd;
    transform: scale(1.05);
}

/* 表情图片 */
.twe-emotion-item img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
    pointer-events: none;
}

/* 表情代码 */
.twe-emotion-code {
    font-size: 10px;
    color: #666;
    margin-top: 6px;
    max-width: 30px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 内联表情 */
.twe-emotion-img.twe-inline {
    height: 1.2em;
    width: auto;
    max-height: 24px;
    display: inline-block;
    margin: 0 2px;
    vertical-align: text-top !important;
}

/* ========================================
   关键：让发表评论按钮下移
   ======================================== */

/* 根据你的 HTML 结构，使用 p.form-submit */
p.form-submit {
    clear: both;
    display: block;
}

/* 确保提交按钮本身样式正常 */
p.form-submit .submit,
p.form-submit #submit {
    margin-top: 0;
}

/* 滚动条美化 */
.twe-emotion-popup-body::-webkit-scrollbar {
    width: 6px;
}

.twe-emotion-popup-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.twe-emotion-popup-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.twe-emotion-popup-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   响应式设计
   ======================================== */

/* 平板端 (宽度 481px - 768px) */
@media (max-width: 768px) and (min-width: 481px) {
    .twe-emotion-popup {
        max-width: 500px;
    }
    
    .twe-emotion-grid {
        grid-template-columns: repeat(auto-fill, minmax(20px, 1fr));
        gap: 1px;
    }
    
    .twe-emotion-item img {
        width: 25px !important;
        height: 25px !important;
    }
    
    p.form-submit {
        margin-top: 50px !important;
    }
}

/* 手机端 (宽度 480px 及以下) */
@media (max-width: 480px) {
    .twe-emotion-popup {
        width: 95%;
        max-width: 380px;
        border-radius: 12px;
    }
    
    .twe-emotion-popup-header {
        padding: 10px 12px;
    }
    
    .twe-emotion-popup-header span {
        font-size: 14px;
    }
    
    .twe-emotion-popup-body {
        padding: 12px;
        max-height: 350px;
    }
    
    .twe-emotion-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 1px;
    }
    
    .twe-emotion-item {
        padding: 1px;
    }
    
    .twe-emotion-item img {
        width: 25px !important;
        height: 25px !important;
    }
    
    .twe-emotion-code {
        font-size: 9px;
        margin-top: 4px;
    }
    
    p.form-submit {
        margin-top: 40px !important;
    }
}

/* 超小手机 (宽度 360px 及以下) */
@media (max-width: 360px) {
    .twe-emotion-popup {
        width: 98%;
        max-width: 340px;
    }
    
    .twe-emotion-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 1px;
    }
    
    .twe-emotion-item img {
        width: 25px !important;
        height: 25px !important;
    }
    
    p.form-submit {
        margin-top: 35px !important;
    }
}