/* Windows 95 Style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #008080; /* Classic teal background */
    color: #000;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background-color: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    margin-bottom: 10px;
}

h1 {
    font-size: 16px;
    font-weight: bold;
}

/* 彩虹文字效果 */
.rainbow-text {
    background-image: linear-gradient(
        to right,
        #ff0000, /* 红 */
        #ff8000, /* 橙 */
        #ffff00, /* 黄 */
        #00ff00, /* 绿 */
        #0000ff, /* 蓝 */
        #4b0082, /* 靛 */
        #9400d3  /* 紫 */
    );
    background-size: 200% auto;
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow 4s linear infinite;
}

@keyframes rainbow {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

.help-button {
    padding: 4px 8px;
    background-color: #c0c0c0;
    color: #000;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    cursor: pointer;
    font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
}

.help-button:hover {
    background-color: #d4d0c8;
}

.help-button:active {
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 10px;
    height: calc(100vh - 60px); /* 减去header和padding的高度 */
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    background-color: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    height: 100%;
    overflow: hidden;
}

.categories {
    border-bottom: 1px solid #000;
}

.category {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #808080;
    font-size: 12px;
}

.category:last-child {
    border-bottom: none;
}

.category.active {
    background-color: #000080; /* Navy blue for selection */
    color: #fff;
}

.upload-btn {
    display: inline-block;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 18px;
    background-color: #c0c0c0;
    border-top: 1px solid #fff;
    border-left: 1px solid #fff;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
    cursor: pointer;
}

.upload-btn:hover {
    background-color: #d4d0c8;
}

.upload-btn:active {
    border-top: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #fff;
    border-bottom: 1px solid #fff;
}

.file-upload {
    display: none;
}

.images-container {
    flex: 1;
    overflow-x: hidden;
    padding: 5px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 5px;
    background-color: #fff;
    border-top: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #fff;
    border-bottom: 1px solid #fff;
    height: calc(100% - 180px); /* 减去类别列表的高度 */
    min-height: 100px;
}

.image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2px;
    border: 1px solid transparent;
    transition: background-color 0.2s;
    width: 76px; /* 固定宽度 */
    margin-bottom: 3px;
}

.image-item:hover {
    background-color: #e6e6e6;
    border: 1px dotted #808080;
}

.image-container {
    width: 64px;
    height: 64px;
    border: 1px solid #808080;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #fff;
    margin-bottom: 2px;
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
}

.image-name {
    font-size: 10px;
    margin-top: 1px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 70px;
}

/* Canvas Styles */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
}

.canvas-controls, .layer-controls {
    display: flex;
    gap: 5px;
    padding: 5px;
    background-color: #c0c0c0;
    border-bottom: 1px solid #808080;
}

.right-buttons {
    margin-left: auto;
}

.canvas {
    flex: 1;
    position: relative;
    background-color: #fff;
    overflow: hidden;
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
}

button {
    padding: 4px 8px;
    background-color: #c0c0c0;
    color: #000;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    cursor: pointer;
    font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
}

button:hover {
    background-color: #d4d0c8;
}

button:active {
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
}

/* Canvas Image Styles */
.canvas-image {
    position: absolute;
    cursor: move;
    user-select: none;
}

.canvas-image.selected {
    outline: 1px dashed #000;
    outline-offset: 1px;
}

/* 文本元素样式 */
.canvas-text {
    min-width: 50px;
    min-height: 30px;
    cursor: move;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.canvas-text:focus {
    outline: 1px dashed blue;
    cursor: text;
}

/* 文本控件样式 */
.text-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1001;
    pointer-events: auto;
}

.text-controls select, 
.text-controls button {
    font-size: 11px;
    padding: 2px 4px;
    height: 25px;
}

.transform-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.transform-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #000;
    border: 1px solid #fff;
    pointer-events: auto;
    cursor: nwse-resize;
}

.transform-handle.top-left {
    top: -4px;
    left: -4px;
    cursor: nwse-resize;
}

.transform-handle.top-right {
    top: -4px;
    right: -4px;
    cursor: nesw-resize;
}

.transform-handle.bottom-left {
    bottom: -4px;
    left: -4px;
    cursor: nesw-resize;
}

.transform-handle.bottom-right {
    bottom: -4px;
    right: -4px;
    cursor: nwse-resize;
}

.rotate-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #000080;
    border: 1px solid #fff;
    border-radius: 50%;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    cursor: grab;
}

/* 图层控制菜单样式 */
.layer-controls-menu {
    position: absolute;
    display: flex; /* 默认显示 */
    flex-direction: column;
    background-color: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    padding: 2px;
    z-index: 1000;
}

.layer-control-button {
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    margin: 2px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.1s ease;
}

/* 镜像按钮特殊样式 */
#flip-horizontal, #flip-vertical {
    font-size: 16px;
    font-weight: bold;
}

#flip-horizontal:active, #flip-vertical:active {
    transform: scale(0.95);
    animation: flipFeedback 0.3s ease;
}

@keyframes flipFeedback {
    0% {
        background-color: #c0c0c0;
    }
    50% {
        background-color: #a0a0a0;
    }
    100% {
        background-color: #c0c0c0;
    }
}

/* 图标样式 */
.icon-eye, .icon-download {
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.layer-control-button:hover {
    background-color: #d4d0c8;
}

.layer-control-button:active {
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
}

.sidebar, .canvas-container {
    transition: all 0.3s ease;
}

.sidebar.maximized, .canvas-container.maximized {
    position: absolute;
    z-index: 100;
    width: 90%;
    height: 90%;
    top: 5%;
    left: 5%;
}

/* Help Dialog Styles */
.help-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.help-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #c0c0c0;
    padding: 3px;
    width: 80%;
    max-width: 600px;
    max-height: 80%;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
}

.title-bar {
    background-color: #000080;
    color: #fff;
    padding: 4px 8px;
    font-size: 14px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.window-controls {
    display: flex;
}

.window-button {
    width: 16px;
    height: 14px;
    background-color: #c0c0c0;
    border-top: 1px solid #fff;
    border-left: 1px solid #fff;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
    margin-left: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    color: #000;
    cursor: pointer;
}

.window-button:active {
    border-top: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #fff;
    border-bottom: 1px solid #fff;
}

.close-btn {
    color: #fff;
    cursor: pointer;
    font-size: 20px;
}

.help-text {
    background-color: #fff;
    padding: 10px;
    max-height: 400px;
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
}

.help-text h3 {
    margin-top: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #808080;
    padding-bottom: 3px;
    font-size: 13px;
}

.help-text ul {
    padding-left: 20px;
}

.help-text li {
    margin-bottom: 6px;
    font-size: 12px;
} 

/* Windows 95通用滚动条样式 */
.win95-scrollbar {
    scrollbar-width: auto;
    scrollbar-color: #c0c0c0 #f0f0f0;
    overflow-y: auto;
}

.win95-scrollbar::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

.win95-scrollbar::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-left: 1px solid #808080;
}

.win95-scrollbar::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-top: 1px solid #fff;
    border-left: 1px solid #fff;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
}

.win95-scrollbar::-webkit-scrollbar-button {
    display: block;
    background-color: #c0c0c0;
    height: 16px;
    width: 16px;
    border-top: 1px solid #fff;
    border-left: 1px solid #fff;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
}

.win95-scrollbar::-webkit-scrollbar-button:vertical:start {
    background-image: linear-gradient(45deg, transparent 30%, #000 30%, #000 40%, transparent 40%), 
                      linear-gradient(-45deg, transparent 30%, #000 30%, #000 40%, transparent 40%);
    background-position: center 7px;
    background-repeat: no-repeat;
}

.win95-scrollbar::-webkit-scrollbar-button:vertical:end {
    background-image: linear-gradient(135deg, transparent 30%, #000 30%, #000 40%, transparent 40%), 
                      linear-gradient(-135deg, transparent 30%, #000 30%, #000 40%, transparent 40%);
    background-position: center 7px;
    background-repeat: no-repeat;
}

.win95-scrollbar::-webkit-scrollbar-button:horizontal:start {
    background-image: linear-gradient(45deg, transparent 30%, #000 30%, #000 40%, transparent 40%), 
                      linear-gradient(135deg, transparent 30%, #000 30%, #000 40%, transparent 40%);
    background-position: 7px center;
    background-repeat: no-repeat;
}

.win95-scrollbar::-webkit-scrollbar-button:horizontal:end {
    background-image: linear-gradient(-45deg, transparent 30%, #000 30%, #000 40%, transparent 40%), 
                      linear-gradient(-135deg, transparent 30%, #000 30%, #000 40%, transparent 40%);
    background-position: 7px center;
    background-repeat: no-repeat;
}

.win95-scrollbar::-webkit-scrollbar-corner {
    background-color: #c0c0c0;
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
}

/* Gallery Section Styles */
.gallery-section {
    margin-top: 20px;
    padding: 20px;
    background-color: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
}

.gallery-section h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #000;
    text-align: center;
    padding: 8px;
    background-color: #000080;
    color: #fff;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
}

.gallery-container {
    display: flex;
    gap: 20px;
    min-height: 300px;
}

.gallery-upload-area {
    flex: 0 0 300px;
    background-color: #fff;
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-placeholder {
    text-align: center;
    color: #808080;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.upload-placeholder h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #000;
}

.upload-placeholder p {
    font-size: 12px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.gallery-upload-area .upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    background-color: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    cursor: not-allowed;
    opacity: 0.6;
    width: auto;
    height: auto;
    margin-bottom: 20px;
}

.gallery-upload-area .upload-btn span {
    font-size: 14px;
}

.development-notice {
    background-color: #ffffe1;
    border: 1px solid #ffd700;
    padding: 15px;
    border-radius: 0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
}

.development-notice strong {
    display: block;
    margin-bottom: 8px;
    color: #ff4500;
    font-size: 12px;
}

.development-notice p {
    margin: 0;
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.gallery-grid {
    flex: 1;
    background-color: #fff;
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    padding: 20px;
}

.gallery-placeholder {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    height: 100%;
}

.placeholder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border: 1px dashed #ccc;
    padding: 20px;
    text-align: center;
    color: #999;
}

.placeholder-image {
    width: 80px;
    height: 80px;
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.placeholder-image::before {
    content: "🖼️";
    font-size: 24px;
    opacity: 0.3;
}

.placeholder-item p {
    font-size: 12px;
    margin: 0;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .gallery-container {
        flex-direction: column;
    }
    
    .gallery-upload-area {
        flex: none;
    }
    
    .gallery-placeholder {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
}

 