/* 繼承自 Home 的基礎變數 */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --bg-dark: #09090b;
    
    --glass-bg: rgba(20, 20, 25, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 20px;
    
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus: rgba(59, 130, 246, 0.5);
}

/* === 佈局 === */
.lab-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 20px;
    padding-bottom: 40px;
    max-width: 1100px;
}

@media (min-width: 900px) {
    .lab-container {
        grid-template-columns: 1.2fr 0.8fr; /* 左寬右窄 */
        align-items: start;
    }
    /* 讓預覽區在桌面版固定住 (Sticky) */
    .preview-panel {
        position: sticky;
        top: 100px;
    }
}

/* === 左側配置面板 === */
.config-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
}

.panel-header { margin-bottom: 24px; border-bottom: 1px solid var(--glass-border); padding-bottom: 16px; }
.panel-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.panel-header p { color: var(--text-muted); font-size: 0.9rem; }

/* === 輸入元件樣式 === */
.input-group { margin-bottom: 20px; }
.input-label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.mt-4 { margin-top: 16px; }

/* 通用輸入框 */
.modern-input, .modern-textarea, .modern-select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: 0.2s;
    outline: none;
}

.modern-input:focus, .modern-textarea:focus, .modern-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: rgba(0, 0, 0, 0.5);
}

/* 下拉選單優化 */
.select-wrapper { position: relative; }
.modern-select { appearance: none; cursor: pointer; padding-right: 40px; }
.arrow-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted); }
.modern-select option { background: #1f1f22; color: white; }

/* Grid Helper */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* === 選項設定區 === */
.options-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 32px 0 20px; color: var(--primary); font-weight: 600; font-size: 0.9rem;
}
.options-divider::after { content: ''; flex: 1; height: 1px; background: var(--glass-border); }

.options-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.option-item.full-width { grid-column: span 2; }

/* Color Picker 美化 */
.color-picker-wrapper {
    width: 100%; height: 44px; border-radius: 12px; overflow: hidden;
    border: 1px solid var(--input-border); position: relative;
}
input[type="color"] {
    width: 150%; height: 150%; transform: translate(-25%, -25%);
    border: none; background: none; cursor: pointer; padding: 0;
}

/* Range Slider 美化 */
.modern-range {
    -webkit-appearance: none; width: 100%; background: transparent; margin-top: 8px;
}
.modern-range::-webkit-slider-runnable-track {
    width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px;
}
.modern-range::-webkit-slider-thumb {
    -webkit-appearance: none; height: 20px; width: 20px; border-radius: 50%;
    background: var(--primary); cursor: pointer; margin-top: -7px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3); transition: transform 0.1s;
}
.modern-range::-webkit-slider-thumb:hover { transform: scale(1.1); }
.flex-between { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-muted); }

/* Segmented Control (Radio Group) */
.segmented-control {
    display: flex; background: var(--input-bg); padding: 4px; border-radius: 12px;
}
.segmented-control input { display: none; }
.segmented-control label {
    flex: 1; text-align: center; padding: 8px; border-radius: 8px;
    cursor: pointer; font-size: 0.9rem; color: var(--text-muted); transition: 0.2s;
}
.segmented-control input:checked + label {
    background: var(--primary); color: white; font-weight: 600;
}

/* === 按鈕 === */
.btn-generate {
    width: 100%; margin-top: 32px; padding: 16px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border: none; border-radius: 14px; color: white; font-size: 1.1rem; font-weight: 600;
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4); }
.btn-generate:active { transform: translateY(0); }

/* === 右側預覽區 === */
.preview-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    text-align: center;
}

.preview-header {
    font-weight: 600; color: var(--text-muted); margin-bottom: 24px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

.qr-stage {
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    min-height: 320px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 24px;
    position: relative;
    border: 2px dashed rgba(255,255,255,0.05);
}

.qr-frame {
    padding: 20px; background: white; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: none; /* 預設隱藏 */
}

.qr-frame.show { display: block; animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

.qr-placeholder { color: rgba(255,255,255,0.2); display: flex; flex-direction: column; align-items: center; }
.qr-placeholder i { font-size: 4rem; margin-bottom: 8px; }

.btn-download {
    width: 100%; padding: 12px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; color: white; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s;
}
.btn-download:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }
.btn-download:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Navbar & Footer (簡化版繼承) */
.nav-center { font-weight: 700; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.footer-simple { text-align: center; padding: 40px 0; color: var(--text-muted); font-size: 0.85rem; }