/* 工单模态窗口 - 扁平风格 */
.tickets-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.tickets-modal-overlay.show {
    display: flex;
}

.tickets-modal {
    background: white;
    border-radius: 12px;
    width: 380px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

/* 视图容器 */
.tickets-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 头部 - 与点数记录一致 */
.tickets-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}

.tickets-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.tickets-header-title svg {
    width: 20px;
    height: 20px;
    fill: #1a73e8;
}

.tickets-header h3 {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #202124;
}

.tickets-close-btn,
.tickets-back-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
}

.tickets-close-btn .material-icons,
.tickets-back-btn .material-icons {
    font-size: 18px;
}

/* 列表区域 */
.tickets-body {
    flex: 1;
    overflow: hidden;
    min-height: 360px;
}

.tickets-list {
    padding: 8px 12px;
}

/* 工单项 - 紧凑风格 */
.ticket-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
    border: 1px solid #f0f0f0;
}

.ticket-item:hover {
    background: #f5f5f5;
}

.ticket-item.has-reply {
    background: #f6ffed;
    border-color: #b7eb8f;
}

/* 工单图标 - 小尺寸 */
.ticket-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.ticket-item-icon svg {
    width: 16px;
    height: 16px;
}

.ticket-item-icon.bug { background: #fff1f0; }
.ticket-item-icon.bug svg { color: #cf1322; }
.ticket-item-icon.feature { background: #e6f7ff; }
.ticket-item-icon.feature svg { color: #096dd9; }
.ticket-item-icon.account { background: #fff7e6; }
.ticket-item-icon.account svg { color: #d46b08; }
.ticket-item-icon.other { background: #f9f0ff; }
.ticket-item-icon.other svg { color: #722ed1; }

/* 工单信息 */
.ticket-item-info {
    flex: 1;
    min-width: 0;
}

.ticket-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #999;
}

.ticket-category {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #f0f0f0;
    color: #666;
}

.ticket-category-bug { background: #fff1f0; color: #cf1322; }
.ticket-category-feature { background: #e6f7ff; color: #096dd9; }
.ticket-category-account { background: #fff7e6; color: #d46b08; }
.ticket-category-other { background: #f9f0ff; color: #722ed1; }

/* 状态 */
.ticket-item-status {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.ticket-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.ticket-status-open { background: #fff7e6; color: #d46b08; }
.ticket-status-replied { background: #f6ffed; color: #389e0d; }
.ticket-status-closed { background: #f0f0f0; color: #666; }

.ticket-item-time {
    font-size: 10px;
    color: #999;
}

/* 空状态 */
.tickets-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
    min-height: 360px;
}

.tickets-empty .material-icons {
    font-size: 40px;
    margin-bottom: 8px;
    color: #d9d9d9;
}

.tickets-empty span {
    font-size: 13px;
}

/* 底部 */
.tickets-footer {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.tickets-new-btn {
    width: 100%;
    height: 36px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.15s;
}

.tickets-new-btn:hover {
    background: #1557b0;
}

.tickets-new-btn .material-icons {
    font-size: 18px;
}


/* ============ 工单详情视图 ============ */

/* 工单信息摘要 */
.ticket-detail-info {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.ticket-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.ticket-info-row:last-child {
    margin-bottom: 0;
}

.ticket-info-label {
    color: #666;
    font-weight: 500;
}

.ticket-info-value {
    color: #333;
}

/* 消息发送者标识 */
.message-sender {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.sender-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sender-icon .material-icons {
    font-size: 14px;
}

.sender-icon.user-icon {
    background: #e3f2fd;
    color: #1976d2;
}

.sender-icon.admin-icon {
    background: #e8f5e9;
    color: #388e3c;
}

.sender-name {
    font-size: 12px;
    font-weight: 500;
    color: #666;
}

.message-content {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* 工单已关闭提示 */
.ticket-closed-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    background: #f5f5f5;
    color: #999;
    font-size: 13px;
    border-top: 1px solid #f0f0f0;
}

.ticket-closed-notice .material-icons {
    font-size: 16px;
}

/* 消息列表 */
.tickets-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 300px;
    max-height: 360px;
    background: #fafafa;
}

.ticket-message {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    background: white;
    border: 1px solid #f0f0f0;
}

.ticket-message.is-admin {
    background: #f6ffed;
    border-color: #b7eb8f;
}

/* 输入区域 */
.tickets-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #f0f0f0;
    background: white;
}

.tickets-input-area textarea {
    flex: 1;
    height: 36px;
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 18px;
    resize: none;
    font-size: 13px;
    font-family: inherit;
}

.tickets-input-area textarea:focus {
    outline: none;
    border-color: #1a73e8;
}

.tickets-send-btn {
    width: 36px;
    height: 36px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.tickets-send-btn:hover {
    background: #1557b0;
}

.tickets-send-btn .material-icons {
    font-size: 18px;
}

/* ============ 新建工单表单 ============ */

.tickets-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tickets-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tickets-form-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.tickets-form-group input,
.tickets-form-group select,
.tickets-form-group textarea {
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.tickets-form-group input:focus,
.tickets-form-group select:focus,
.tickets-form-group textarea:focus {
    outline: none;
    border-color: #1a73e8;
}

.tickets-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.tickets-submit-btn {
    height: 36px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}

.tickets-submit-btn:hover {
    background: #1557b0;
}
