/* 发现日志区域样式 - 优化版 */

/* --- 基础与通用 --- */
.discovery-logs-wrapper {
    margin: 2rem 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.required {
    color: #dc3545;
    font-weight: 700;
}

/* --- 日志列表标题与统计 --- */
.logs-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #2c5530;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.logs-title .icon-treasure::before {
    content: '🏴‍☠️';
}

.cache-name {
    font-weight: 400;
    font-size: 1rem;
    color: #666;
    margin-left: .5rem;
}

.logs-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border-radius: 12px;
    border: 1px solid #d4edda;
    flex-wrap: wrap; /* 允许在小屏幕上换行 */
}

.stats-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
    flex-grow: 1; /* 让项目在 flex 容器中可以伸展 */
    min-width: 150px;
}

.stats-item.found {
    border-left: 4px solid #28a745;
}

.stats-item.not-found {
    border-left: 4px solid #dc3545;
}

.stats-item.total {
    border-left: 4px solid #007bff;
}

.stats-icon {
    font-size: 1.2rem;
}

.stats-label {
    font-size: .9rem;
    color: #666;
}

.stats-count {
    font-weight: 700;
    font-size: 1.2rem;
    color: #333;
    margin-left: auto;
}

/* --- 日志列表样式 --- */
.discovery-logs-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.discovery-log {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
    transition: all .3s ease;
    position: relative;
    animation: fadeInUp .5s ease;
}

.discovery-log:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    transform: translateY(-2px);
}

.discovery-log.found {
    border-left: 5px solid #28a745;
    background: linear-gradient(135deg, #fff 0%, #f8fff8 100%);
}

.discovery-log.not-found {
    border-left: 5px solid #dc3545;
    background: linear-gradient(135deg, #fff 0%, #fff8f8 100%);
}

.log-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.log-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.log-author .avatar {
    border-radius: 50%;
    border: 3px solid #ddd;
}

.log-author-info h4,
.log-author-info .author-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c5530;
    text-decoration: none;
}

.log-author-info .author-name:hover {
    text-decoration: underline;
}

.log-date {
    color: #666;
    font-size: .9rem;
    margin-top: .25rem;
}

.log-date a {
    color: inherit;
    text-decoration: none;
}

.discovery-status {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.status-badge {
    padding: .5rem 1rem;
    border-radius: 20px;
    font-size: .9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #fff;
}

.status-badge.found {
    background: #28a745;
}

.status-badge.not-found {
    background: #dc3545;
}

.log-content {
    line-height: 1.7;
    margin-bottom: 1rem;
    color: #333;
    font-size: 1rem;
    word-wrap: break-word;
}

.comment-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 1rem;
}

.log-awaiting-moderation {
    background: #fff3cd;
    color: #856404;
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: inline-block;
    border: 1px solid #ffeaa7;
}

.log-reply-link-wrapper a {
    display: inline-block;
    padding: .5rem 1rem;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: .9rem;
    transition: background .3s ease;
}

.log-reply-link-wrapper a:hover {
    background: #0056b3;
}


/* --- 评论表单样式 --- */
.discovery-log-form-wrapper {
    margin-top: 3rem;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
    border: 1px solid #e9ecef;
}

.form-title {
    color: #2c5530;
    font-size: 1.5rem;
    margin: 0 0 1.5rem 0; /* 调整标题下间距 */
    display: flex;
    align-items: center;
    gap: .5rem;
}

.form-title .icon-edit::before {
    content: '📝';
}

/* === 关键改动：欢迎信息样式 === */
.logged-in-as {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    align-items: center;
    gap: 0.25rem 0.75rem; /* 行间距和列间距 */
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.logged-in-as a {
    font-weight: 600;
}

/* === 关键改动：寻宝结果字段样式 === */
.discovery-status-field {
    margin-bottom: 1.5rem; /* 减小与下方元素的间距 */
}

.discovery-status-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.status-options {
    display: grid; /* 使用 Grid 布局，更灵活 */
    grid-template-columns: repeat(2, 1fr); /* 创建两列，每列占据一半空间 */
    gap: 1rem; /* 设置选项之间的间距 */
}

.status-option {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all .3s ease;
}

.status-option:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.status-option input[type=radio] {
    flex-shrink: 0; /* 防止单选框在 flex 布局中被压缩 */
    margin: 0;
    width: 20px;
    height: 20px;
    accent-color: #007bff;
}

.status-option.found:has(input:checked) {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.status-option.not-found:has(input:checked) {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.status-icon {
    font-size: 1.2rem;
}

.status-text {
    font-size: 1rem;
    font-weight: 500;
}
.status-option input[type=radio]:checked + .status-icon + .status-text {
    font-weight: 700;
}

/* --- 其他表单字段样式 --- */
.log-form-field {
    margin-bottom: 1.5rem;
}

.log-form-comment {
    position: relative;
    margin-bottom: 1.5rem;
}

.comment-toolbar {
    position: absolute;
    top: 2.5rem;
    right: .5rem;
    z-index: 10;
}

.comment-toolbar i {
    font-size: 1.5rem;
    color: #888;
    cursor: pointer;
    transition: color .3s;
}

.comment-toolbar i:hover {
    color: #333;
}

.discovery-log-form label {
    display: block;
    margin-bottom: .5rem;
    font-weight: 600;
    color: #333;
}

.discovery-log-form input[type=text],
.discovery-log-form input[type=email],
.discovery-log-form input[type=url],
.discovery-log-form textarea {
    width: 100%;
    padding: .75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color .3s ease, box-shadow .3s ease;
    box-sizing: border-box;
}

.discovery-log-form input[type=file] {
    width: 100%;
    font-size: .9rem;
    color: #555;
}

.discovery-log-form input[type=text]:focus,
.discovery-log-form input[type=email]:focus,
.discovery-log-form input[type=url]:focus,
.discovery-log-form textarea:focus {
    outline: 0;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, .1);
}

.discovery-log-form textarea {
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
    padding-right: 2.5rem;
}

.log-tips {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.log-tips p {
    margin: 0 0 .5rem;
    color: #495057;
    font-weight: 600;
}

.log-tips ul {
    margin: 0;
    padding-left: 1.5rem;
}

.log-tips li {
    margin-bottom: .5rem;
    color: #666;
    line-height: 1.4;
}

.form-submit {
    margin-top: 1rem; /* 调整提交按钮上间距 */
}

.log-submit {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, .3);
    width: 100%; /* 让按钮宽度充满容器 */
}

.log-submit:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, .4);
}

.char-counter {
    text-align: right;
    font-size: .8rem;
    color: #666;
    margin-top: .5rem;
    padding: .25rem 0;
}


/* --- 导航与动画 --- */
.logs-navigation {
    margin: 2rem 0;
    padding: 1rem 0;
    border-top: 1px solid #e9ecef;
}

.logs-navigation .nav-links {
    display: flex;
    justify-content: space-between;
}

.logs-navigation a {
    padding: .75rem 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    transition: all .3s ease;
    font-weight: 500;
}

.logs-navigation a:hover {
    background: #007bff;
    color: #fff;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* --- 移动端响应式样式 --- */
@media (max-width: 768px) {
    .logs-stats,
    .logs-navigation .nav-links {
        flex-direction: column;
        gap: .5rem;
    }

    .log-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .discovery-log-form-wrapper {
        padding: 1.5rem 1rem; /* 调整内边距 */
    }

    /* 这里的改动使得“寻宝结果”在移动端依然保持一行两列 */
    /* 由于我们上面使用了 Grid 布局，这里无需额外代码，它会自动适应 */
}

@media (max-width: 480px) {
    /* 针对更小的屏幕进行微调 */
    .status-option {
        padding: 0.75rem; /* 减小内边距 */
        gap: 0.5rem;
    }
    .status-text {
        font-size: 0.9rem; /* 减小字体 */
    }
}


/* ========================================
   评论框工具栏增强样式
   版本: 3.1
   ======================================== */

/* 评论框容器 */
.comment-textarea-wrapper {
    position: relative;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.comment-textarea-wrapper:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 评论框 textarea */
.comment-textarea-wrapper textarea {
    border: none !important;
    border-radius: 8px 8px 0 0 !important;
    box-shadow: none !important;
    padding: 1rem !important;
    padding-bottom: 3.5rem !important; /* 为底部工具栏留空间 */
    resize: vertical;
    min-height: 150px;
    width: 100%;
    box-sizing: border-box;
}

.comment-textarea-wrapper textarea:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* 底部工具栏 */
.textarea-toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 6px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 5;
}

/* 工具栏按钮容器 */
.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-right {
    display: flex;
    align-items: center;
}

/* 工具栏按钮样式 */
.toolbar-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #666;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.toolbar-btn:hover {
    background: #e9ecef;
    color: #333;
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.toolbar-btn i {
    pointer-events: none;
}

/* 图片预览文件名 */
.image-preview-name {
    font-size: 0.85rem;
    color: #666;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-preview-name:empty {
    display: none;
}

.image-preview-name::before {
    content: '📎 ';
}

/* 字数统计 */
#char-counter {
    font-size: 0.85rem;
    color: #666;
    user-select: none;
}

#char-counter.warning {
    color: #ff9800;
    font-weight: 600;
}

#char-counter.danger {
    color: #dc3545;
    font-weight: 700;
}

/* 表情包选择器 */
.emoji-picker {
    position: absolute;
    bottom: 50px;
    left: 0;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.emoji-picker.show {
    display: block;
    animation: slideUpFadeIn 0.2s ease;
}

.emoji-picker-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.emoji-picker-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.emoji-tab {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.emoji-tab:hover {
    background: #e9ecef;
}

.emoji-tab.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
}

.emoji-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 1.5rem;
}

.emoji-item:hover {
    background: #f8f9fa;
    transform: scale(1.2);
}

@keyframes slideUpFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .emoji-picker {
        width: calc(100% - 2rem);
        left: 1rem;
        right: 1rem;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .toolbar-left {
        gap: 0.25rem;
    }

    .toolbar-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .image-preview-name {
        max-width: 100px;
        font-size: 0.75rem;
    }

    .textarea-toolbar {
        height: 40px;
        padding: 0 0.5rem;
    }

    .comment-textarea-wrapper textarea {
        padding-bottom: 3rem !important;
    }
}

@media (max-width: 480px) {
    .emoji-picker {
        width: calc(100% - 1rem);
        left: 0.5rem;
        right: 0.5rem;
    }

    .emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    #char-counter {
        font-size: 0.75rem;
    }

    .toolbar-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
        padding: 0.25rem;
    }
}

/* ========================================
   工具栏图标优化（Unicode Emoji）
   ======================================== */

/* Unicode 图标样式 */
.toolbar-btn .icon-emoji,
.toolbar-btn .icon-camera {
    font-size: 1.3rem;
    line-height: 1;
    display: inline-block;
    font-style: normal;
}

/* 确保图标不会被鼠标事件干扰 */
.toolbar-btn .icon-emoji,
.toolbar-btn .icon-camera {
    pointer-events: none;
}

/* 移除旧的 FontAwesome 样式依赖 */
.toolbar-btn i {
    pointer-events: none;
}
