/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2c2c2c;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
}

/* 菜單欄 */
.menu-bar {
    background-color: #1e1e1e;
    border-bottom: 1px solid #444;
    padding: 0 10px;
    display: flex;
    align-items: center;
    height: 30px;
    z-index: 1000;
}

.menu-item {
    position: relative;
    padding: 5px 12px;
    cursor: pointer;
    color: #ffffff;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.menu-item:hover {
    background-color: #404040;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2c2c2c;
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    min-width: 150px;
    display: none;
    z-index: 1001;
}

.menu-item:hover .menu-dropdown {
    display: block;
}

.menu-option {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.menu-option:hover {
    background-color: #404040;
}

.menu-option i {
    width: 16px;
    text-align: center;
}

/* 主工作區 */
.main-workspace {
    display: flex;
    height: calc(100vh - 60px);
    background-color: #2c2c2c;
}

/* Tui Image Editor 容器 */
#tui-image-editor {
    flex: 1;
    height: 100%;
    background-color: #1e1e1e;
}

/* 右側面板組 */
.panels-right {
    width: 250px;
    background-color: #2c2c2c;
    border-left: 1px solid #444;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* 面板樣式 */
.panel {
    border-bottom: 1px solid #444;
    background-color: #2c2c2c;
}

.panel-header {
    background-color: #404040;
    padding: 8px 12px;
    border-bottom: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
}

.panel-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    border-radius: 2px;
    transition: background-color 0.2s ease;
    font-size: 12px;
}

.btn-icon:hover {
    background-color: #555;
}

.panel-content {
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

/* 圖層面板 */
.layers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    background-color: #3c3c3c;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
}

.layer-item:hover {
    background-color: #4c4c4c;
}

.layer-item.active {
    background-color: #007acc;
}

/* 顏色面板 */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-preview {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.primary-color, .secondary-color {
    width: 40px;
    height: 40px;
    border: 2px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.primary-color:hover, .secondary-color:hover {
    transform: scale(1.05);
}

.primary-color {
    background-color: #000000;
}

.secondary-color {
    background-color: #ffffff;
}

.color-picker-wrapper {
    display: flex;
    justify-content: center;
}

/* 歷史記錄面板 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    padding: 6px 8px;
    background-color: #3c3c3c;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
    color: #ccc;
}

.history-item:hover {
    background-color: #4c4c4c;
}

.history-item.active {
    background-color: #007acc;
    color: #ffffff;
}

/* 屬性面板 */
#propertiesContent {
    font-size: 11px;
    color: #ccc;
}

/* 狀態欄 */
.status-bar {
    background-color: #1e1e1e;
    border-top: 1px solid #444;
    padding: 4px 12px;
    display: flex;
    gap: 20px;
    font-size: 11px;
    color: #ccc;
    height: 30px;
    align-items: center;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 模態框樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #2c2c2c;
    margin: 5% auto;
    border: 1px solid #555;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
    background-color: #404040;
    padding: 15px 20px;
    border-bottom: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* 幫助頁面樣式 */
.help-content {
    width: 90%;
    max-width: 1000px;
}

.help-tabs {
    display: flex;
    border-bottom: 1px solid #555;
    margin-bottom: 20px;
}

.tab-button {
    background: none;
    border: none;
    color: #ccc;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 14px;
}

.tab-button:hover {
    color: #ffffff;
    background-color: #404040;
}

.tab-button.active {
    color: #007acc;
    border-bottom-color: #007acc;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 20px;
}

.tab-pane h4 {
    color: #ffffff;
    margin: 20px 0 10px 0;
    font-size: 16px;
}

.tab-pane p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 15px;
}

.tab-pane ul, .tab-pane ol {
    color: #ccc;
    margin-left: 20px;
    margin-bottom: 15px;
}

.tab-pane li {
    margin-bottom: 5px;
    line-height: 1.5;
}

/* 工具說明樣式 */
.tool-category {
    margin-bottom: 25px;
}

.tool-category h4 {
    color: #007acc;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tool-item {
    padding: 8px 0;
    border-bottom: 1px solid #444;
    font-size: 13px;
}

.tool-item strong {
    color: #ffffff;
    font-weight: 600;
}

/* 快捷鍵樣式 */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.shortcut-section h3 {
    color: #007acc;
    margin-bottom: 15px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #3c3c3c;
    border-radius: 4px;
    font-size: 13px;
}

.key {
    background-color: #555;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
}

.description {
    color: #ccc;
}

/* 教程樣式 */
.tutorial-item {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #3c3c3c;
    border-radius: 6px;
    border-left: 4px solid #007acc;
}

.tutorial-item h4 {
    color: #ffffff;
    margin-bottom: 10px;
    font-size: 14px;
}

.tutorial-item ol {
    margin-left: 20px;
}

.tutorial-item li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* 關於頁面樣式 */
.about-content {
    text-align: center;
}

.logo-section {
    margin-bottom: 30px;
}

.logo {
    font-size: 48px;
    margin-bottom: 10px;
}

.logo-section h3 {
    color: #ffffff;
    margin-bottom: 5px;
    font-size: 24px;
}

.version {
    color: #007acc;
    font-size: 14px;
    font-weight: bold;
}

.features-section, .tech-section {
    margin-bottom: 25px;
    text-align: left;
}

.features-section h4, .tech-section h4 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 16px;
}

.features-section ul, .tech-section ul {
    list-style: none;
    padding: 0;
}

.features-section li, .tech-section li {
    padding: 5px 0;
    color: #ccc;
    border-bottom: 1px solid #444;
}

.features-section li:before, .tech-section li:before {
    content: "✓ ";
    color: #007acc;
    font-weight: bold;
}

.footer-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #555;
    color: #888;
    font-size: 12px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .panels-right {
        width: 200px;
    }
    
    .modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    .help-tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 8px 15px;
        font-size: 12px;
    }
}

/* Tui Image Editor 自定義樣式 */
.tui-image-editor {
    border: none !important;
}

.tui-image-editor .tui-image-editor-header {
    background-color: #2c2c2c !important;
    border-bottom: 1px solid #444 !important;
}

.tui-image-editor .tui-image-editor-main {
    background-color: #1e1e1e !important;
}

.tui-image-editor .tui-image-editor-menu {
    background-color: #2c2c2c !important;
    border-right: 1px solid #444 !important;
}

.tui-image-editor .tui-image-editor-submenu {
    background-color: #2c2c2c !important;
    border: 1px solid #555 !important;
}

.tui-image-editor .tui-image-editor-menu .tui-image-editor-item {
    color: #ffffff !important;
}

.tui-image-editor .tui-image-editor-menu .tui-image-editor-item:hover {
    background-color: #404040 !important;
}

.tui-image-editor .tui-image-editor-menu .tui-image-editor-item.active {
    background-color: #007acc !important;
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #2c2c2c;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* 動畫效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content {
    animation: fadeIn 0.3s ease;
}

/* 工具提示 */
[title] {
    position: relative;
}

/* 選中狀態 */
.selected {
    background-color: #007acc !important;
    color: #ffffff !important;
}

/* 禁用狀態 */
.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

/* 加載狀態 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #555;
    border-top: 2px solid #007acc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}