        @import url('./md3-theme.css');
        
        @tailwind base;
        @tailwind components;
        @tailwind utilities;
        
        /* 載入動畫樣式 */
        .loading-screen {
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
            transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
        }
        
        .loading-screen.hidden {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }
        
        .loading-content {
            animation: fadeInUp 0.6s ease-out;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fade-in-up {
            animation: fadeInUp 0.6s ease-out forwards;
            opacity: 0;
        }
        
        .animate-fade-in {
            animation: fadeIn 1s ease-in-out infinite alternate;
        }
        
        /* 慢速脈衝動畫 */
        @keyframes pulseSlow {
            0%, 100% {
                opacity: 1;
            }
            50% {
                opacity: 0.8;
            }
        }
        
        .animate-pulse-slow {
            animation: pulseSlow 3s ease-in-out infinite;
        }
        
        /* 慢速 ping 動畫 */
        @keyframes pingSlow {
            0% {
                transform: scale(1);
                opacity: 1;
            }
            75%, 100% {
                transform: scale(1.5);
                opacity: 0;
            }
        }
        
        .animate-ping-slow {
            animation: pingSlow 2s cubic-bezier(0, 0, 0.2, 1) infinite;
        }
        
        /* 輕微彈跳動畫 */
        @keyframes bounceSubtle {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-4px);
            }
        }
        
        .animate-bounce-subtle {
            animation: bounceSubtle 3s ease-in-out infinite;
        }
        
        /* 繪製線條動畫 */
        @keyframes drawLine {
            0% {
                height: 0;
                opacity: 0;
            }
            100% {
                height: 3rem;
                opacity: 1;
            }
        }
        
        .animate-draw-line {
            animation: drawLine 0.8s ease-out forwards;
            animation-delay: 0.6s;
            height: 0;
            opacity: 0;
        }
        
        @keyframes fadeIn {
            from {
                opacity: 0.5;
            }
            to {
                opacity: 1;
            }
        }
        
        :root {
            --modal-transition-duration: 0.3s;
            /* 新 UI 顏色方案 */
            --sidebar-bg: #0f172a; /* 改為 slate-900，與頂部標題列一致 */
            --sidebar-hover: #334155;
            --sidebar-active: #37B34A; /* 統一綠色 */
            --main-bg: #f8fafc;
            --header-bg: #ffffff;
            --card-bg: #ffffff;
            --card-dark-bg: #1e293b;
        }
        
        /* 新佈局樣式 */
        .app-layout {
            font-family: 'Inter', 'Noto Sans TC', sans-serif;
            padding-top: 40px; /* 為固定標題列(40px)留出空間 */
        }
        
        /* 自定義標題列（視窗控制） */
        header.bg-slate-900 {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 60;
            background-color: #0f172a; /* slate-900 */
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            -webkit-app-region: drag;
        }
        
        /* 視窗控制按鈕 */
        .window-control-btn {
            -webkit-app-region: no-drag;
            cursor: pointer;
            user-select: none;
        }
        
        /* 自定義頂部導覽列 */
        nav.bg-slate-900 {
            position: fixed;
            top: 40px; /* 位於標題列下方 */
            left: 0;
            right: 0;
            z-index: 50;
            background-color: #0f172a; /* slate-900 */
            border-bottom: 1px solid #334155; /* slate-700 */
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 1rem;
        }
        
        nav.bg-slate-900 .nav-menu-btn {
            padding: 0.5rem 1rem;
            color: #cbd5e1; /* slate-300 */
            transition: all 0.2s ease;
            border-radius: 0.25rem;
            font-size: 0.875rem;
            background: transparent;
            border: none;
            cursor: pointer;
        }
        
        nav.bg-slate-900 .nav-menu-btn:hover {
            color: #ffffff;
            background-color: #1e293b; /* slate-800 */
        }
        
        /* 左側導航欄 */
        .sidebar {
            width: 280px;
            background-color: var(--sidebar-bg);
            color: #e2e8f0;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            flex-shrink: 0;
        }
        
        .sidebar-header {
            padding: 24px 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .sidebar-nav {
            flex: 1;
            padding: 16px 12px;
            overflow-y: auto;
        }
        
        .sidebar-section {
            margin-bottom: 24px;
        }
        
        .sidebar-section-title {
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: #94a3b8;
            padding: 8px 12px;
            margin-bottom: 4px;
        }
        
        .sidebar-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            margin: 2px 0;
            border-radius: 8px;
            color: #cbd5e1;
            text-decoration: none;
            transition: all 0.2s;
            cursor: pointer;
            position: relative;
        }
        
        .sidebar-item:hover {
            background-color: var(--sidebar-hover);
            color: #ffffff;
        }
        
        .sidebar-item.active {
            background-color: rgba(55, 179, 74, 0.15);
            color: var(--sidebar-active);
        }
        
        .sidebar-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 60%;
            background-color: var(--sidebar-active);
            border-radius: 0 2px 2px 0;
        }
        
        .sidebar-icon {
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        
        .sidebar-icon svg {
            width: 20px;
            height: 20px;
        }
        
        .sidebar-label {
            flex: 1;
            font-size: 14px;
            font-weight: 500;
        }
        
        .sidebar-label-en {
            font-size: 11px;
            color: #94a3b8;
            margin-left: 4px;
        }
        
        .sidebar-footer {
            padding: 16px 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        /* 主內容區 */
        .main-content-wrapper {
            background-color: #ffffff;
            display: flex;
            flex-direction: column;
        }
        
        .top-header {
            background-color: var(--header-bg);
            border-bottom: 1px solid #e2e8f0;
            padding: 16px 24px;
            display: flex;
            align-items: center;
            flex-shrink: 0;
        }
        
        .page-title {
            font-size: 20px;
            font-weight: 600;
            color: #1e293b;
        }
        
        .project-badge {
            background-color: #475569; /* slate-600 */
            color: white;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 500;
        }
        
        .header-icon-btn {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            border: none;
            background-color: transparent;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            transition: background-color 0.2s;
            position: relative;
        }
        
        .header-icon-btn:hover {
            background-color: #f1f5f9;
        }
        
        .notification-dot {
            position: absolute;
            top: 6px;
            right: 6px;
            width: 8px;
            height: 8px;
            background-color: #ef4444;
            border-radius: 50%;
            border: 2px solid white;
        }
        
        .page-content {
            background-color: #f5f5f5;
        }
        
        .page-content-inner {
            min-height: 100%;
        }
        
        /* 儀表板卡片樣式 */
        .emission-total-card {
            background-color: #0f172a !important;
            color: white;
            padding: 32px;
            border-radius: 16px;
            position: relative;
            overflow: hidden;
        }
        
        .emission-total-card::before {
            display: none;
        }
        
        .breakdown-card {
            background-color: var(--card-bg);
            padding: 24px;
            border-radius: 16px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
        
        .breakdown-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 0;
            border-bottom: 1px solid #e2e8f0;
        }
        
        .breakdown-item:last-child {
            border-bottom: none;
        }
        
        .breakdown-icon {
            font-size: 24px;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        
        .breakdown-icon svg {
            width: 24px;
            height: 24px;
        }
        
        .breakdown-info {
            flex: 1;
        }
        
        .breakdown-label {
            font-size: 14px;
            font-weight: 500;
            color: #1e293b;
            margin-bottom: 4px;
        }
        
        .breakdown-value {
            font-size: 12px;
            color: #64748b;
        }
        
        .breakdown-percentage {
            font-size: 16px;
            font-weight: 600;
            color: #1e293b;
            min-width: 50px;
            text-align: right;
        }
        
        .breakdown-progress {
            flex: 1;
            height: 8px;
            background-color: #e2e8f0;
            border-radius: 4px;
            overflow: hidden;
            margin: 0 12px;
        }
        
        .breakdown-progress-bar {
            height: 100%;
            background-color: var(--sidebar-active);
            border-radius: 4px;
            transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .breakdown-progress-bar.animate-progress-bar {
            width: 0% !important;
        }
        
        /* 類別卡片 */
        .category-card {
            background-color: var(--card-bg);
            padding: 24px;
            border-radius: 16px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            transition: transform 0.2s, box-shadow 0.2s;
            cursor: pointer;
        }
        
        .category-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }
        
        .category-card-icon {
            width: 64px;
            height: 64px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 32px;
            margin-bottom: 16px;
        }
        
        .category-card-name {
            font-size: 16px;
            font-weight: 600;
            color: #1e293b;
            margin-bottom: 8px;
        }
        
        .category-card-value {
            font-size: 24px;
            font-weight: 700;
            color: #1e293b;
            margin-bottom: 12px;
        }
        
        .category-card-details-btn {
            width: 100%;
            padding: 8px;
            background-color: #f1f5f9;
            border: none;
            border-radius: 8px;
            color: #64748b;
            font-size: 14px;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        
        .category-card-details-btn:hover {
            background-color: #e2e8f0;
        }
        
        /* 類別總計卡片 */
        .category-total-card {
            background: linear-gradient(135deg, var(--sidebar-active) 0%, #059669 100%);
            color: white;
            padding: 32px;
            border-radius: 16px;
            text-align: center;
        }
        
        .category-total-label {
            font-size: 14px;
            opacity: 0.9;
            margin-bottom: 8px;
        }
        
        .category-total-value {
            font-size: 48px;
            font-weight: 700;
            margin-bottom: 8px;
        }
        
        .category-total-unit {
            font-size: 18px;
            opacity: 0.8;
        }
        
        html {
            scroll-behavior: smooth;
        }
        
        /* 類別詳細頁面樣式 */
        .category-total-card-compact {
            background-color: transparent;
            padding: 0;
            border-radius: 0;
            box-shadow: none;
        }
        
        .category-total-card-standalone {
            background-color: #209D69;
            padding: 20px 24px;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
        
        .category-detail-container {
            height: calc(100vh - 80px);
            overflow-y: auto;
            overflow-x: hidden;
            background-color: #f5f5f5;
        }
        
        .category-detail-container .grid {
            height: auto;
            min-height: 100%;
        }
        
        #category-form-card {
            background-color: #ffffff;
            overflow-y: auto;
            max-height: calc(100vh - 200px);
        }
        
        #category-records-table {
            flex: 1;
            overflow-y: auto;
            max-height: calc(100vh - 300px);
        }
        
        /* 可調整大小的分割視窗 */
        .resizable-split-container {
            display: flex;
            height: 100%;
            position: relative;
        }
        
        .resizable-panel {
            overflow-y: auto;
            overflow-x: hidden;
        }
        
        .resizable-panel-left {
            flex: 0 0 50%;
            min-width: 300px;
            max-width: 80%;
        }
        
        .resizable-panel-right {
            flex: 1;
            min-width: 300px;
        }
        
        .resizer {
            width: 4px;
            background-color: #e2e8f0;
            cursor: col-resize;
            position: relative;
            flex-shrink: 0;
            transition: background-color 0.2s;
        }
        
        .resizer:hover {
            background-color: #37B34A;
        }
        
        .resizer::before {
            content: '';
            position: absolute;
            left: -2px;
            right: -2px;
            top: 0;
            bottom: 0;
            cursor: col-resize;
        }
        
        .resizer.dragging {
            background-color: #37B34A;
        }
        
        /* 防止桑基圖圖例被拖拽到視窗外 */
        #sankey-chart-container .echarts-legend {
            position: absolute !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            pointer-events: none !important;
        }
        
        #sankey-chart-container .echarts-legend-item {
            pointer-events: none !important;
        }
        
        /* 允許桑基圖節點拖拽，但限制在容器範圍內 */
        #sankey-chart-container .echarts-graph {
            pointer-events: auto !important;
        }
        
        #sankey-chart-container .echarts-graph-node {
            pointer-events: auto !important;
        }
        
        #sankey-chart-container .echarts-graph-edge {
            pointer-events: auto !important;
        }
        
        /* 確保 canvas 可以正常互動 */
        #sankey-chart-container canvas {
            pointer-events: auto !important;
        }
        
        /* 生命週期階段切換動畫 */
        .stage-content {
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            opacity: 1;
            transform: translateX(0);
        }
        
        .stage-content.fade-out {
            opacity: 0;
            transform: translateX(-20px);
        }
        
        .stage-content.fade-in {
            opacity: 0;
            transform: translateX(20px);
            animation: slideInFade 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        
        @keyframes slideInFade {
            from {
                opacity: 0;
                transform: translateX(20px);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }
        
        /* 階段標籤切換動畫 */
        .stage-tab {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
        }
        
        .stage-tab::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }
        
        .stage-tab:hover::before {
            left: 100%;
        }
        
        .stage-tab.active {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
        }
        
        /* 系統邊界圖工具箱樣式 */
        #diagram-toolbox img {
            cursor: grab;
            padding: 4px;
            border: 1px solid #e5e7eb;
            border-radius: 4px;
            transition: all 0.2s ease;
        }
        #diagram-toolbox img:hover {
            background-color: #f3f4f6;
            transform: scale(1.1);
        }
        #boundary-diagram-container .konvajs-content {
            border-radius: 0.5rem; /* 讓畫布有圓角 */
        }
        
        /* 全螢幕模態框樣式 */
        #fullscreenDiagramModal {
            z-index: 60 !important;
        }
        
        /* 新增元素模態框樣式 - 確保在全螢幕之上 */
        #addCustomElementModal {
            z-index: 70 !important;
        }
        
        #fullscreenDiagramModal .fixed {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            width: 100vw !important;
            height: 100vh !important;
        }
        
        #fullscreen-diagram-container {
            min-height: calc(100vh - 120px);
            overflow: auto; /* 確保有滾動軸 */
            position: relative;
        }
        
        #boundary-diagram-container {
            width: 100%;
            height: 100%;
            min-height: 400px;
            overflow: visible; /* 允許內容可見 */
            position: relative;
        }
        
        /* 確保全螢幕模態框正確顯示 */
        #fullscreenDiagramModal:not(.hidden) {
            display: flex !important;
        }
        
        /* 自定義元素樣式 */
        .custom-element-icon {
            position: relative;
        }
        
        .custom-element-icon .delete-btn {
            position: absolute;
            top: -5px;
            right: -5px;
            width: 16px;
            height: 16px;
            background: #ef4444;
            color: white;
            border: none;
            border-radius: 50%;
            font-size: 10px;
            cursor: pointer;
            display: none;
        }
        
        .custom-element-icon:hover .delete-btn {
            display: block;
        }
        
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes slideInUp {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes slideInRight {
            from { opacity: 0; transform: translateX(30px); }
            to { opacity: 1; transform: translateX(0); }
        }
        @keyframes slideInLeft {
            from { opacity: 0; transform: translateX(-30px); }
            to { opacity: 1; transform: translateX(0); }
        }
        @keyframes highlight {
            0% { background-color: #ecfdf5; } /* bg-emerald-50 */
            100% { background-color: transparent; }
        }
        /* #app 動畫已在 md3-theme.css 中定義 */
        
        /* 深色模式相容性 */
        body.dark-mode .bg-white {
            background: var(--md-sys-color-surface) !important;
        }
        body.dark-mode .text-gray-800,
        body.dark-mode .text-gray-700,
        body.dark-mode .text-gray-900 {
            color: var(--md-sys-color-on-surface) !important;
        }
        body.dark-mode .text-gray-500,
        body.dark-mode .text-gray-600 {
            color: var(--md-sys-color-on-surface) !important;
            opacity: 0.7;
        }
        body.dark-mode .border-gray-200,
        body.dark-mode .border-gray-300 {
            border-color: var(--md-sys-color-outline-variant) !important;
        }
        body.dark-mode .bg-gray-50,
        body.dark-mode .bg-gray-100 {
            background: var(--md-sys-color-surface-container-high) !important;
        }
        .category-card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .category-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.08);
        }
        /* Modal 樣式已在 md3-theme.css 中定義 */
        /* 按鈕樣式已在 md3-theme.css 中定義 */
        .new-record-row { 
            animation: slideInUp 0.5s ease-out forwards, highlight 2s ease-out forwards;
        }
        .action-icon {
            cursor: pointer; opacity: 0.5;
            transition: opacity 0.2s, color 0.2s;
        }
        .action-icon:hover { opacity: 1; }
        .inner-tab {
            cursor: pointer; padding: 0.5rem 1rem; border-bottom: 2px solid transparent; transition: all 0.3s ease;
        }
        .inner-tab.active {
            border-bottom-color: #3b82f6; color: #3b82f6; font-weight: 600;
        }
        /* Form Validation Styles */
        .input-error {
            border-color: #ef4444; /* red-500 */
        }
        .input-error:focus {
            border-color: #ef4444;
            --tw-ring-color: #ef4444;
        }
        .error-message {
            color: #ef4444; /* red-500 */
            font-size: 0.875rem; /* text-sm */
            margin-top: 0.25rem; /* mt-1 */
            display: none;
        }
        /* Tutorial Content Styling */
        .tutorial-content h3 { font-size: 1.25rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; padding-bottom: 0.25rem; border-bottom: 1px solid #e5e7eb; }
        .tutorial-content h4 { font-size: 1.125rem; font-weight: 600; margin-top: 1rem; margin-bottom: 0.5rem; }
        .tutorial-content p, .tutorial-content li { color: #4b5563; line-height: 1.75; }
        .tutorial-content p { margin-bottom: 1rem; }
        .tutorial-content ol, .tutorial-content ul { margin-left: 1.25rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
        .tutorial-content ol { list-style-type: decimal; }
        .tutorial-content ul { list-style-type: disc; }
        .tutorial-content code { background-color: #f3f4f6; color: #db2777; padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-family: monospace; font-size: 0.9em; }
        
        /* Accordion styles */
        .accordion-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s ease-out;
        }

        /* Toast 樣式已在 md3-theme.css 中定義 */
        
        /* Fullscreen Modal Styles */
        .fullscreen-toggle-btn {
            cursor: pointer;
            transition: color 0.2s ease-in-out;
        }
        .modal-content.modal-fullscreen {
            width: 95vw;
            max-width: 95vw;
            height: 95vh;
            max-height: 95vh;
        }
        
        /* Split View for Fullscreen */
        .split-view-container {
            display: flex;
            flex-direction: row;
            height: 100%;
            gap: 1.5rem;
        }
        .split-view-form {
            width: 40%;
            min-width: 400px;
            overflow-y: auto;
            padding-right: 1rem;
        }
        .split-view-table {
            width: 60%;
            overflow-y: auto;
        }
        .modal-fullscreen .modal-body {
            overflow: hidden; /* Let inner containers scroll */
        }
        th[data-sort-key].sorted {
            color: #2563eb; /* text-blue-600 */
            font-weight: 700;
        }
        
        /* 滑桿樣式 */
        .slider {
            -webkit-appearance: none;
            appearance: none;
            background: #e5e7eb;
            outline: none;
            border-radius: 0.5rem;
            /* 讓滑塊顏色可由 JS 控制 */
            --slider-thumb-color: #3b82f6;
        }
        
        .slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            background: var(--slider-thumb-color, #3b82f6);
            cursor: pointer;
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
        
        .slider::-moz-range-thumb {
            width: 20px;
            height: 20px;
            background: var(--slider-thumb-color, #3b82f6);
            cursor: pointer;
            border-radius: 50%;
            border: none;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
        
        .slider:hover::-webkit-slider-thumb {
            background: var(--slider-thumb-color, #2563eb);
            transform: scale(1.1);
        }
        
        .slider:hover::-moz-range-thumb {
            background: var(--slider-thumb-color, #2563eb);
            transform: scale(1.1);
        }
        
        /* 工具按鈕樣式 */
        .tool-btn.active {
            background: #dbeafe !important;
            border-color: #3b82f6 !important;
            color: #1e40af;
            font-weight: 600;
        }
        
        /* 連接線刪除按鈕 */
        .connector-delete-btn {
            position: absolute;
            width: 24px;
            height: 24px;
            background: #ef4444;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
            z-index: 999;
            font-size: 12px;
        }
        
        .connector-delete-btn:hover {
            background: #dc2626;
            transform: scale(1.1);
        }
        
/* ========================= */
/* Smart Paste 智慧貼上樣式 */
/* ========================= */

/* 智慧貼上表格樣式 - 模擬 Excel 風格 */
.smart-paste-table {
    border-collapse: collapse;
    font-size: 13px;
}

.smart-paste-table th,
.smart-paste-table td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
}

.smart-paste-table th {
    background-color: #f3f4f6;
    font-weight: 500;
}

.smart-paste-table tbody tr:hover {
    background-color: #eff6ff !important;
}

/* 欄位對應下拉選單 */
.smart-paste-mapping-select {
    font-size: 11px;
    padding: 4px 6px;
    min-width: 100px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.smart-paste-mapping-select:hover {
    border-color: #3b82f6;
}

.smart-paste-mapping-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* 已對應的欄位高亮 */
.smart-paste-table td.mapped {
    background-color: #dbeafe;
    border-left: 3px solid #3b82f6;
}

/* 智慧貼上模態框調整 */
#smartPasteModal .modal-content {
    display: flex;
    flex-direction: column;
}

#smartPaste-tableContainer {
    scrollbar-width: thin;
    scrollbar-color: #c3c7cf transparent;
}

#smartPaste-tableContainer::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#smartPaste-tableContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#smartPaste-tableContainer::-webkit-scrollbar-thumb {
    background: #c3c7cf;
    border-radius: 4px;
}

#smartPaste-tableContainer::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 空值顯示 */
.smart-paste-table td .text-gray-300 {
    color: #d1d5db;
    font-style: italic;
}

/* 智慧貼上工具列按鈕動畫 */
#smartPasteToolbarBtn {
    animation: pulse-glow 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

#smartPasteToolbarBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 3s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0);
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 智慧貼上快速按鈕（在類別模態框中） */
#smartPaste-quickBtn {
    margin-left: auto;
    animation: none;
}

#smartPaste-quickBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ========================= */
/* Material Design 3 Components */
/* ========================= */

/* Navigation Rail */
.navigation-rail {
    position: relative;
    height: 100vh;
    background-color: var(--md-sys-color-surface);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
}

.navigation-rail.collapsed {
    width: 80px;
}

.navigation-rail.expanded {
    width: 200px;
    align-items: flex-start;
    padding: 16px 12px;
}

.navigation-rail-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: var(--md-sys-shape-corner-full);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    gap: 12px;
    min-height: 48px;
}

.navigation-rail.collapsed .navigation-rail-item {
    justify-content: center;
    padding: 12px;
    width: 48px;
    margin: 4px auto;
}

.navigation-rail-item:hover {
    background-color: var(--md-sys-color-surface-container-high);
}

.navigation-rail-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.navigation-rail-item-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.navigation-rail-item-label {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.3s, width 0.3s;
}

.navigation-rail.expanded .navigation-rail-item-label {
    opacity: 1;
    width: auto;
}

/* Navigation Rail Groups */
.navigation-rail-group {
    width: 100%;
    margin-bottom: 8px;
}

.navigation-rail-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 4px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--md-sys-color-on-surface-variant);
    gap: 12px;
    min-height: 48px;
    border-radius: var(--md-sys-shape-corner-medium);
}

.navigation-rail.collapsed .navigation-rail-group-header {
    justify-content: center;
    padding: 12px;
}

.navigation-rail-group-header:hover {
    background-color: var(--md-sys-color-surface-container-high);
}

.navigation-rail-group-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.navigation-rail-group-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.3s, width 0.3s;
}

.navigation-rail.expanded .navigation-rail-group-label {
    opacity: 1;
    width: auto;
}

.navigation-rail-group-arrow {
    font-size: 12px;
    margin-left: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.navigation-rail.expanded .navigation-rail-group-arrow {
    opacity: 1;
    width: auto;
}

.navigation-rail.collapsed .navigation-rail-group-arrow {
    display: none;
}

.navigation-rail-group-items {
    display: none;
    flex-direction: column;
    padding-left: 12px;
    margin-top: 4px;
}

.navigation-rail-group.expanded .navigation-rail-group-items {
    display: flex;
}

.navigation-rail-sub-item {
    padding-left: 40px !important;
    font-size: 14px;
}

.navigation-rail.collapsed .navigation-rail-group-items {
    display: none !important;
}

/* Surface Container */
.surface-container {
    background-color: var(--md-sys-color-surface-container-low);
    min-height: 100vh;
    padding: 0;
    margin-left: 80px;
    flex: 1;
    overflow-y: auto;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navigation-rail.expanded ~ .surface-container,
.surface-container.has-expanded-rail {
    margin-left: 200px;
}

/* Top App Bar */
.top-app-bar {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    padding: 16px 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.top-app-bar h1 {
    font-size: 24px;
    font-weight: 400;
    line-height: 32px;
    margin: 0;
    color: var(--md-sys-color-on-surface);
}

/* Elevated Card */
.elevated-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-extra-large);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    padding: 24px;
    margin: 24px;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.elevated-card:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

/* Side Sheet */
.side-sheet {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 360px;
    background-color: var(--md-sys-color-surface);
    border-left: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.side-sheet.visible {
    transform: translateX(0);
}

.side-sheet-header {
    padding: 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.side-sheet-header h2 {
    font-size: 24px;
    font-weight: 400;
    line-height: 32px;
    margin: 0;
    color: var(--md-sys-color-on-surface);
}

.side-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* M3 List Items */
.m3-list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-medium);
    cursor: pointer;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--md-sys-color-on-surface);
    gap: 16px;
    min-height: 56px;
}

.m3-list-item:hover {
    background-color: var(--md-sys-color-surface-container-high);
}

.m3-list-item-primary {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.m3-list-item-title {
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    color: var(--md-sys-color-on-surface);
}

.m3-list-item-subtitle {
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Extended FAB */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    height: 56px;
    padding: 0 24px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1002;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab:hover {
    box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.fab:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.fab.extended {
    min-width: 80px;
    padding: 0 24px;
}

.fab-icon {
    font-size: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Three Pane Layout Container */
.three-pane-layout {
    display: flex;
    width: 100vw;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background-color: var(--md-sys-color-surface-container-low);
}

.three-pane-layout.hidden {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navigation-rail {
        width: 80px !important;
    }
    
    .navigation-rail.expanded {
        width: 80px !important;
    }
    
    .surface-container {
        margin-left: 80px !important;
    }
    
    .side-sheet {
        width: 100%;
        max-width: 360px;
    }
    
    .fab {
        bottom: 16px;
        right: 16px;
    }
}

/* ========================= */
/* Material Design 3 Typography Scale */
/* ========================= */

/* Display Styles */
.display-large {
    font-size: 57px;
    line-height: 64px;
    font-weight: 400;
    letter-spacing: -0.25px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.display-medium {
    font-size: 45px;
    line-height: 52px;
    font-weight: 400;
    letter-spacing: 0;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.display-small {
    font-size: 36px;
    line-height: 44px;
    font-weight: 400;
    letter-spacing: 0;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

/* Headline Styles */
.headline-large {
    font-size: 32px;
    line-height: 40px;
    font-weight: 400;
    letter-spacing: 0;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.headline-medium {
    font-size: 28px;
    line-height: 36px;
    font-weight: 400;
    letter-spacing: 0;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.headline-small {
    font-size: 24px;
    line-height: 32px;
    font-weight: 400;
    letter-spacing: 0;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

/* Title Styles */
.title-large {
    font-size: 22px;
    line-height: 28px;
    font-weight: 400;
    letter-spacing: 0;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

/* Transport Input Card Map Styles */
#transport-map {
    z-index: 0;
    width: 100% !important;
    height: 100% !important;
    min-height: 300px !important;
    position: relative;
}

#transport-map-container {
    position: relative;
    z-index: 0;
    width: 100%;
    height: 300px !important;
    min-height: 300px !important;
    isolation: isolate;
}

#transport-map-container .leaflet-container {
    border-radius: 16px;
    z-index: 0;
    width: 100% !important;
    height: 100% !important;
    min-height: 300px !important;
    border: none !important;
    outline: none !important;
    position: relative;
    background-color: #e2e8f0;
}

#transport-map-container .leaflet-control-container {
    z-index: 1000;
    position: relative;
}

#transport-map-container .leaflet-pane {
    z-index: 400;
}

#transport-map-container .leaflet-tile-container {
    width: 100% !important;
    height: 100% !important;
}

#transport-map-container .leaflet-tile-pane {
    width: 100% !important;
    height: 100% !important;
}

#transport-map-container .leaflet-map-pane {
    width: 100% !important;
    height: 100% !important;
}

#transport-map-container .leaflet-overlay-pane {
    width: 100% !important;
    height: 100% !important;
}

/* 確保地圖瓦片正確顯示 */
#transport-map-container .leaflet-tile {
    visibility: visible !important;
    opacity: 1 !important;
}

.custom-marker-start,
.custom-marker-end {
    background: transparent !important;
    border: none !important;
}

/* 輸入框樣式修復 */
#transport-start,
#transport-end {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

#transport-start:focus,
#transport-end:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    ring: none !important;
}

/* 地址建議列表樣式 */
#transport-start-suggestions,
#transport-end-suggestions {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

#transport-start-suggestions::-webkit-scrollbar,
#transport-end-suggestions::-webkit-scrollbar {
    width: 6px;
}

#transport-start-suggestions::-webkit-scrollbar-track,
#transport-end-suggestions::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#transport-start-suggestions::-webkit-scrollbar-thumb,
#transport-end-suggestions::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#transport-start-suggestions::-webkit-scrollbar-thumb:hover,
#transport-end-suggestions::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.suggestion-item {
    transition: background-color 0.15s ease;
}

.suggestion-item:hover {
    background-color: #f8fafc !important;
}

.title-medium {
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    letter-spacing: 0.15px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.title-small {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0.1px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

/* Label Styles */
.label-large {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0.1px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.label-medium {
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.label-small {
    font-size: 11px;
    line-height: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

/* Body Styles */
.body-large {
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    letter-spacing: 0.5px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.body-medium {
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    letter-spacing: 0.25px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.body-small {
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    letter-spacing: 0.4px;
    font-family: 'Roboto', 'Inter', 'Noto Sans TC', sans-serif;
    color: var(--md-sys-color-on-surface);
}

/* ========================= */
/* Dashboard 動畫效果 */
/* ========================= */

/* 淡入動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

/* 下滑動畫 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-down {
    animation: slideDown 0.5s ease-out forwards;
    opacity: 0;
}

/* 上滑動畫 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

/* 數字出現動畫 */
@keyframes numberIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-number-in {
    animation: numberIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

/* 卡片淡入上滑 */
@keyframes cardFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-card-in {
    animation: cardFadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 側滑進入 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in {
    animation: slideIn 0.4s ease-out forwards;
    opacity: 0;
}

/* 圖標旋轉動畫 */
@keyframes iconSpin {
    from {
        transform: rotate(0deg) scale(0.8);
        opacity: 0;
    }
    to {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

.animate-icon-spin {
    animation: iconSpin 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 圖標彈跳動畫 */
@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.1);
    }
}

.animate-icon-bounce {
    animation: iconBounce 0.6s ease-out forwards;
}

/* 脈衝圖標動畫 */
@keyframes pulseIcon {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.animate-pulse-icon {
    animation: pulseIcon 2s ease-in-out infinite;
}

/* 彈跳圖標動畫 */
@keyframes bounceIcon {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.animate-bounce-icon {
    animation: bounceIcon 1.5s ease-in-out infinite;
}

/* 卡片發光動畫 */
@keyframes cardGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(55, 179, 74, 0.1);
    }
    50% {
        box-shadow: 0 4px 30px rgba(55, 179, 74, 0.2);
    }
}

/* 按鈕 Ripple 效果 */
.dashboard-action-btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-anim 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* 進度條動畫 */
.animate-progress-bar {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================= */
/* 新增紀錄選擇區塊樣式 */
/* ========================= */

.add-record-block {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.add-record-stage-block {
    margin-bottom: 16px;
}

.add-record-item-block {
    margin-top: 0;
}

.add-record-stage-btn,
.add-record-item-btn,
.add-record-category-btn {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 120px;
}

.add-record-stage-btn:hover,
.add-record-item-btn:hover,
.add-record-category-btn:hover {
    border-color: #37B34A;
    background: #f0fdf4;
    color: #37B34A;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(55, 179, 74, 0.2);
}

/* ========================= */
/* 材料選擇卡片式設計樣式 */
/* ========================= */

.materials-selection-container {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.material-category-btn,
.material-stage-btn {
    transition: all 0.2s ease;
}

/* 未選中狀態的 hover 效果 */
.material-category-btn:hover:not(.material-category-selected),
.material-stage-btn:hover:not(.material-stage-selected) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(55, 179, 74, 0.3);
    border-color: #37B34A;
    background-color: #f0fdf4;
}

/* 選中狀態的按鈕 - 增強視覺效果 */
.material-category-btn.material-category-selected,
.material-stage-btn.material-stage-selected {
    background-color: #37B34A !important;
    color: white !important;
    border-color: #37B34A !important;
    border-width: 3px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(55, 179, 74, 0.3), 0 0 0 2px rgba(55, 179, 74, 0.1) !important;
    transform: scale(1.05);
}

/* 選中狀態時圖標變為白色 */
.material-stage-btn.material-stage-selected svg {
    color: white !important;
    stroke: white !important;
}

.material-category-btn.material-category-selected:hover,
.material-stage-btn.material-stage-selected:hover {
    background-color: #37B34A !important;
    color: white !important;
    border-color: #37B34A !important;
    border-width: 3px !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(55, 179, 74, 0.4), 0 0 0 3px rgba(55, 179, 74, 0.15) !important;
}

.material-item-card {
    transition: all 0.2s ease;
}

/* 未選中狀態的 hover 效果 */
.material-item-card:hover:not(.material-item-selected) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(55, 179, 74, 0.2);
    border-color: #37B34A;
    background: #f0fdf4;
}

/* 選中狀態的卡片 - 增強視覺效果 */
.material-item-card.material-item-selected {
    border-color: #37B34A !important;
    border-width: 3px !important;
    background: #f0fdf4 !important;
    box-shadow: 0 4px 12px rgba(55, 179, 74, 0.25), 0 0 0 2px rgba(55, 179, 74, 0.1) !important;
    animation: materialSelectedPulse 2s ease-in-out infinite;
}

.material-item-card.material-item-selected:hover {
    border-color: #37B34A !important;
    border-width: 3px !important;
    background: #f0fdf4 !important;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(55, 179, 74, 0.35), 0 0 0 3px rgba(55, 179, 74, 0.15) !important;
}

/* 選中狀態時隱藏新增按鈕 */
.material-item-card.material-item-selected .material-add-btn {
    display: none !important;
}

/* 選中標記動畫 */
.material-selected-badge {
    animation: badgeBounce 0.5s ease-out;
}

@keyframes materialSelectedPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(55, 179, 74, 0.25), 0 0 0 2px rgba(55, 179, 74, 0.1);
    }
    50% {
        box-shadow: 0 4px 16px rgba(55, 179, 74, 0.35), 0 0 0 3px rgba(55, 179, 74, 0.15);
    }
}

@keyframes badgeBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.material-add-btn {
    transition: all 0.2s ease;
}

.material-add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(55, 179, 74, 0.3);
}

.add-record-stage-btn.active,
.add-record-item-btn.active,
.add-record-category-btn.active {
    border-color: #37B34A;
    background: #37B34A;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(55, 179, 74, 0.4);
    transform: translateY(-2px);
}

.materials-selection {
    width: 100%;
}

.materials-selection .add-record-category-btn {
    padding: 10px 16px;
    font-size: 13px;
    min-width: 100px;
}

#materials-items-container {
    min-height: 40px;
    margin-top: 12px;
}

#materials-items-container .add-record-item-btn {
    margin-bottom: 8px;
}

