/* ============================================
   工单中心页面样式
   ============================================ */

.tickets-main {
    padding-top: 100px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ---------- 页面标题 ---------- */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.page-title svg {
    color: var(--accent);
}

.page-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ---------- 标签页 ---------- */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    border-radius: 6px 6px 0 0;
    position: relative;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(224, 48, 48, 0.06);
    box-shadow: inset 0 -2px 8px rgba(224, 48, 48, 0.08);
}

.tab svg {
    opacity: 0.6;
    transition: opacity 0.3s;
}

.tab:hover svg {
    opacity: 0.8;
}

.tab.active svg {
    opacity: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ---------- 筛选栏 ---------- */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-select {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.filter-select:focus {
    border-color: rgba(224, 48, 48, 0.4);
}

.filter-select option {
    background: #0c0c18;
}

/* ---------- 工单列表 ---------- */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loading-state,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.ticket-item {
    padding: 18px 22px;
    background: linear-gradient(135deg, rgba(14, 14, 26, 0.7) 0%, rgba(12, 12, 22, 0.5) 100%);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.ticket-item:hover {
    border-color: var(--border-accent);
    background: rgba(20, 20, 36, 0.7);
    transform: translateX(4px);
    box-shadow: 0 2px 16px rgba(224, 48, 48, 0.06);
}

.ticket-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.ticket-item-id {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 1px;
    flex-shrink: 0;
}

.ticket-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.ticket-item-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.78rem;
    color: var(--text-dim);
}

.ticket-item-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ticket-item-author img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

/* 状态 & 分类标签 */
.badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-open {
    background: rgba(64, 200, 100, 0.12);
    color: #6be080;
}

.badge-accepted {
    background: rgba(240, 180, 40, 0.12);
    color: #f0c040;
}

.badge-resolved {
    background: rgba(100, 160, 240, 0.12);
    color: #80b0f0;
}

.badge-closed {
    background: rgba(128, 128, 140, 0.12);
    color: #909098;
}

.badge-bug {
    background: rgba(224, 64, 64, 0.12);
    color: #ff6b6b;
}

.badge-suggestion {
    background: rgba(64, 160, 224, 0.12);
    color: #6bc0ff;
}

.badge-question {
    background: rgba(200, 160, 40, 0.12);
    color: #e0c040;
}

.badge-other {
    background: rgba(160, 128, 224, 0.12);
    color: #c0a0ff;
}

/* 回复数 */
.reply-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-dim);
}

.reply-count svg {
    width: 12px;
    height: 12px;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.page-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---------- 登录提示 ---------- */
.login-hint {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.login-hint svg {
    color: var(--accent);
    opacity: 0.5;
}

.steam-link {
    color: var(--accent);
    text-decoration: underline;
}

/* ---------- 提交表单 ---------- */
.ticket-form {
    max-width: 720px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
}

.flex-1 {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    transition: all 0.3s;
    outline: none;
    box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
    border-color: rgba(224, 48, 48, 0.4);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(224, 48, 48, 0.06);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-dim);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.7;
}

.form-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
    display: block;
}

.form-counter {
    display: block;
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
    font-family: var(--font-mono);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px 0;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ---------- 图片上传 ---------- */
.image-upload-area {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 16px;
    transition: border-color 0.3s;
    min-height: 80px;
}

.image-upload-area.dragover {
    border-color: var(--accent);
    background: rgba(224, 48, 48, 0.03);
}

.upload-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: var(--text-dim);
    font-size: 0.82rem;
    cursor: pointer;
    transition: color 0.3s;
}

.upload-trigger:hover {
    color: var(--text-secondary);
}

.upload-trigger svg {
    opacity: 0.4;
}

.image-previews {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.image-preview {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.image-preview .remove-image:hover {
    background: var(--accent);
}

.image-uploading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
}

.image-uploading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- 提交按钮 ---------- */
.submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent) 0%, #c02020 100%);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    justify-content: center;
}

.submit-btn:hover {
    box-shadow: 0 4px 20px rgba(224, 48, 48, 0.3);
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---------- 工单详情模态框 ---------- */
.modal-detail-body {
    padding: 24px;
    max-height: 50vh;
    overflow-y: auto;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.detail-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-author img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.detail-author-name {
    font-size: 0.88rem;
    font-weight: 500;
}

.detail-time {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}

.detail-contact {
    margin: 12px 0;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    gap: 20px;
}

.detail-content {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 16px;
}

.detail-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.detail-images img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s;
}

.detail-images img:hover {
    transform: scale(1.05);
}

/* 回复列表 */
.replies-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.replies-title {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.reply-item {
    padding: 14px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 6px;
    border-left: 3px solid var(--border);
}

.reply-item.admin-reply {
    border-left-color: var(--accent);
    background: rgba(224, 48, 48, 0.02);
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.reply-header img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.reply-header .reply-name {
    font-size: 0.82rem;
    font-weight: 500;
}

.reply-header .admin-badge {
    font-size: 0.62rem;
    padding: 1px 6px;
    background: rgba(224, 48, 48, 0.15);
    color: var(--accent);
    border-radius: 3px;
    font-family: var(--font-mono);
}

.reply-header .reply-time {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.reply-content {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.reply-images {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.reply-images img {
    max-width: 120px;
    max-height: 90px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* 回复输入区域 */
.modal-reply-area {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}

.reply-input-wrap .form-textarea {
    min-height: 60px;
    margin-bottom: 8px;
}

.reply-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-upload-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.reply-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.reply-send-btn {
    margin-left: auto;
    padding: 8px 20px;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.82rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
}

.reply-send-btn:hover {
    box-shadow: 0 2px 12px rgba(224, 48, 48, 0.3);
}

.reply-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- Toast 通知 ---------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50000;
    /* 高于 modal-overlay 的 35000 */
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.toast {
    padding: 12px 24px;
    background: rgba(12, 12, 20, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    animation: toastSlide 0.3s ease;
}

.toast-success {
    border-left: 3px solid #4CAF50;
}

.toast-error {
    border-left: 3px solid var(--accent);
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .ticket-item-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ticket-item-title {
        white-space: normal;
        word-break: break-word;
        min-width: 0;
        flex-basis: 100%;
        order: 2;
    }

    .ticket-item-meta {
        flex-wrap: wrap;
        gap: 6px;
    }

    .ticket-item-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .filters {
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

    .detail-contact {
        flex-direction: column;
        gap: 6px;
    }
}

@media (max-width: 600px) {
    .tickets-main {
        padding-top: 80px;
    }

    .page-title {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }

    .page-desc {
        font-size: 0.82rem;
    }

    .tabs {
        gap: 2px;
    }

    .tab {
        padding: 10px 14px;
        font-size: 0.8rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .ticket-item {
        padding: 14px 16px;
    }

    .ticket-item-title {
        font-size: 0.88rem;
    }

    .ticket-item-footer {
        font-size: 0.72rem;
    }

    .modal-panel {
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0;
    }

    .modal-detail-body {
        padding: 16px;
        max-height: calc(100vh - 140px);
    }

    .submit-btn {
        padding: 12px 24px;
        font-size: 0.85rem;
    }

    .reply-header {
        flex-wrap: wrap;
    }

    .reply-header .reply-time {
        margin-left: 0;
        flex-basis: 100%;
        margin-top: 4px;
    }

    .detail-images img {
        max-width: 120px;
        max-height: 90px;
    }
}

@media (max-width: 420px) {
    .tickets-main {
        padding-top: 70px;
    }

    .page-title {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }

    .tab {
        padding: 8px 10px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .ticket-item {
        padding: 12px 12px;
    }

    .badge {
        font-size: 0.62rem;
        padding: 2px 6px;
    }

    .ticket-item-id {
        font-size: 0.65rem;
    }

    .ticket-item-title {
        font-size: 0.82rem;
    }
}