/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "微軟正黑體", sans-serif;
    background: #f5f7fa;
    color: #495057;
    font-size: 14px;
    line-height: 1.6;
}

/* 頂部導航列 */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.brand {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.logout-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 主選單列 */
.main-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    height: 50px;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 8px;
    z-index: 999;
    overflow-x: auto;
}

.menu-item {
    padding: 8px 16px;
    color: #5a6c7d;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.menu-item:hover {
    background: #f0f2f5;
    color: #3498db;
}

.menu-item.active {
    background: #e8f4fd;
    color: #3498db;
}

/* 內容區域 */
.content {
    padding-top: 110px;
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 40px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

/* 頁面標題區 */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: #7f8c8d;
}

/* 統計卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #FFFFFF;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #3498db;
    cursor: pointer;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
}

.stat-sublabel {
    font-size: 13px;
    color: #95a5a6;
    margin-top: 4px;
}

/* 區塊容器 */
.section {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.section-header {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 篩選列 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item label {
    font-size: 13px;
    color: #495057;
    font-weight: 500;
}

.filter-item input,
.filter-item select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

.filter-item input:focus,
.filter-item select:focus {
    outline: none;
    border-color: #3498db;
}

/* 狀態分段 */
.status-chips {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.chip {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e9ecef;
    background: #f8f9fa;
    color: #495057;
}

.chip.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.chip:hover {
    background: #e8f4fd;
    border-color: #3498db;
}

/* 按鈕樣式 */
.btn {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: white;
    border: 1px solid #3498db;
    color: #3498db;
}

.btn-secondary:hover {
    background: #e8f4fd;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* 表格樣式 */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #5a6c7d;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
}

td {
    padding: 16px 12px;
    border-bottom: 1px solid #f1f3f5;
    font-size: 14px;
    color: #495057;
}

tr:hover {
    background: #f8f9fa;
    transition: background 0.2s;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-active {
    background: #d4edda;
    color: #155724;
}

.badge-review {
    background: #cce5ff;
    color: #004085;
}

.badge-school {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-private {
    background: #f8d7da;
    color: #721c24;
}

.badge-scratch {
    background: #ff6900;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-iot {
    background: #4caf50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-app {
    background: #2196f3;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* 進度條 */
.progress-bar {
    width: 120px;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
    transition: width 0.3s;
}

.progress-green {
    background: linear-gradient(90deg, #27ae60, #229954);
}

.progress-yellow {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.progress-red {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

/* 模態框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #FFFFFF;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.form-group label .required {
    color: #e74c3c;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
}

/* 資訊區塊 */
.info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f5;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #495057;
    width: 120px;
    flex-shrink: 0;
}

.info-value {
    color: #2c3e50;
    flex: 1;
}

/* 批次操作列 */
.batch-actions {
    background: #e8f4fd;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.batch-actions-info {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
}

/* 分頁控制 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.pagination button:hover {
    background: #e8f4fd;
    border-color: #3498db;
}

.pagination button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
}

/* 浮動操作按鈕 */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 900;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-item input,
    .filter-item select {
        width: 100%;
    }

    .main-menu {
        overflow-x: auto;
    }

    .table-container {
        overflow-x: auto;
    }
}

/* 隱藏類別 */
.hidden {
    display: none !important;
}

/* 載入動畫 */
.loading {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
}

/* 待辦事項列表 */
.todo-list {
    list-style: none;
    padding: 0;
}

.todo-item {
    padding: 12px;
    border-left: 3px solid #3498db;
    margin-bottom: 8px;
    background: #f8f9fa;
    font-size: 14px;
    color: #495057;
    display: flex;
    align-items: center;
}

.todo-item::before {
    content: '•';
    color: #3498db;
    font-weight: bold;
    margin-right: 12px;
    font-size: 20px;
}

/* 警告框 */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #17a2b8;
    color: #0c5460;
}

/* 檔案預覽區 */
.file-preview {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 16px 0;
}

.file-icon {
    font-size: 48px;
    color: #95a5a6;
    margin-bottom: 12px;
}

/* 選取框 */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 操作按鈕組 */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* 圖表相關樣式 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chart-container.large {
    grid-column: span 2;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.chart-header h3 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.chart-controls {
    display: flex;
    gap: 4px;
}

.chart-btn {
    padding: 4px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-btn:hover {
    background: #f8f9fa;
}

.chart-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.chart-filter {
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
}

canvas {
    max-width: 100%;
    height: auto;
}

/* 儀表板控制區 */
.dashboard-controls {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.time-filter-bar {
    display: flex;
    gap: 8px;
    margin: 20px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.time-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.time-btn:hover {
    background: #e9ecef;
}

.time-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* 增強型統計卡片 */
.stat-card.enhanced {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #5e72e4 0%, #825ee4 100%);
    color: white;
    cursor: pointer;
    border: none;
}

.stat-card.enhanced:nth-child(2) {
    background: linear-gradient(135deg, #f5365c 0%, #f56036 100%);
}

.stat-card.enhanced:nth-child(3) {
    background: linear-gradient(135deg, #11cdef 0%, #1171ef 100%);
}

.stat-card.enhanced:nth-child(4) {
    background: linear-gradient(135deg, #2dce89 0%, #2dcecc 100%);
}

.stat-card.enhanced .stat-label {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.stat-card.enhanced .stat-value {
    color: white;
    font-size: 42px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-trend {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-weight: 600;
}

.stat-trend.positive {
    color: white;
    background: rgba(255, 255, 255, 0.25);
}

.stat-trend.negative {
    color: white;
    background: rgba(255, 255, 255, 0.25);
}

.stat-progress {
    margin-top: 12px;
}

.stat-progress .progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.stat-progress .progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    transition: width 0.3s;
}

/* 更新狀態指示器 */
.update-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    margin-top: 24px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
    color: #6c757d;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
}

.status-indicator.active {
    background: #28a745;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* 報表管理相關樣式 */
.report-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.report-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.report-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.report-icon {
    font-size: 48px;
    margin-bottom: 16px;
    text-align: center;
}

.report-card h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #2c3e50;
}

.report-card p {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.report-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* 多維度分析樣式 */
.analytics-filters {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.filter-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 500;
    color: #495057;
}

.filter-tag {
    padding: 4px 12px;
    background: #3498db;
    color: white;
    border-radius: 16px;
    font-size: 12px;
}

.analytics-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-title {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

/* 分析篩選表單 */
.form-section {
    margin-bottom: 24px;
}

.form-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-row select {
    flex: 1;
    min-width: 120px;
}

.checkbox-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.radio-group {
    display: flex;
    gap: 16px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-range input {
    flex: 1;
}

/* 範圍滑桿 */
.range-slider {
    margin-top: 12px;
}

.range-slider input[type="range"] {
    width: 100%;
    margin: 8px 0;
}

.range-display {
    text-align: center;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
}

/* 分享連結容器 */
.share-link-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.share-link-container input {
    flex: 1;
}

/* 其他連結樣式 */
.more-link,
.view-all-link {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
}

.more-link:hover,
.view-all-link:hover {
    text-decoration: underline;
}

.btn-link {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

/* 成功徽章 */
.badge-success {
    background: #28a745;
    color: white;
}

/* 表格中的正負值樣式 */
td.positive {
    color: #28a745;
    font-weight: 500;
}

td.negative {
    color: #dc3545;
    font-weight: 500;
}

/* Portal & Portlet 系統樣式 */
.portlet-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.portlet-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.portlet-container.dragging {
    opacity: 0.8;
    transform: rotate(2deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.portlet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: grab;
    user-select: none;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.portlet-header:active {
    cursor: grabbing;
}

.portlet-header.grabbing {
    cursor: grabbing;
}

.portlet-title {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.portlet-drag-handle {
    display: flex;
    align-items: center;
    color: #95a5a6;
    font-size: 16px;
    cursor: grab;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.portlet-drag-handle:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.portlet-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.portlet-control-btn {
    padding: 6px 8px;
    border: none;
    background: none;
    color: #95a5a6;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.portlet-control-btn:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.portlet-control-btn.refresh-btn:hover {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.portlet-control-btn.settings-btn:hover {
    color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.portlet-content {
    padding: 20px;
}

.portlet-ghost {
    opacity: 0.4;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
}

.portlet-chosen {
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
    transform: scale(1.02);
}

/* 可拖拽的網格容器 */
.sortable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.sortable-grid.single-column {
    grid-template-columns: 1fr;
}

.sortable-grid.two-columns {
    grid-template-columns: repeat(2, 1fr);
}

.sortable-grid.three-columns {
    grid-template-columns: repeat(3, 1fr);
}

/* 佈局控制 */
.layout-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
}

.layout-label {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
    margin-right: 8px;
}

.layout-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    color: #495057;
}

.layout-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.layout-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.reset-layout-btn {
    margin-left: auto;
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.reset-layout-btn:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* 拖拽時的視覺提示 */
.drop-zone {
    min-height: 200px;
    border: 2px dashed #3498db;
    border-radius: 8px;
    background: rgba(52, 152, 219, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3498db;
    font-weight: 500;
    margin: 16px 0;
    transition: all 0.3s;
}

.drop-zone.active {
    background: rgba(52, 152, 219, 0.1);
    border-color: #2980b9;
}

/* 響應式設計調整 */
@media (max-width: 768px) {
    .sortable-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .portlet-header {
        padding: 12px 16px 8px 16px;
    }

    .portlet-title {
        font-size: 14px;
    }

    .portlet-content {
        padding: 16px;
    }

    .layout-controls {
        flex-wrap: wrap;
        gap: 4px;
    }
}
