/* 图片宫格生成器 - 样式文件 */
/* 深蓝色科技风格 */

/* ===== CSS 变量 ===== */
:root {
    /* 颜色 */
    --bg-primary: #0a101f;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    
    --primary: #0099ff;
    --primary-hover: #00aaff;
    --primary-glow: rgba(0, 153, 255, 0.3);
    
    --accent: #00ccff;
    --accent-light: #40e0ff;
    
    --text-primary: #ffffff;
    --text-secondary: #b0c4e0;
    --text-muted: #667892;
    
    --border-color: rgba(0, 153, 255, 0.2);
    --border-glow: rgba(0, 153, 255, 0.4);
    
    --success: #36d370;
    --warning: #ff9c40;
    --danger: #ff4444;
    
    /* 间距 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* 圆角 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--primary-glow);
    
    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ===== 头部导航 ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.header-home-btn:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.header-logo {
    height: 36px;
    width: auto;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.vip-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.vip-1 {
    background: linear-gradient(135deg, #0099ff, #00ccff);
    color: white;
}

.vip-2 {
    background: linear-gradient(135deg, #ff9c40, #ffb347);
    color: white;
}

/* ===== 主容器 ===== */
.main-container {
    max-width: 1920px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    min-height: calc(100vh - 80px);
}

/* ===== 权限弹窗 ===== */
.permission-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 16, 31, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl) * 2;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-glow);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.modal-text {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.modal-text-secondary {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.modal-btn {
    display: inline-block;
    margin-top: var(--spacing-lg);
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ===== 工具主界面 ===== */
.tool-container {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

/* ===== 侧边栏 ===== */
.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* 自定义滚动条 */
.sidebar-left::-webkit-scrollbar,
.sidebar-right::-webkit-scrollbar {
    width: 6px;
}

.sidebar-left::-webkit-scrollbar-track,
.sidebar-right::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.sidebar-left::-webkit-scrollbar-thumb,
.sidebar-right::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-left::-webkit-scrollbar-thumb:hover,
.sidebar-right::-webkit-scrollbar-thumb:hover {
    background: var(--border-glow);
}

/* ===== 面板 ===== */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.panel-title {
    background: var(--bg-secondary);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.panel-content {
    padding: var(--spacing-lg);
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    outline: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-start {
    background: linear-gradient(135deg, var(--success), #2eb85c);
    color: white;
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-start:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(54, 211, 112, 0.4);
}

.btn-stop {
    background: linear-gradient(135deg, var(--danger), #ff6666);
    color: white;
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-stop:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
}

/* ===== 表单控件 ===== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-color {
    width: 100%;
    height: 40px;
    padding: 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.form-range {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ===== 布局选项 ===== */
.layout-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.layout-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.layout-option:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.layout-option input[type="radio"] {
    margin: 0;
}

.layout-option input[type="radio"]:checked + .layout-label {
    color: var(--primary);
    font-weight: 600;
}

.layout-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== 预设尺寸 ===== */
.preset-sizes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.preset-sizes .btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.preset-sizes .btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== 文件夹列表 ===== */
.folder-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.folder-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.folder-item:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.folder-item.active {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.folder-icon {
    font-size: 1.25rem;
}

.folder-info {
    flex: 1;
    min-width: 0;
}

.folder-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.folder-delete {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

/* ===== 格子配置 ===== */
.cell-config-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.cell-config-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.cell-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 60px;
}

.cell-status {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-status.bound {
    color: var(--success);
}

.cell-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cell-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== 预览区域 ===== */
.main-content {
    display: flex;
    flex-direction: column;
}

.preview-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.preview-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.preview-info span {
    color: var(--primary);
    font-weight: 600;
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    position: relative;
    min-height: 400px;
}

#previewCanvas {
    max-width: 100%;
    max-height: 600px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.canvas-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: block;
}

.canvas-placeholder.hidden {
    display: none !important;
}

.placeholder-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

.canvas-placeholder p {
    font-size: 0.875rem;
    margin: 0;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.canvas-wrapper canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* ===== 底部控制栏 ===== */
.bottom-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-xl);
}

.bottom-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    justify-content: center;
}

/* ===== 进度条 ===== */
.progress-container {
    flex: 1;
    max-width: 400px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    transition: width var(--transition-normal);
    width: 0%;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .tool-container {
        grid-template-columns: 280px 1fr 280px;
        gap: var(--spacing-lg);
    }
}

@media (max-width: 900px) {
    .tool-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar-left,
    .sidebar-right {
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
}

@media (max-width: 600px) {
    .header {
        padding: var(--spacing-md);
    }
    
    .header-title {
        font-size: 1rem;
    }
    
    .main-container {
        padding: var(--spacing-md);
    }
    
    .bottom-content {
        flex-direction: column;
    }
    
    .btn-start,
    .btn-stop {
        width: 100%;
    }
    
    .progress-container {
        width: 100%;
    }
}

/* bare 嵌入模式 */
.bare-mode .header {
    display: none !important;
}
.bare-mode main {
    padding-top: 1.5rem !important;
}
