/* 售后工单页面特定样式 */

/* 头部操作区布局（桌面端） */
/* 头部操作区布局（桌面端） */
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 显示当前登录用户名（售后工单页面） */
.username-display {
    display: inline-block !important;
    margin-left: 8px;
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.stat-card.closed {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.ticket-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
}

.ticket-item:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.ticket-item.priority-urgent {
    border-left-color: #dc3545;
}

.ticket-item.priority-high {
    border-left-color: #fd7e14;
}

.ticket-item.priority-medium {
    border-left-color: #ffc107;
}

.ticket-item.priority-low {
    border-left-color: #28a745;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.ticket-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.ticket-no {
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
    margin-right: 10px;
    font-family: 'Courier New', monospace;
}

/* 移动端适配，头部操作区与客户管理保持一致 */
@media (max-width: 768px) {
    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .username-display {
        grid-column: 1 / -1;
        width: 100%;
        text-align: center;
        margin-right: 0;
        margin-bottom: 0;
        padding: 8px;
    }

    .header-actions .btn,
    .header-actions a.btn {
        width: 100%;
        justify-content: center;
        padding: 8px 12px;
        font-size: 12px;
        text-align: center;
        display: flex;
        align-items: center;
        white-space: nowrap;
    }
}

.ticket-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-ticket-type {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-ticket-type.website {
    background: #667eea;
    color: white;
}

.badge-ticket-type.other {
    background: #f0f0f0;
    color: #666;
}

.ticket-customer-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.customer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
}

.customer-item strong {
    color: #333;
}

.ticket-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap; /* 保留换行符和空格，并自动换行 */
}

.ticket-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.ticket-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #666;
}

.ticket-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ticket-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.action-btn.complete {
    background: #28a745;
    color: white;
}

.action-btn.complete:hover {
    background: #218838;
}

.action-btn.edit {
    background: #17a2b8;
    color: white;
}

.action-btn.edit:hover {
    background: #138496;
}

.action-btn.delete {
    background: #dc3545;
    color: white;
}

.action-btn.delete:hover {
    background: #c82333;
}

.action-btn.view {
    background: #6c757d;
    color: white;
}

.action-btn.view:hover {
    background: #5a6268;
}

/* 图片上传切换按钮 */
.btn-toggle-images {
    margin-top: 10px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-block;
}

.btn-toggle-images:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* 图片上传样式 */
.image-upload-container {
    margin-top: 15px;
}

.image-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    margin-bottom: 15px;
}

.image-upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.image-upload-area.drag-over {
    border-color: #667eea;
    background: #e8f0fe;
}

.upload-placeholder {
    pointer-events: none;
}

.upload-placeholder span {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.upload-placeholder p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.upload-hint {
    font-size: 12px !important;
    color: #999 !important;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

/* 工单图片显示 */
.ticket-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.ticket-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
    object-fit: cover;
    border: 1px solid #dee2e6;
    transition: transform 0.2s ease;
}

.ticket-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 图片查看模态框 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.image-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    cursor: default;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

/* 分页样式（与待办事项、客户管理保持一致） */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 0;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 40px;
    margin-right: 8px;
}

.pagination-btn:last-child {
    margin-right: 0;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #ced4da;
    color: #343a40;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.45);
}

.pagination-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.pagination-ellipsis {
    color: #adb5bd;
    font-size: 14px;
}

.image-modal-info {
    text-align: center;
    color: white;
    margin-top: 15px;
    font-size: 16px;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 3001;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.image-modal-prev,
.image-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 24px;
    font-weight: 300;
    width: 48px;
    height: 48px;
    cursor: pointer;
    z-index: 3001;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0.8;
}

.image-modal-prev {
    left: 20px;
}

.image-modal-next {
    right: 20px;
}

.image-modal-prev:hover,
.image-modal-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.image-modal-prev:active,
.image-modal-next:active {
    transform: translateY(-50%) scale(1.05);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        margin-top: 15px;
    }

    .ticket-header {
        flex-direction: column;
        gap: 10px;
    }

    .ticket-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-customer-info {
        flex-direction: column;
        gap: 10px;
    }

    /* 工具栏移动端自适应 */
    .toolbar {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }

    .toolbar-left {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .filter-group select,
    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
        font-size: 14px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* 工单项移动端自适应 */
    .ticket-item {
        padding: 15px;
        margin-bottom: 12px;
        overflow: hidden;
        word-wrap: break-word;
        word-break: break-word;
    }

    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ticket-title {
        width: 100%;
        font-size: 16px;
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .ticket-title span:not(.ticket-no) {
        display: block;
        margin-top: 5px;
        word-wrap: break-word;
        word-break: break-word;
    }

    .ticket-no {
        display: block;
        margin-bottom: 5px;
        font-size: 13px;
    }

    .ticket-badges {
        width: 100%;
        justify-content: flex-start;
    }

    .ticket-customer-info {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }

    .customer-item {
        width: 100%;
        flex-wrap: wrap;
    }

    .ticket-description {
        font-size: 14px;
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.5;
    }

    .ticket-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ticket-meta {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
    }

    .ticket-meta span {
        width: 100%;
        flex-wrap: wrap;
    }

    .ticket-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
        padding: 10px;
        font-size: 14px;
    }
}

/* 自定义确认对话框 */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.confirm-dialog-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.confirm-dialog-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e9ecef;
}

.confirm-dialog-icon {
    font-size: 32px;
    line-height: 1;
}

.confirm-dialog-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.confirm-dialog-body {
    padding: 24px;
}

.confirm-dialog-message {
    margin: 0;
    font-size: 16px;
    color: #495057;
    line-height: 1.6;
    white-space: pre-line;
}

.confirm-dialog-footer {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.confirm-dialog-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-dialog-cancel:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.confirm-dialog-confirm {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-dialog-confirm:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
}

/* 响应式 - 移动端对话框 */
@media (max-width: 768px) {
    .confirm-dialog-content {
        width: 95%;
        max-width: none;
    }

    .confirm-dialog-footer {
        flex-direction: column-reverse;
    }

    .confirm-dialog-cancel,
    .confirm-dialog-confirm {
        width: 100%;
    }
}

/* 修改密码模态框样式 */
.password-modal {
    max-width: 500px;
    margin-top: 120px;
}

.password-modal .form-group {
    margin-bottom: 25px;
}

.password-modal .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
    font-size: 0.95em;
}

.password-modal .label-icon {
    font-size: 1.1em;
}

.password-modal .form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    transition: all 0.3s;
    background: #f9f9f9;
}

.password-modal .form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.password-modal .form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #999;
}

.password-modal .error-message {
    background: #fee;
    color: #c33;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #e74c3c;
    font-size: 0.9em;
}

.password-modal .modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.password-modal .modal-footer button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 1em;
}

.password-modal .modal-footer .btn-secondary {
    background: #95a5a6;
}

.password-modal .modal-footer .btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.password-modal .modal-footer .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.password-modal .modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.password-modal .modal-footer .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .password-modal .modal-footer {
        flex-direction: column;
    }

    .password-modal .modal-footer button {
        width: 100%;
    }
}