/**
 * 全局主题小组件样式
 * 使用gt-前缀避免与theme.css中的样式冲突
 */

/* 全局主题小组件样式 - 高优先级 */
.global-theme-widget {
    transition: all 0.3s ease;
}

/* 覆盖widget-manager.css中的样式 */
.global-theme-widget .widget-content {
    padding: 6px 8px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.global-theme-widget .gt-theme-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
}

/* 第一行：当前模式 - 字体大，居中显示 */
.global-theme-widget .gt-current-mode {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--text-color) !important;
    text-align: center !important;
    margin-bottom: 4px !important;
    padding: 3px 6px !important;
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    line-height: 1.1 !important;
}

/* 预设网格：最多3行，每行2条 - 完全居中布局 */
.global-theme-widget .gt-presets-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 4px 6px !important;
    width: 100% !important;
    max-height: 120px !important;
}

/* 单个预设项：每行2条，文字小，完全居中 */
.global-theme-widget .gt-preset-item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    flex: 0 0 calc(50% - 3px) !important;
    min-width: 0 !important;
    text-align: center !important;
    background: transparent !important;
    border: 1px solid transparent !important;
}

.global-theme-widget .gt-preset-item:hover {
    background: var(--hover-bg) !important;
    border-color: var(--link-color) !important;
}

.global-theme-widget .gt-preset-item.active {
    background: var(--active-bg) !important;
    border-color: var(--link-color) !important;
}

.global-theme-widget .gt-preset-preview {
    width: 12px !important;
    height: 10px !important;
    border-radius: 2px !important;
    margin-right: 4px !important;
    border: 1px solid var(--bg-border) !important;
    flex-shrink: 0 !important;
}

.global-theme-widget .gt-preset-name {
    font-size: 11px !important;
    font-weight: 400 !important;
    color: var(--text-secondary) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    flex: 1 !important;
    text-align: center !important;
}

/* 无预设主题提示 */
.global-theme-widget .gt-no-presets {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
    text-align: center !important;
    padding: 10px !important;
    font-style: italic !important;
}

/* 奇数个预设时的居中处理 */
.global-theme-widget .gt-presets-grid:has(.gt-preset-item:nth-child(1):last-child) {
    justify-content: center !important;
}

.global-theme-widget .gt-presets-grid:has(.gt-preset-item:nth-child(3):last-child) {
    justify-content: center !important;
}

.global-theme-widget .gt-presets-grid:has(.gt-preset-item:nth-child(5):last-child) {
    justify-content: center !important;
}

.global-theme-widget .gt-presets-grid:has(.gt-preset-item:nth-child(1):last-child) .gt-preset-item:nth-child(1) {
    margin-left: auto !important;
    margin-right: auto !important;
}

.global-theme-widget .gt-presets-grid:has(.gt-preset-item:nth-child(3):last-child) .gt-preset-item:nth-child(3) {
    margin-left: calc(50% - (calc(50% - 4px) / 2)) !important;
    margin-right: auto !important;
}

.global-theme-widget .gt-presets-grid:has(.gt-preset-item:nth-child(5):last-child) .gt-preset-item:nth-child(5) {
    margin-left: calc(50% - (calc(50% - 4px) / 2)) !important;
    margin-right: auto !important;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .global-theme-widget .gt-current-mode {
        font-size: 14px !important;
        padding: 3px 6px !important;
    }
    
    .global-theme-widget .gt-preset-name {
        font-size: 10px !important;
    }
    
    .global-theme-widget .gt-preset-preview {
        width: 10px !important;
        height: 8px !important;
        margin-right: 3px !important;
    }
}