/* 图片加载状态 */
.loading-item {
    position: relative;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.loading-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, 
        transparent, 
        rgba(79, 172, 254, 0.15), 
        rgba(79, 172, 254, 0.2), 
        rgba(79, 172, 254, 0.15), 
        transparent);
    animation: loading-shine 1.8s infinite ease-in-out;
}

.loading-item::after {
    content: attr(data-wait-text);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 15px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 4px;
    opacity: 0.95;
    white-space: nowrap;
    font-weight: 500;
}

@keyframes loading-shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 确保结果图片淡入效果 */
.result-img {
    transition: opacity 0.3s ease-in-out;
    border-radius: var(--border-radius);
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.button-group {
    display: none; /* 隐藏导出数据按钮组 */
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.button-group-label {
    font-weight: bold;
    min-width: 80px;
    color: var(--text-color);
}

.loading-spinner {
    width: 30px;
    height: 30px;
    margin: 0 auto 15px auto;
    border: 3px solid rgba(79, 172, 254, 0.2);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.success-message {
    color: #4CAF50;
    background-color: rgba(18, 36, 64, 0.6);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(76, 175, 80, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.error-message {
    color: #F44336;
    background-color: rgba(18, 36, 64, 0.6);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(244, 67, 54, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}


.details-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 15px;
    margin-top: 10px;
}

.details-grid span:nth-child(odd) {
    font-weight: normal;
    color: #666;
}

.details-grid span:nth-child(even) {
    font-weight: 500;
    color: #333;
}

/* 确保修改密码表单的确认按钮居中 */
#change-password-form .form-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

#change-password-form .submit-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    max-width: 250px;
    text-align: center;
}

#change-password-form .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.3);
}

/* 图片尺寸选择器样式 */
.image-size-selector {
    position: relative; /* 添加相对定位 */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    background-color: rgba(18, 36, 64, 0.3);
    border-radius: var(--border-radius);
    border: none;
    padding: 1rem;
}

.image-size-selector h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
    text-shadow: 0 0 5px rgba(79, 172, 254, 0.3);
}

.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1rem;
    align-items: center;
    width: 100%;
}

.size-label, .resolution-label {
    color: var(--text-color);
    font-size: 0.95rem;
    margin-right: 0.5rem;
    font-weight: 500;
}

.resolution-label {
    margin-left: 1.5rem;
}

#current-resolution {
    font-family: 'Consolas', monospace;
    letter-spacing: 0.05rem;
    color: var(--text-muted);
}

/* 下拉框尺寸选择器样式 */
.size-dropdown-container {
    position: relative;
    min-width: 90px;
}

.size-dropdown {
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: var(--border-radius);
    background-color: rgba(79, 172, 254, 0.1);
    border: 1px solid rgba(79, 172, 254, 0.2);
    color: var(--text-color);
    appearance: none; /* 移除默认下拉箭头 */
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    font-size: 0.95rem;
}

.size-dropdown:hover {
    background-color: rgba(79, 172, 254, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.size-dropdown:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(79, 172, 254, 0.5);
}

/* 自定义下拉箭头 */
.size-dropdown-container::after {
    content: '▼';
    font-size: 0.8rem;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    pointer-events: none; /* 确保点击能穿透到select元素 */
}

/* 下拉选项样式 - 注意这些在某些浏览器可能不生效 */
.size-dropdown option {
    background-color: rgba(18, 36, 64, 0.95);
    color: var(--text-color);
    padding: 10px;
}

/* 暗色模式适配 */
.dark-mode .size-dropdown {
    background-color: rgba(79, 172, 254, 0.05);
    color: #f0f0f0;
}
.dark-mode .size-dropdown option {
    background-color: #192233;
}

/* 亮色模式适配 */
.light-mode .size-dropdown {
    background-color: rgba(79, 172, 254, 0.1);
    color: #222;
}
.light-mode .size-dropdown option {
    background-color: #f5f8ff;
    color: #333;
}

.size-option {
    background-color: rgba(79, 172, 254, 0.1);
    border: 1px solid rgba(79, 172, 254, 0.2);
    color: var(--text-color);
    padding: 0.5rem 0.8rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    text-align: center;
    min-width: 60px;
}

.size-option:hover {
    background-color: rgba(79, 172, 254, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.size-option.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(79, 172, 254, 0.5);
}

.selected-resolution {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem;
    background-color: rgba(18, 36, 64, 0.4);
    border-radius: var(--border-radius);
}

.selected-resolution span {
    font-family: 'Consolas', monospace;
    letter-spacing: 0.05rem;
}


/* 在RTL布局中反向方向的滚动容器 */
[lang="ar"] .prompts-container {
    direction: rtl;
}


/* 风格预览模块 */
.style-preview-container {
    margin-top: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.style-preview {
    background: rgba(23, 32, 56, 0.6);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.style-preview h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: left;
}

.style-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    padding: 5px;
}

.style-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.style-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.style-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.style-item .style-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px;
    color: #fff;
    font-size: 0.8rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.style-item:hover .style-overlay {
    opacity: 1;
}

.no-styles-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #fff;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* Arabic Font Support */
html[dir="rtl"] body,
[lang="ar"] body {
    font-family: 'Segoe UI', Tahoma, 'Arial Unicode MS', sans-serif;
}

/* 导航栏特定RTL支持 */
html[dir="rtl"] header .brand,
[lang="ar"] header .brand {
    margin-right: 0;
    margin-left: auto;
}

html[dir="rtl"] .menu-items,
[lang="ar"] .menu-items {
    padding-right: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: row-reverse;
}

html[dir="rtl"] .menu-item,
[lang="ar"] .menu-item {
    margin-right: 0;
    margin-left: 20px;
}

html[dir="rtl"] .current-lang,
[lang="ar"] .current-lang {
    margin-right: 0;
    margin-left: 10px;
}

html[dir="rtl"] .nav-menu,
[lang="ar"] .nav-menu {
    margin-left: 0;
    margin-right: auto;
}

/* 在RTL模式下调整header布局 - 品牌在右，菜单在左 */
html[dir="rtl"] header,
[lang="ar"] header {
    flex-direction: row-reverse;
    justify-content: space-between;
}

/* 品牌标志和文字位置调整 */
html[dir="rtl"] .brand,
[lang="ar"] .brand {
    margin-right: 0;
    margin-left: auto;
    order: 2; /* 确保品牌元素放在最右侧 */
}

/* 头部控件位置调整 */
html[dir="rtl"] .header-controls,
[lang="ar"] .header-controls {
    margin-left: 0;
    margin-right: auto;
    order: 1; /* 控件在左侧 */
}

/* 导航菜单项 */
html[dir="rtl"] .menu-items,
[lang="ar"] .menu-items {
    flex-direction: row-reverse;
}

/* 通知样式 */
.notification-container {
  position: fixed;
  top: 20px;
  left: 60%;
  /* right: 20px; */
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.notification {
  margin-bottom: 10px;
  padding: 15px 20px;
  min-width: 280px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  background: white;
  border-left: 4px solid;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  border-left-color: #10b981;
}

.notification.error {
  border-left-color: #ef4444;
}

.notification.info {
  border-left-color: #3b82f6;
}

.notification.warning {
  border-left-color: #f59e0b;
}

.notification-icon {
  margin-right: 12px;
  font-size: 20px;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #1f2937;
}

.notification-message {
  color: #4b5563;
}

.notification-close {
  margin-left: 12px;
  color: #9ca3af;
  cursor: pointer;
  font-size: 18px;
}

.notification-close:hover {
  color: #4b5563;
}

/* 用户登录和积分显示 */
.user-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.auth-btn {
    background-color: rgba(79, 172, 254, 0.1);
    border: 1px solid rgba(79, 172, 254, 0.2);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-color);
    transition: var(--transition);
}

.auth-btn:hover {
    background-color: rgba(79, 172, 254, 0.2);
}

/* 用户积分标签样式 */
.credits-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(115, 103, 240, 0.15);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(115, 103, 240, 0.3);
    order: 2; /* 显示顺序：2 */
    margin-right: 0.5rem;
}

.credits-badge i {
    color: #ffc107;
}

#user-profile-btn {
    order: 3; /* 显示顺序：3 */
}

#login-btn {
    order: 1; /* 显示顺序：1 */
}

#user-management-btn {
    order: 4; /* 显示顺序：4 */
}

html[dir="rtl"] .user-auth {
    flex-direction: row-reverse;
}

html[dir="rtl"] .credits-badge {
    margin-right: 0;
    margin-left: 0.5rem;
    order: 3;
}

html[dir="rtl"] #user-profile-btn {
    order: 2;
}

html[dir="rtl"] #login-btn {
    order: 4;
}

html[dir="rtl"] #user-management-btn {
    order: 1;
}



/* 添加默认尺寸样式 */
.image-size-selector::before {
    /* content: "默认尺寸: 1:1 (1024×1024)"; */
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* 登录后不显示默认尺寸提示 */
.image-size-selector.login-state::before {
    display: none;
}

/* 更新登录状态下的布局 */
.auth-required.size-options {
    /* margin-top: 0.5rem; */
    margin-top: 0;
}

/* 促销按钮样式 */
.premium-features-banner {
    margin: -10px 0 5px;
    text-align: center;
}

.premium-login-btn {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(79, 172, 254, 0.3);
    display: inline-block;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 100%;
    overflow: hidden;
}

.premium-login-btn:hover {
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 172, 254, 0.4);
}

.premium-login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(79, 172, 254, 0.3);
}