/**
 * 工单系统专用样式
 * 独立于全局 style.css，专注于工单界面的用户体验
 */

/* ===== 容器与布局 ===== */
.ticket-wrapper {
    max-width: 960px;
    margin: 0 auto;
}

/* ===== 工单列表卡片 ===== */
.ticket-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.ticket-list-header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #111827;
}

.ticket-list-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    border: 1px solid #f0f0f0;
}
.ticket-list-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-1px);
    border-color: #e0e0e0;
}
.ticket-list-card-inner {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.ticket-list-card .tlc-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.tlc-icon.high { background: #fef2f2; }
.tlc-icon.medium { background: #fffbeb; }
.tlc-icon.low { background: #f3f4f6; }
.ticket-list-card .tlc-body { flex: 1; min-width: 0; }
.ticket-list-card .tlc-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #111827;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ticket-list-card .tlc-meta {
    font-size: 0.8rem;
    color: #9ca3af;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.ticket-list-card .tlc-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.ticket-list-card .tlc-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.ticket-list-card .tlc-reply-badge {
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* 优先级标签 */
.priority-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.priority-tag.high { background: #fef2f2; color: #dc2626; }
.priority-tag.medium { background: #fffbeb; color: #d97706; }
.priority-tag.low { background: #f3f4f6; color: #6b7280; }

/* 状态标签 */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-tag.open { background: #fef3c7; color: #92400e; }
.status-tag.in_progress { background: #dbeafe; color: #1e40af; }
.status-tag.resolved { background: #d1fae5; color: #065f46; }
.status-tag.closed { background: #e5e7eb; color: #374151; }

/* ===== 详情页 ===== */
.ticket-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    transition: color 0.2s;
    text-decoration: none;
}
.ticket-back-link:hover { color: #2563eb; }

.ticket-detail-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.ticket-detail-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid #f3f4f6;
}
.ticket-detail-header .flex-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.ticket-detail-header h2 {
    font-size: 1.2rem;
    color: #111827;
    line-height: 1.4;
}
.ticket-detail-meta {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}
.ticket-detail-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.ticket-detail-body {
    padding: 1.5rem 1.75rem;
    background: #fafbfc;
    white-space: pre-wrap;
    line-height: 1.7;
    color: #374151;
    font-size: 0.95rem;
}

/* ===== 图片预览 ===== */
.ticket-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
.ticket-images .ticket-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: transform 0.2s;
}
.ticket-images .ticket-img:hover {
    transform: scale(1.05);
    border-color: #2563eb;
}

/* 图片灯箱 */
.img-lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.img-lightbox.active { display: flex; }
.img-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* ===== 对话时间线 ===== */
.reply-timeline { margin: 2rem 0; }
.reply-timeline h3 {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.reply-bubble {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    position: relative;
    line-height: 1.65;
}
.reply-bubble.admin-reply {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border-left: 3px solid #2563eb;
}
.reply-bubble.user-reply {
    background: #f9fafb;
    border-left: 3px solid #d1d5db;
}
.reply-author {
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.reply-author .author-badge {
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}
.author-badge.admin { background: #2563eb; color: #fff; }
.author-badge.user { background: #6b7280; color: #fff; }
.reply-time { color: #9ca3af; font-size: 0.75rem; }
.reply-content {
    color: #374151;
    white-space: pre-wrap;
    font-size: 0.9rem;
}

/* ===== 图片上传区域 ===== */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: #fafbfc;
    margin-top: 0.75rem;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}
.upload-zone-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.upload-zone-text {
    color: #6b7280;
    font-size: 0.875rem;
}
.upload-zone-hint {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}
.upload-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.upload-preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}
.upload-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.upload-preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(239,68,68,0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-preview-item .compress-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(37,99,235,0.85);
    color: #fff;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 4px;
}
.upload-error {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: none;
}

/* ===== 回复表单 ===== */
.reply-form-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    margin-top: 1.5rem;
    overflow: hidden;
}
.reply-form-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.reply-form-body { padding: 1.5rem; }
.reply-form-body textarea {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}
.reply-form-body textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.reply-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ===== 新建工单表单 ===== */
.new-ticket-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    overflow: hidden;
}
.new-ticket-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid #f3f4f6;
}
.new-ticket-header h1 {
    font-size: 1.25rem;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.new-ticket-body { padding: 1.75rem; }
.new-ticket-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.new-ticket-group { margin-bottom: 1.25rem; }
.new-ticket-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 0.4rem;
}
.new-ticket-group label .required { color: #ef4444; }
.new-ticket-group input,
.new-ticket-group select,
.new-ticket-group textarea {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}
.new-ticket-group input:focus,
.new-ticket-group select:focus,
.new-ticket-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.new-ticket-group textarea { resize: vertical; min-height: 140px; }
.new-ticket-submit {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.new-ticket-submit:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    transform: translateY(-1px);
}

/* ===== 空状态 ===== */
.ticket-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.ticket-empty .empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.ticket-empty h3 { color: #374151; margin-bottom: 0.5rem; }
.ticket-empty p { color: #9ca3af; margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ===== 状态进度条 ===== */
.status-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 1rem 0;
    padding: 1rem;
    background: #fff;
    border-radius: 10px;
}
.status-step {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #d1d5db;
    flex: 1;
}
.status-step.done { color: #2563eb; }
.status-step.current { color: #111827; font-weight: 600; }
.status-step .step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.status-step .step-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 0.25rem;
}
.status-step.done .step-line { background: #2563eb; }

/* ===== 警告/提示卡片 ===== */
.ticket-alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ticket-alert.warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.ticket-alert.success { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }
.ticket-alert.error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.ticket-alert.login { background: #fff; border: 1px solid #e5e7eb; }

.ticket-closed-notice {
    text-align: center;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 10px;
    color: #9ca3af;
    font-size: 0.9rem;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .ticket-list-card-inner { flex-direction: column; align-items: flex-start; }
    .ticket-list-card .tlc-tags { flex-wrap: wrap; }
    .new-ticket-row { grid-template-columns: 1fr; }
    .ticket-detail-header .flex-row { flex-direction: column; }
    .status-progress { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .status-step .step-line { display: none; }
    .reply-form-actions { flex-direction: column; }
    .reply-form-actions button { width: 100%; }
}
