:root {
    --primary-color: #4CAF50;
    --secondary-color: #2E7D32;
    --danger-color: #f44336;
    --neutral-color: #f0f0f0;
    --text-color: #333;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
}

.header {
    background-color: white;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 24px;
}

.login-button,
.logout-button {
    padding: 10px 15px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.login-button {
    background-color: var(--primary-color);
}

.logout-button {
    background-color: var(--danger-color);
}

.login-button:hover,
.logout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.container {
    display: flex;
    gap: 20px;
    margin: 0 20px;
    max-width: 100%;
    flex: 1;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.main {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 10px;
    background-color: var(--primary-color);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-list a {
    display: block;
    padding: 10px 15px;
    background-color: var(--neutral-color);
    text-decoration: none;
    color: var(--text-color);
    border-radius: 4px;
    transition: all 0.3s ease;
    flex-grow: 1;
}

.category-list a:hover {
    transform: translateX(5px);
}

.category-list .active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

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

.image-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    height: 180px;
    overflow: hidden;
    border-radius: 4px;
    background-color: #f5f5f5;
}

.image-item img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.image-item:hover img {
    transform: scale(1.05);
}

.image-info {
    font-size: 14px;
    color: #666;
    margin-top: auto;
    text-align: left;
}

.image-info div {
    margin-bottom: 5px;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.action-buttons button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.action-buttons button:hover {
    transform: translateY(-2px);
}

.btn-view {
    background-color: #607D8B;
    color: white;
}

.btn-delete {
    background-color: var(--danger-color);
    color: white;
}

.error {
    color: var(--danger-color);
    margin-bottom: 15px;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
}

.message {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding: 10px;
    background-color: #e8f5e9;
    border-radius: 4px;
}

.form-group {
    margin-bottom: 15px;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

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

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

.btn1 {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn1:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.upload-form,
.create-category {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.upload-form h3,
.create-category h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 25px;
    border-radius: 8px;
    width: 350px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.discuz-image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(51, 51, 51, 0.6);
    /* Discuz 经典遮罩色 */
    text-align: center;
    overflow: auto;
}

.discuz-image-modal img {
    max-width: 90vw;
    max-height: 80vh;
    margin-top: 20px;
    border: 1px solid #ccc;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
    vertical-align: middle;
}

.discuz-image-modal .modal-dialog {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 4px;
    margin-top: 5%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.discuz-image-modal .close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 34px;
    color: #999;
    cursor: pointer;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    line-height: 24px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.discuz-image-modal .action-buttons {
    margin-top: 15px;
}

.discuz-image-modal .action-buttons button {
    background: #f5f5f5;
    border: 1px solid #ccc;
    color: #333;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 6px;
}

.discuz-image-modal .action-buttons button:hover {
    background: #e9e9e9;
    border-color: #bbb;
}


/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        margin: 0 10px;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

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

    .image-wrapper {
        height: 140px;
    }

    .discuz-image-modal .modal-dialog {
        padding: 20px 10px;
    }

    .discuz-image-modal .close-btn {
        position: absolute;
        top: 5px;
        right: 5px;
        font-size: 26px;
        width: 26px;
        height: 26px;
        line-height: 20px;

    }
}

/* 复制提示框样式 */
#copyPrompt {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #e8f5e9;
    /* 修改为浅绿色 */
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1001;
}

/* 添加 form-inline 类的样式 */
.form-inline {
    display: flex;
    align-items: center;
    gap: 15px;
    /* 调整元素之间的间距 */
}

.form-inline label {
    margin-bottom: 0;
    /* 移除 label 的底部边距 */
}

.form-inline input[type="file"] {
    flex: 1;
    /* 让文件输入框填充剩余空间 */
}

/* 底部样式 */
footer {
    background-color: white;
    padding: 20px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-top: 20px;
}

/* 统一提示框样式 */
#globalPrompt {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #e8f5e9;
    color: #4CAF50;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1001;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination a {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    margin: 0 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
}

.pagination a:hover:not(.active) {
    background-color: #f0f0f0;
}