/** * Components Styles - 元件樣式 * 包含按鈕、表單、卡片、頁籤、彈窗、Toast 等可重用元件 */ /* ==================== Tabs ==================== */ .tabs { display: flex; background: #f8fafc; border-bottom: 2px solid var(--border); } .tab-btn { padding: 16px 32px; border: none; background: transparent; font-family: inherit; font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; position: relative; transition: all 0.3s ease; } .tab-btn:hover { color: var(--primary); background: rgba(26, 82, 118, 0.05); } .tab-btn.active { color: var(--primary); background: var(--bg-card); } .tab-btn.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 3px; background: var(--primary); border-radius: 2px 2px 0 0; } .tab-content { display: none; padding: 28px; animation: fadeIn 0.3s ease; } .tab-content.active { display: block; } /* ==================== Form Elements ==================== */ .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; } .form-grid.three-cols { grid-template-columns: repeat(3, 1fr); } .form-group { display: flex; flex-direction: column; gap: 6px; } .form-group.full-width { grid-column: 1 / -1; } .form-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; } .form-group label .required { color: var(--danger); font-weight: 600; } .input-wrapper { display: flex; gap: 8px; align-items: center; } input[type="text"], input[type="number"], input[type="date"], select, textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 0.9rem; color: var(--text-primary); background: #fafbfc; transition: all 0.2s ease; } input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-light); background: #ffffff; box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1); } input:read-only { background: #f0f3f5; color: var(--text-secondary); cursor: default; } textarea { min-height: 100px; resize: vertical; } select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235d6d7e' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; } /* ==================== Buttons ==================== */ .btn { padding: 10px 20px; border: none; border-radius: 8px; font-family: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s ease; white-space: nowrap; text-decoration: none; line-height: 1.4; } .btn:active { transform: scale(0.98); } .btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; box-shadow: 0 2px 8px rgba(26, 82, 118, 0.3); } .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(26, 82, 118, 0.4); filter: brightness(1.05); } .btn-secondary { background: white; color: var(--primary); border: 1.5px solid var(--primary); } .btn-secondary:hover { background: var(--primary); color: white; transform: translateY(-1px); } .btn-success { background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%); color: white; box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3); } .btn-success:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(39, 174, 96, 0.4); filter: brightness(1.05); } .btn-warning { background: linear-gradient(135deg, #f39c12 0%, #d68910 100%); color: white; box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3); } .btn-warning:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(243, 156, 18, 0.4); filter: brightness(1.05); } .btn-danger { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); color: white; box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3); } .btn-danger:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(231, 76, 60, 0.4); filter: brightness(1.05); } .btn-cancel { background: #f0f3f5; color: var(--text-secondary); border: 1px solid var(--border); } .btn-cancel:hover { background: #e5e9ec; color: var(--text-primary); border-color: #d0d5da; } /* 特殊漸層按鈕 - 儲存至崗位清單 */ .btn-gradient-purple { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); } .btn-gradient-purple:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4); filter: brightness(1.05); } .btn svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; } /* 小尺寸按鈕 */ .btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; } .btn-sm svg { width: 14px; height: 14px; } /* 大尺寸按鈕 */ .btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 10px; } .btn-lg svg { width: 20px; height: 20px; } .btn-lookup { padding: 10px 16px; border: 1.5px solid var(--border); border-radius: 8px; background: #f8fafc; color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; white-space: nowrap; } .btn-lookup:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-1px); } .btn-icon { width: 38px; height: 38px; padding: 0; border: 1.5px solid var(--border); border-radius: 8px; background: #f8fafc; color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s ease; } .btn-icon:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-1px); } .btn-icon svg { width: 18px; height: 18px; fill: currentColor; } .nav-buttons { display: flex; gap: 8px; } .nav-btn { width: 36px; height: 36px; border: 1.5px solid var(--border); border-radius: 6px; background: white; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; } .nav-btn:hover { border-color: var(--primary); color: var(--primary); } .nav-btn svg { width: 16px; height: 16px; fill: currentColor; } /* ==================== AI Helper (AI 幫我想) ==================== */ .ai-helper-container { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; padding: 16px; background: linear-gradient(135deg, rgba(155, 89, 182, 0.08) 0%, rgba(142, 68, 173, 0.05) 100%); border: 1px solid rgba(155, 89, 182, 0.2); border-radius: var(--radius); } .ai-helper-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px 24px; background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); color: white; border: none; border-radius: 8px; font-family: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3); transition: all 0.3s ease; } .ai-helper-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4); } .ai-helper-btn:active { transform: translateY(-1px); } .ai-helper-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; } .ai-helper-btn svg { flex-shrink: 0; } /* Prompt Editor */ .ai-prompt-editor { display: flex; flex-direction: column; gap: 8px; } .prompt-header { display: flex; align-items: center; justify-content: space-between; } .prompt-label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); } .prompt-reset-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; background: rgba(155, 89, 182, 0.1); border: 1px solid rgba(155, 89, 182, 0.2); border-radius: 6px; color: #8e44ad; cursor: pointer; transition: all 0.2s ease; } .prompt-reset-btn:hover { background: rgba(155, 89, 182, 0.2); border-color: rgba(155, 89, 182, 0.3); } .prompt-textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 6px; font-family: 'Monaco', 'Consolas', monospace; font-size: 0.85rem; line-height: 1.5; resize: vertical; background: white; color: var(--text-primary); transition: border-color 0.2s ease, box-shadow 0.2s ease; } .prompt-textarea:focus { outline: none; border-color: #9b59b6; box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15); } .prompt-textarea::placeholder { color: var(--text-secondary); opacity: 0.6; } /* AI Helper Loading State */ .ai-helper-container.loading .ai-helper-btn { pointer-events: none; } .ai-helper-container.loading .ai-helper-btn::after { content: ''; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 8px; } /* Legacy: Keep old styles for backward compatibility */ .ai-bags-container { display: none; /* Hidden - replaced by ai-helper-container */ } /* ==================== Old AI Button (Deprecated) ==================== */ .ai-generate-btn { display: flex; align-items: center; gap: 8px; padding: 12px 24px; margin-bottom: 24px; background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); color: white; border: none; border-radius: var(--radius); font-family: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3); transition: all 0.3s ease; } .ai-generate-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4); } .ai-generate-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; } .ai-generate-btn svg { width: 20px; height: 20px; fill: currentColor; } .ai-generate-btn .spinner { width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; } /* ==================== Form Actions ==================== */ .form-actions { display: flex; justify-content: space-between; align-items: center; padding: 20px 28px; background: #f8fafc; border-top: 1px solid var(--border); } .action-buttons { display: flex; gap: 12px; } /* ==================== Toggle Switch ==================== */ .toggle-group { display: flex; align-items: center; gap: 12px; } .toggle-switch { position: relative; width: 52px; height: 28px; } .toggle-switch input { opacity: 0; width: 0; height: 0; } .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: 0.3s; border-radius: 28px; } .toggle-slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: white; transition: 0.3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); } .toggle-switch input:checked + .toggle-slider { background-color: var(--success); } .toggle-switch input:checked + .toggle-slider:before { transform: translateX(24px); } .toggle-label { font-size: 0.9rem; color: var(--text-secondary); } /* ==================== Toast Notification ==================== */ .toast { position: fixed; top: 24px; right: 24px; padding: 16px 24px; background: var(--success); color: white; border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); display: flex; align-items: center; gap: 12px; transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); z-index: 1000; } .toast.show { transform: translateX(0); } .toast svg { width: 24px; height: 24px; fill: currentColor; } /* ==================== Modal ==================== */ .modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: none; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(4px); } .modal-overlay.show { display: flex; } .modal { background: white; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); width: 90%; max-width: 500px; animation: modalIn 0.3s ease; } .modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; } .modal-header h3 { font-size: 1.1rem; font-weight: 600; } .modal-close { width: 32px; height: 32px; border: none; background: #f0f3f5; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; } .modal-close:hover { background: var(--danger); color: white; } .modal-body { padding: 24px; } .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; } /* ==================== Checkbox Group ==================== */ .checkbox-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; } .checkbox-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 6px; cursor: pointer; transition: all 0.2s ease; } .checkbox-item:hover { border-color: var(--primary-light); background: rgba(41, 128, 185, 0.05); } .checkbox-item input { width: 18px; height: 18px; accent-color: var(--primary); } .checkbox-item label { cursor: pointer; font-size: 0.9rem; } /* ==================== Special Fields ==================== */ .confidential-field { position: relative; } .confidential-field input { padding-left: 32px; } .confidential-field::before { content: '🔒'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; } .numbered-textarea { font-family: inherit; line-height: 1.8; } /* ==================== Data Preview ==================== */ .data-preview { margin-top: 24px; padding: 20px; background: #f8fafc; border-radius: var(--radius); border: 1px solid var(--border); } .data-preview h4 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 12px; } .data-preview pre { font-family: 'Monaco', 'Consolas', monospace; font-size: 0.8rem; background: #2c3e50; color: #ecf0f1; padding: 16px; border-radius: 6px; overflow-x: auto; max-height: 300px; } /* ==================== Responsive Design for Components ==================== */ /* Large Tablets (1024px) */ @media (max-width: 1024px) { .form-grid { gap: 16px 24px; } .form-grid.three-cols { grid-template-columns: repeat(2, 1fr); } .tab-btn { padding: 14px 24px; font-size: 0.9rem; } .ai-bags-container { gap: 6px; } } /* Tablets (768px) */ @media (max-width: 768px) { /* Tabs */ .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; } .tab-btn { padding: 12px 16px; font-size: 0.85rem; white-space: nowrap; } .tab-content { padding: 20px 16px; } /* Form Grid */ .form-grid, .form-grid.three-cols { grid-template-columns: 1fr; gap: 16px; } /* Form Actions */ .form-actions { flex-direction: column; gap: 16px; padding: 16px; } .action-buttons { width: 100%; flex-wrap: wrap; justify-content: center; } .action-buttons .btn { flex: 1; min-width: calc(50% - 6px); justify-content: center; } /* Buttons */ .btn { padding: 10px 16px; font-size: 0.85rem; } .btn svg { width: 16px; height: 16px; } .nav-buttons { gap: 6px; } .nav-btn { width: 32px; height: 32px; } /* AI Bags */ .ai-bags-container { grid-template-columns: repeat(3, 1fr); gap: 4px; } .ai-bag { padding: 6px 8px; } .ai-bag .bag-title { font-size: 0.7rem; } .ai-bag .bag-subtitle { font-size: 0.6rem; } .ai-bag .bag-icon { font-size: 0.9rem; } /* Toggle */ .toggle-group { flex-wrap: wrap; } .toggle-switch { width: 46px; height: 24px; } .toggle-slider:before { height: 18px; width: 18px; } .toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); } /* Checkbox */ .checkbox-group { grid-template-columns: 1fr; } /* Modal */ .modal { width: 95%; max-width: none; margin: 16px; } .modal-header { padding: 16px; } .modal-header h3 { font-size: 1rem; } .modal-body { padding: 16px; } .modal-footer { padding: 12px 16px; flex-wrap: wrap; } .modal-footer .btn { flex: 1; min-width: calc(50% - 6px); } /* Toast */ .toast { top: 12px; right: 12px; left: 12px; padding: 12px 16px; font-size: 0.9rem; } .toast svg { width: 20px; height: 20px; } /* Data Preview */ .data-preview { padding: 16px; margin-top: 16px; } .data-preview pre { padding: 12px; font-size: 0.75rem; max-height: 200px; } } /* Mobile Phones (480px) */ @media (max-width: 480px) { /* Tabs */ .tab-btn { padding: 10px 12px; font-size: 0.8rem; } .tab-content { padding: 16px 12px; } /* Form */ .form-group label { font-size: 0.8rem; } input[type="text"], input[type="number"], input[type="date"], select, textarea { padding: 8px 12px; font-size: 0.85rem; } .input-wrapper { flex-direction: column; align-items: stretch; } .btn-lookup { padding: 8px 12px; font-size: 0.8rem; } /* Form Actions */ .form-actions { padding: 12px; } .action-buttons { flex-direction: column; } .action-buttons .btn { width: 100%; min-width: 100%; } /* Buttons */ .btn { padding: 10px 14px; font-size: 0.8rem; gap: 6px; } .btn-icon { width: 34px; height: 34px; } /* AI Bags */ .ai-bags-container { grid-template-columns: 1fr 1fr 1fr; gap: 4px; } .ai-bag { padding: 6px 4px; } .ai-bag .bag-icon { font-size: 0.85rem; } .ai-bag .bag-title { font-size: 0.65rem; } .ai-bag .bag-subtitle { display: none; } .ai-bag .bag-edit-btn { padding: 1px 3px; font-size: 0.6rem; } /* AI Generate Button */ .ai-generate-btn { padding: 10px 16px; font-size: 0.85rem; } /* Toggle */ .toggle-label { font-size: 0.8rem; } /* Checkbox */ .checkbox-item { padding: 8px 10px; } .checkbox-item input { width: 16px; height: 16px; } .checkbox-item label { font-size: 0.85rem; } /* Modal */ .modal { margin: 8px; width: calc(100% - 16px); } .modal-header { padding: 12px; } .modal-header h3 { font-size: 0.95rem; } .modal-close { width: 28px; height: 28px; } .modal-body { padding: 12px; } .modal-footer { padding: 10px 12px; gap: 8px; } .modal-footer .btn { padding: 8px 12px; font-size: 0.8rem; } /* Toast */ .toast { top: 8px; right: 8px; left: 8px; padding: 10px 14px; font-size: 0.85rem; gap: 8px; } .toast svg { width: 18px; height: 18px; } /* Data Preview */ .data-preview { padding: 12px; } .data-preview h4 { font-size: 0.85rem; } .data-preview pre { padding: 10px; font-size: 0.7rem; max-height: 150px; } }