/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* 创建一个包装器来应用渐变背景 */
.gradient-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* 导航栏 */
.navbar {
    background: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    flex-shrink: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    width: 100%;
    padding: 0 20px;
    margin: 0;
}

.nav-brand {
    order: 1;
    flex-shrink: 0;
}

.nav-menu {
    order: 2;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-brand a {
    font-size: 24px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-logo {
    height: 60px;
    width: auto;
    margin-right: 10px;
}

/* 移除原来的 nav-menu 样式，因为已经在上面重新定义了 */

.nav-menu a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-menu a.active {
    background: rgba(255, 255, 255, 0.2);
}

.user-info {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

/* 搜索框样式 */
.search-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    padding: 4px;
    transition: background 0.3s;
}

.search-form:hover {
    background: rgba(255, 255, 255, 0.95);
}

.search-input {
    border: none;
    background: transparent;
    padding: 8px 15px;
    font-size: 14px;
    width: 200px;
    outline: none;
    color: #333;
}

.search-input::placeholder {
    color: #666;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.search-btn:hover {
    transform: scale(1.1);
}

.search-icon {
    width: 16px;
    height: 16px;
}

.search-reset-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: #666;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    visibility: visible;
    opacity: 1;
}

.search-reset-btn-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.search-reset-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: #333;
    transform: scale(1.1);
}

/* 搜索高亮样式 */
.search-highlight {
    background: #ffeb3b;
    color: #333;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* 主内容区 */
.main-content {
    background: #ffffff;
    padding: 30px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin: 0;
    position: relative;
}

/* 登录页面 */
.login-box {
    max-width: 500px;
    margin: 250px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.login-hint {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

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

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

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

.btn:disabled,
.btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-copy {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.btn-copy:hover {
    background: #5568d3;
}

/* 提示框 */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 40px;
}

.upload-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.upload-box {
    border: 3px dashed #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-box:hover {
    border-color: #667eea;
    background: #f5f5f5;
}

.upload-box.drag-over {
    border-color: #667eea;
    background: #e8eaff;
}

.upload-area {
    cursor: pointer;
}

.upload-area svg {
    color: #667eea;
    margin-bottom: 15px;
}

.upload-area p {
    margin: 10px 0;
    color: #666;
}

.upload-hint {
    font-size: 14px;
    color: #999;
}

.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.upload-result {
    margin-top: 20px;
}

.result-item {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.result-item.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.result-item.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.result-url {
    display: flex;
    gap: 10px;
    align-items: center;
}

.result-url input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 图片网格 */
.images-section {
    margin-top: 30px;
}

.images-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.image-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.image-info {
    padding: 15px;
}

.image-url {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    cursor: pointer;
}

.image-url span {
    flex: 1;
    font-size: 12px;
    color: #666;
    word-break: break-all;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

.image-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

/* 图片列表样式 */
.image-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-list-item {
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s, border-color 0.2s;
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 0;
    align-items: stretch;
}

.image-list-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #d0d0d0;
}

.image-list-info {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.image-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 20px;
    flex: 1;
}

.image-list-filename {
    font-weight: 500;
    font-size: 15px;
    color: #333;
    word-break: break-word;
    flex: 1;
    min-width: 0;
    margin-top: 3px;
}

.image-list-filename svg {
    vertical-align: middle;
    margin-right: 6px;
    position: relative;
    top: 0.2px;
    width: 25px;
    height: 25px;
}

.image-list-size {
    font-weight: normal;
    font-size: 13px;
    color: #999;
    margin-left: 8px;
}

.image-list-details {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
    min-width: 200px;
    justify-content: flex-end;
}

.image-list-uploader {
    color: #666;
    white-space: nowrap;
}

.image-list-date {
    color: #999;
    white-space: nowrap;
}

.image-list-url-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 8px;
    position: relative;
    z-index: 1;
    flex: 1;
}

.image-list-url {
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.image-list-url-text {
    flex: 1;
    font-size: 12px;
    color: #666;
    word-break: break-all;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-list-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    z-index: 1;
    position: relative;
}

/* 批量管理样式 */
.batch-manage-toolbar {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.image-list-thumbnail {
    flex-shrink: 0;
    width: 120px;
    min-width: 120px;
    max-height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    overflow: hidden;
    align-self: center;
}

.image-list-thumbnail img {
    max-width: 100%;
    max-height: 50px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.image-checkbox-wrapper {
    padding: 16px 12px 16px 16px;
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0;
}

.image-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.image-list-item .image-list-info {
    flex: 1;
}

/* 后台管理 */
.admin-container {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

.admin-sidebar {
    width: 200px;
    flex-shrink: 0;
}

.admin-nav {
    background: white;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.admin-nav-item {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    transition: all 0.3s;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.admin-nav-item:hover {
    background: #f8f9fa;
    color: #667eea;
}

.admin-nav-item.active {
    background: #667eea;
    color: white;
}

.admin-nav-item:last-child {
    border-bottom: none;
}

.admin-content {
    flex: 1;
    min-width: 0;
}

.admin-section {
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: none;
}

.admin-section.active {
    display: block;
}

.admin-section h2 {
    margin-bottom: 20px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.admin-section h3 {
    margin: 20px 0 15px;
    color: #555;
}

.admin-form {
    margin-bottom: 30px;
}

.add-user-form {
    background: #fafafa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.user-list {
    background: #fafafa;
    padding: 20px;
    border-radius: 8px;
}

/* 表格样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.data-table tr:hover {
    background: #f9f9f9;
}

.data-table select {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* 模态框 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
}

.modal-close:hover {
    color: #333;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 10px;
    height: 50px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* 气泡提示样式 */
.copy-tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
}

.copy-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.copy-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
}

/* QMessageBox 样式 */
.qmessagebox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.qmessagebox.show {
    display: flex;
}

.qmessagebox-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 400px;
    max-width: 90vw;
    position: relative;
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

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

.qmessagebox-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.qmessagebox-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.qmessagebox-icon.question {
    color: #667eea;
}

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

.qmessagebox-body {
    padding: 20px 24px;
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.qmessagebox-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.qmessagebox-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.qmessagebox-btn.secondary {
    background: #6c757d;
    color: white;
}

.qmessagebox-btn.secondary:hover {
    background: #5a6268;
}

.qmessagebox-btn.danger {
    background: #dc3545;
    color: white;
}

.qmessagebox-btn.danger:hover {
    background: #c82333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .image-grid {
        grid-template-columns: 1fr;
    }
    
    .image-list-item {
        flex-direction: column;
    }
    
    .image-list-thumbnail {
        width: 100%;
        min-width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .image-list-thumbnail img {
        max-height: 200px;
    }
    
    .image-list-info {
        flex-direction: column;
        gap: 12px;
    }
    
    .image-list-meta {
        align-items: flex-start;
        width: 100%;
    }
    
    .image-list-details {
        align-items: flex-start;
    }
    
    .image-list-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 14px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
    
    /* 后台管理响应式设计 */
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        order: 2;
    }
    
    .admin-content {
        order: 1;
    }
    
    .admin-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .admin-nav-item {
        border-bottom: none;
        border-right: 1px solid #eee;
        flex-shrink: 0;
    }
    
    .admin-nav-item:last-child {
        border-right: none;
    }
    
    .admin-section {
        padding: 20px;
    }
}
