.sidebar {
    transition: transform 0.3s ease, width 0.3s ease, box-shadow 0.3s ease !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent !important;
    transition: transform 0.3s ease !important;
}

.sidebar::-webkit-scrollbar {
    width: 4px !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-radius: 2px !important;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent !important;
}

.sidebar-menu a {
    position: relative !important;
    overflow: hidden !important;
}

.sidebar-menu a::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 0 !important;
    height: 2px !important;
    background-color: var(--primary-color) !important;
    transition: width 0.3s ease !important;
}

.sidebar-menu a:hover::after {
    width: 100% !important;
}

.sidebar-menu a i {
    transition: transform 0.2s ease !important;
}

.sidebar-menu a:hover i {
    transform: translateX(3px) !important;
}

.mobile-menu-toggle {
    position: relative !important;
    z-index: 1010 !important;
    transition: all 0.3s ease !important;
    outline: none !important;
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    color: var(--primary-color) !important;
    display: none !important;
}

.mobile-menu-toggle:hover {
    color: var(--hover-color) !important;
}

.mobile-menu-toggle:active {
    transform: scale(0.95) !important;
}

@media (max-width: 768px) {
    html body .sidebar,
    body .sidebar {
        transform: translateX(-100%) !important;
        z-index: 10000 !important;
        position: fixed !important;
        width: 80% !important;
        max-width: 300px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    html body.menu-open .sidebar,
    body.menu-open .sidebar {
        transform: translateX(0) !important;
        box-shadow: 0 0 15px rgba(0,0,0,0.2) !important;
        z-index: 10000 !important;
    }

    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        pointer-events: auto;
        touch-action: none;
    }


    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }


    .sidebar-header {
        flex-shrink: 0 !important;
        padding: 15px 20px !important;
    }

    .sidebar-menu {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 10px 0 !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        scrollbar-color: rgba(0, 0, 0, 0.2) transparent !important;
    }

    .sidebar-menu::-webkit-scrollbar {
        width: 4px !important;
    }

    .sidebar-menu::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.2) !important;
        border-radius: 2px !important;
    }

    .sidebar-menu::-webkit-scrollbar-track {
        background: transparent !important;
    }


    .sidebar-user {
        flex-shrink: 0 !important;
        padding: 15px 20px !important;
        border-top: 1px solid var(--border-color) !important;
        background-color: #f8f9fa !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
    }
}

.btn {
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
    font-weight: 500 !important;
}

.btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.btn::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 5px !important;
    height: 5px !important;
    background: rgba(255, 255, 255, 0.5) !important;
    opacity: 0 !important;
    border-radius: 100% !important;
    transform: scale(1, 1) translate(-50%, -50%) !important;
    transform-origin: 50% 50% !important;
}

.btn:hover::after {
    animation: ripple 0.6s ease-out !important;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0) !important;
        opacity: 0.5 !important;
    }
    100% {
        transform: scale(20, 20) !important;
        opacity: 0 !important;
    }
}

.btn .loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: btn-spin 1s ease-in-out infinite;
    margin-right: 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

form[class*="ai-drawing-form"] .btn-primary,
#caption-reverse-form .btn-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px !important;
    padding: 10px 20px !important;
    min-width: 120px !important;
}

form[class*="ai-drawing-form"] .btn-primary:hover,
#caption-reverse-form .btn-primary:hover {
    background-color: var(--hover-color) !important;
}

.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.card:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
}

.main-content {
    background-color: #f8f9fa !important;
    min-height: 100vh !important;
    transition: margin-left 0.3s ease !important;
}

.history-item {
    transition: all 0.3s ease !important;
}


.admin-bar .sidebar {
    top: 32px !important;
    height: calc(100vh - 32px) !important;
}

.admin-bar .top-bar {
    top: 32px !important;
}

@media (max-width: 782px) {
    .admin-bar .sidebar {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
    }

    .admin-bar .top-bar {
        top: 46px !important;
    }
}

@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important;
        display: block !important;
        overflow-y: auto !important;
    }

    .sidebar-header {
        padding: 20px !important;
    }

    .sidebar-menu {
        padding: 20px 0 120px 0 !important;
        overflow: visible !important;
    }

    .sidebar-user {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background: #f8f9fa !important;
        border-top: 1px solid #e0e0e0 !important;
        padding: 15px 20px !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
    }

    .main-content {
        margin-left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
}

.file-preview {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-preview img,
.preview-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    object-fit: contain;
}

.preview-item {
    position: relative;
    max-width: 200px;
    margin-right: 10px;
    margin-bottom: 10px;
}

.ai-file-upload + .file-preview img {
    max-height: 150px;
    width: auto;
}

#reverse-image + .file-preview img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.points-info {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
    background-color: #f8f9fa;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
}

.points-cost {
    font-weight: bold;
    color: #e74c3c;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block !important;
    }
}



.user-points-container {
    margin-bottom: 10px;
    padding: 0 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.safety-reminder {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    margin: 0;
    box-shadow: none;
    flex: none;
}

.safety-reminder svg {
    margin-right: 4px;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.safety-reminder::before {
    display: none;
}

.user-points-bar {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    color: #4a5568;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(30, 144, 255, 0.1);
    margin: 0;
    min-width: auto;
}

.user-points-bar .points-label {
    margin: 0;
    font-weight: 500;
    color: #4a5568;
}

.user-points-bar .points-container {
    background: rgba(30, 144, 255, 0.08);
    border-radius: 10px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(30, 144, 255, 0.1);
    margin: 0;
}

#user-points-value {
    color: var(--primary-color);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    min-width: 20px;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    font-size: 12px;
}

#user-points-value::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e90ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpath d='M12 6v6l4 2'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
    animation: points-pulse 2s infinite ease-in-out;
}

@keyframes points-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#user-points-value.points-increase {
    animation: points-increase 0.8s;
}

#user-points-value.points-decrease {
    animation: points-decrease 0.8s;
}

@keyframes points-increase {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #10b981; }
    100% { transform: scale(1); }
}

@keyframes points-decrease {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #ef4444; }
    100% { transform: scale(1); }
}

.sidebar-username {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: bold;
    position: relative;
    display: block;
    outline: none;
    text-align: center;
}
.sidebar-username i {
    margin-right: 6px;
}
.sidebar-logout-popup {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 44px;
    min-width: 120px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.13), 0 1.5px 4px rgba(0,0,0,0.08);
    padding: 12px 0 8px 0;
    z-index: 1012;
    animation: fadeIn 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.btn-logout {
    background: #e74c3c !important;
    color: #fff !important;
    border-radius: 4px !important;
    padding: 4px 16px !important;
    font-size: 0.95rem !important;
    margin: 0 auto;
    display: inline-block;
}
.btn-logout i {
    margin-right: 4px;
}
.sidebar-logout-btn {
    display: block;
    margin-top: 10px;
    animation: fadeIn 0.2s;
}

.login-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

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

.login-modal-content {
    background-color: #fff;
    margin: 5vh auto;
    width: 400px;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    overflow: auto;
    animation: slideDown 0.4s ease;
    box-sizing: border-box;
    position: relative;
    top: 45%;
    transform: translateY(-50%);
}

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

.login-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    margin-right: 15px;
    margin-top: 5px;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 10000;
    position: relative;
}

.login-close:hover {
    color: var(--primary-color);
}

.login-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.login-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-weight: 500;
    text-align: center;
}

.login-body {
    padding: 20px;
}

.login-form .form-group {
    margin-bottom: 15px;
    box-sizing: border-box;
    width: 100%;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border 0.3s ease;
    box-sizing: border-box;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus,
.login-form input[type="email"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
}

.login-form .remember-me {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.login-form .remember-me-left {
    display: flex;
    align-items: center;
}

.login-form .remember-me input[type="checkbox"] {
    margin-right: 5px;
    vertical-align: middle;
}

.login-form .remember-me label {
    display: inline;
    margin-bottom: 0;
    vertical-align: middle;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    text-decoration: underline;
}

.login-submit-btn {
    width: 100%;
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.login-submit-btn:hover {
    background-color: var(--hover-color);
}

.register-link {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

.register-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

.login-message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    display: none;
}

.login-message.error {
    background-color: #ffe6e6;
    color: #cc0000;
    border: 1px solid #ffcccc;
    display: block;
}

.login-message.success {
    background-color: #e6ffe6;
    color: #006600;
    border: 1px solid #ccffcc;
    display: block;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .login-modal-content {
        margin: 0 auto;
        width: 90%;
        max-width: 350px;
        top: 50%;
        transform: translateY(-50%);
        max-height: 85vh;
    }
}

/* 弹窗打开时禁止页面滚动 */
body.modal-open {
    overflow: hidden;
}

/* 邀请码表单样式 */
.invitation-code-field {
    margin-bottom: 15px;
}

.invitation-code-tip {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* 隐藏邀请码字段，由JavaScript根据设置决定是否显示 */
#invitation-code-group {
    display: none;
}

/* 为PC端添加特定的位置调整 */
@media (min-width: 769px) {
    .login-modal-content {
        top: 45%;
    }
}

/* SVG加载动画 */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    text-align: center;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    animation: spinner-rotate 2s linear infinite;
}

.loading-spinner-circle {
    stroke: var(--primary-color);
    stroke-linecap: round;
    animation: spinner-dash 1.5s ease-in-out infinite;
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
}

.loading-text {
    font-size: 16px;
    color: #555;
    margin: 10px 0;
    font-weight: 500;
}

@keyframes spinner-rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes spinner-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* 任务创建和处理中的状态 */
.task-created {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 新的等待状态样式 - 匹配页面整体风格 */
.task-progress-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 32px 24px;
    margin: 24px 0;
    color: #333;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.task-progress-container:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.task-progress-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #1e90ff, transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    gap: 16px;
}

.progress-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f7ff;
    border-top: 3px solid #1e90ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.progress-time-display {
    background: linear-gradient(135deg, #f0f7ff 0%, #e3f2fd 100%);
    border: 1px solid rgba(30, 144, 255, 0.1);
    border-radius: 8px;
    padding: 20px 24px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(30, 144, 255, 0.1);
}

.time-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.time-value {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #1e90ff;
    text-shadow: none;
    letter-spacing: 2px;
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e0e0e0;
    animation: pulse 1.5s ease-in-out infinite;
}

.progress-dot:nth-child(1) { animation-delay: 0s; }
.progress-dot:nth-child(2) { animation-delay: 0.3s; }
.progress-dot:nth-child(3) { animation-delay: 0.6s; }
.progress-dot:nth-child(4) { animation-delay: 0.9s; }
.progress-dot:nth-child(5) { animation-delay: 1.2s; }

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        background: #e0e0e0;
    }
    50% {
        transform: scale(1.5);
        background: #1e90ff;
    }
}

.progress-message {
    font-size: 16px;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.progress-info {
    font-size: 14px;
    color: #888;
    line-height: 1.5;
    margin-top: 16px;
}

/* 隐藏旧的进度条样式 */
.progress-bar-wrapper,
.progress-bar,
.progress-bar-fill {
    display: none !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .task-progress-container {
        padding: 24px 16px;
        margin: 16px 0;
    }

    .progress-header {
        margin-bottom: 16px;
        gap: 12px;
    }

    .progress-spinner {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }

    .progress-title {
        font-size: 18px;
    }

    .time-value {
        font-size: 28px;
        letter-spacing: 1px;
    }

    .progress-time-display {
        padding: 16px 20px;
        margin: 16px 0;
    }
}

/* 成功状态样式 - 使用绿色卡片风格 */
.task-progress-container.success {
    background: #ffffff;
    border: 1px solid #d4edda;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

.task-progress-container.success::before {
    background: linear-gradient(90deg, transparent, #28a745, transparent);
}

.task-progress-container.success .progress-spinner {
    border: 3px solid #f0fff4;
    border-top: 3px solid #28a745;
    animation: checkmark 0.6s ease-in-out forwards;
}

.task-progress-container.success .progress-title {
    color: #155724;
}

.task-progress-container.success .time-value {
    color: #28a745;
}

.task-progress-container.success .progress-dots .progress-dot {
    background: #28a745;
    animation: none;
    transform: scale(1.2);
}

@keyframes checkmark {
    0% {
        transform: rotate(0deg);
        border-radius: 50%;
    }
    50% {
        transform: rotate(180deg);
        border-radius: 50%;
    }
    100% {
        transform: rotate(360deg);
        border-radius: 50%;
        border: none;
        background: #28a745;
        width: 40px;
        height: 40px;
        position: relative;
    }
}

.task-progress-container.success .progress-spinner::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
}

/* 错误状态样式 - 使用红色卡片风格 */
.task-progress-container.error {
    background: #ffffff;
    border: 1px solid #f5c6cb;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.15);
}

.task-progress-container.error::before {
    background: linear-gradient(90deg, transparent, #dc3545, transparent);
}

.task-progress-container.error .progress-spinner {
    border: 3px solid #fff5f5;
    border-top: 3px solid #dc3545;
    animation: error-shake 0.6s ease-in-out forwards;
}

.task-progress-container.error .progress-title {
    color: #721c24;
}

.task-progress-container.error .time-value {
    color: #dc3545;
}

.task-progress-container.error .progress-dots .progress-dot {
    background: #dc3545;
    animation: none;
    transform: scale(1.2);
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.task-progress-container.error .progress-spinner::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #dc3545;
    font-size: 24px;
    font-weight: bold;
}

/* 侧边栏菜单样式 */
.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu .menu-item,
.sidebar-menu .menu-parent {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.sidebar-menu i {
    margin-right: 10px;
    width: 16px;
    text-align: center;
}

.menu-tag {
    background-color: #ff6b35;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: bold;
}

/* 子菜单样式 */
.menu-parent .menu-toggle {
    position: relative;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.menu-parent .menu-toggle .fa-chevron-down {
    margin-left: auto !important;
    font-size: 12px !important;
    transition: transform 0.3s ease !important;
}

.menu-parent.open .menu-toggle .fa-chevron-down {
    transform: rotate(180deg) !important;
}

.submenu {
    display: none !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background-color: #f8fafc !important;
    border-radius: 8px !important;
    margin-top: 5px !important;
    overflow: hidden !important;
}

.submenu li {
    margin: 0 !important;
}

.submenu a {
    padding: 10px 20px 10px 40px !important;
    font-size: 14px !important;
    color: #64748b !important;
    background-color: transparent !important;
    border-radius: 0 !important;
    border-left: 3px solid transparent !important;
}

.submenu a:hover,
.submenu a.active {
    background-color: var(--primary-color) !important;
    color: white !important;
    transform: translateX(5px) !important;
    border-left: 3px solid var(--primary-color) !important;
}

/* 桌面端默认展开子菜单 */
@media (min-width: 769px) {
    .menu-parent.open .submenu,
    .menu-parent .submenu {
        display: block !important;
    }

    /* 桌面端子菜单项有活动状态时，父菜单也显示激活状态 */
    .menu-parent.has-active-child > .menu-toggle {
        background-color: rgba(30, 144, 255, 0.1) !important;
        border-left: 3px solid var(--primary-color) !important;
        color: var(--primary-color) !important;
        font-weight: 500 !important;
    }
}

/* 移动端子菜单样式 */
@media (max-width: 768px) {
    .submenu {
        background-color: #e2e8f0 !important;
        margin-left: 10px !important;
        margin-right: 10px !important;
    }

    .submenu a {
        padding: 8px 15px 8px 30px !important;
        font-size: 13px !important;
    }
}

/* 用户名退出弹窗样式增强 */
.sidebar-logout-popup {
    display: none; /* 默认隐藏 */
}

.sidebar-username {
    transition: color 0.3s ease;
}

.sidebar-username:hover {
    color: #0074e8 !important;
}

.sidebar-logout-popup {
    border: 1px solid #e1e5e9;
}

.sidebar-logout-popup::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
}

.sidebar-logout-popup::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid #e1e5e9;
    z-index: -1;
}

.btn-logout:hover {
    background: #c0392b !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mobile-header .mobile-points {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    color: #4a5568;
    margin-left: 10px;
    white-space: nowrap;
    gap: 4px;
}

.mobile-header .mobile-points .points-label {
    font-size: 11px;
    margin: 0;
    font-weight: 500;
    color: #4a5568;
}

.mobile-header .mobile-points #user-mobile-points {
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(30, 144, 255, 0.08);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.mobile-header .mobile-points #user-mobile-points::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 3px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e90ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpath d='M12 6v6l4 2'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
}

/* 图片结果展示样式 - 现代化卡片设计 */
.generation-result {
    margin-top: 24px;
}

.result-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-container:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.result-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1e90ff, #00bcd4, #1e90ff);
    background-size: 200% 100%;
    animation: success-shimmer 2s ease-in-out;
}

@keyframes success-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.result-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-title::before {
    content: '🎨';
    font-size: 20px;
}

.result-status {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    color: #155724;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.result-image-container {
    position: relative;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 300px; /* 预留最小高度避免布局跳动 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
    border-radius: 8px;
    opacity: 0; /* 初始透明，加载完成后显示 */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    max-height: 100%;
    object-fit: contain;
}

.result-image.loaded {
    opacity: 1; /* 加载完成后显示 */
}

.result-image:hover {
    transform: scale(1.02);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.result-image-container:hover .image-overlay {
    background: rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.overlay-icon {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #1e90ff;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

/* 图片加载占位符 */
.image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.image-placeholder.hidden {
    opacity: 0;
    pointer-events: none;
}

.image-placeholder .loading-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #1e90ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-placeholder .loading-text {
    font-size: 13px;
    color: #6c757d;
    margin-top: 8px;
}

.result-image-container:hover .overlay-icon {
    transform: scale(1);
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.result-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.result-btn:hover::before {
    left: 100%;
}

.result-btn-primary {
    background: linear-gradient(135deg, #1e90ff 0%, #0066cc 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(30, 144, 255, 0.3);
}

.result-btn-primary:hover {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    box-shadow: 0 6px 20px rgba(30, 144, 255, 0.4);
    transform: translateY(-2px);
}

.result-btn-secondary {
    background: #ffffff;
    color: #666;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-btn-secondary:hover {
    background: #f8f9fa;
    border-color: #1e90ff;
    color: #1e90ff;
    box-shadow: 0 4px 15px rgba(30, 144, 255, 0.2);
    transform: translateY(-1px);
}

.result-info {
    background: linear-gradient(135deg, #f0f7ff 0%, #e3f2fd 100%);
    border: 1px solid rgba(30, 144, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.result-info-icon {
    color: #1e90ff;
    margin-right: 8px;
    font-size: 16px;
}

@media (max-width: 768px) {
    .result-container {
        padding: 20px 16px;
        margin: 16px 0;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        text-align: left;
    }

    .result-title {
        font-size: 16px;
    }

    .result-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .result-btn {
        justify-content: center;
        padding: 14px 20px;
    }

    .overlay-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .result-image-container {
        min-height: 250px;
    }

    .image-placeholder .loading-spinner {
        width: 35px;
        height: 35px;
    }

    .image-placeholder .loading-text {
        font-size: 12px;
    }
}

.result-container {
    animation: result-fade-in 0.6s ease-out;
}

@keyframes result-fade-in {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 登录按钮居中显示 */
#login-btn, #mobile-login-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto !important;
    text-align: center !important;
}

.sidebar-user {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}