/* ===================================
   Discord 公告系統 - 完整樣式
   ================================ */

/* ===== 基礎變數 ===== */
:root {
    /* 主色調 */
   --primary-gradient: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
   --primary-color: #2563eb;
   --primary-dark: #1d4ed8;
    
    /* 狀態顏色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 中性顏色 */
   --text-primary: #1e293b;
   --text-secondary: #475569;
   --text-light: #94a3b8;
    
    /* 背景顏色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
   --bg-accent: #eef2ff;
    
    /* 邊框和陰影 */
   --border-color: rgba(148, 163, 184, 0.24);
   --border-radius: 16px;
   --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.08);
   --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.12);
   --shadow-lg: 0 30px 60px rgba(15, 23, 42, 0.18);
    
    /* 公告系統特有顏色 */
    --announcement-primary: #667eea;
    --announcement-secondary: #764ba2;
    --announcement-accent: #3b82f6;
    
    /* 公告分類顏色 */
   --category-general: #64748b;
   --category-event: #d97706;
   --category-update: #2563eb;
   --category-warning: #dc2626;
   --category-maintenance: #7c3aed;
    
    /* 統一控件高度 */
    --control-height: 40px;
}

/* ===== 基礎重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transform: scale(1) !important;
}

body {
   font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
   background:
   radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 28%),
   linear-gradient(180deg, #0b1220 0%, #111827 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
   padding: 24px;
    background: transparent;
}

svg.ui-icon {
   width: 1em;
   height: 1em;
   display: inline-block;
   flex: none;
   vertical-align: -0.125em;
   stroke: currentColor;
   fill: none;
   stroke-width: 1.9;
   stroke-linecap: round;
   stroke-linejoin: round;
}
.embed-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    margin: 8px 0;
    object-fit: contain;
}

.embed-thumbnail {
    max-width: 80px;
    max-height: 80px;
    border-radius: 4px;
    float: right;
    margin-left: 16px;
}

/* 表單提示文字樣式 */
.form-text {
    font-size: 12px;
    margin-top: 4px;
    opacity: 0.7;
}

.text-muted {
    color: var(--text-secondary);
}
/* ===== 功能標籤導航 ===== */
.feature-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 8px;
   background: rgba(15, 23, 42, 0.84);
   border-radius: 20px;
    overflow-x: auto;
   box-shadow: 0 12px 30px rgba(2, 6, 23, 0.18);
   border: 1px solid rgba(148, 163, 184, 0.14);
   backdrop-filter: blur(12px);
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    background: transparent;
    border: none;
   border-radius: 14px;
   color: #cbd5e1;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.tab-btn:hover:not(.active) {
   background: rgba(148, 163, 184, 0.08);
   color: #ffffff;
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: white;
   box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

/* ===== 標籤內容區域 ===== */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* ===== 內容頭部 ===== */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.content-header h2 {
   color: #f8fafc !important;
    margin: 0;
    font-size: 24px;
    font-weight: 700;
   text-shadow: 0 2px 10px rgba(2, 6, 23, 0.22);
}

/* ===== 統一 header-actions 所有控件高度 ===== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-actions .search-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: transparent;
}

/* 統一所有控件高度為 40px */
.header-actions input,
.header-actions select,
.header-actions .btn,
.search-controls input,
.search-controls select,
.search-controls .checkbox-label {
    height: var(--control-height);
    min-height: var(--control-height);
    display: flex;
    align-items: center;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    outline: none;
}

/* 輸入框和選擇框樣式 */
.header-actions input[type="text"],
.header-actions input[type="search"],
.header-actions input[type="date"],
.header-actions select,
.search-controls input[type="text"],
.search-controls input[type="search"],
.search-controls input[type="date"],
.search-controls select,
#announcementSearch,
#categoryFilter,
#guildFilter,
#statusFilter,
#dateFrom,
#dateTo {
    padding: 0 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 140px;
    cursor: pointer;
}

.header-actions input:focus,
.header-actions select:focus,
.search-controls input:focus,
.search-controls select:focus {
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    background: white;
}

.search-controls input::placeholder {
    color: #9ca3af;
}

/* 修復選擇框樣式 */
.header-actions select,
.search-controls select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.header-actions select:focus,
.search-controls select:focus {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
}

/* checkbox-label 樣式 */
.search-controls .checkbox-label {
    color: white !important;
    background: rgba(255, 255, 255, 0.15);
    padding: 0 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin: 0;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    gap: 8px;
    white-space: nowrap;
    justify-content: center;
}

.search-controls .checkbox-label:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.search-controls .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: white;
}

/* 獨立的 checkbox 樣式 */
#activeOnlyFilter,
#activeSchedulesOnly {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: white;
    vertical-align: middle;
}

/* 按鈕樣式 */
.header-actions .btn {
    padding: 0 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    justify-content: center;
}

.header-actions .btn-secondary {
    background: transparent;
    color: white;
    border-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
}

.header-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    transform: translateY(-1px);
}

/* 新增按鈕特別樣式 */
.header-actions .btn-primary,
.btn.btn-primary.add-button {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    color: var(--primary-color);
    border: 2px solid rgba(255, 255, 255, 0.8);
    font-weight: 700;
    text-shadow: none;
    position: relative;
    overflow: hidden;
}

.header-actions .btn-primary::before,
.btn.btn-primary.add-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
    transition: left 0.5s ease;
}

.header-actions .btn-primary:hover::before,
.btn.btn-primary.add-button:hover::before {
    left: 100%;
}

.header-actions .btn-primary:hover,
.btn.btn-primary.add-button:hover {
    background: white;
    color: var(--primary-dark);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.header-actions .btn-primary .btn-icon,
.btn.btn-primary.add-button .btn-icon {
    margin-right: 8px;
    font-size: 16px;
    font-weight: bold;
}

/* ===== 通用按鈕樣式 ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    user-select: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    transform: scale(1) !important;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
    text-transform: none;
    letter-spacing: normal;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #2563eb;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* ===== 快速操作面板 ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 60px;
}

.action-btn .btn-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.action-btn.primary {
    background: var(--primary-gradient);
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.action-btn.secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.action-btn.secondary:hover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.action-btn.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.action-btn.success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.action-btn.info {
    background: linear-gradient(135deg, var(--info-color), #2563eb);
    color: white;
}

.action-btn.info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

/* ===== 卡片樣式 ===== */
.card {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 20px;
    color: var(--text-primary) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== 公告卡片 ===== */
.announcement-card,
.channel-card,
.schedule-card,
.log-card {
    background: white !important;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
    color: var(--text-primary) !important;
}

.announcement-card:hover,
.channel-card:hover,
.schedule-card:hover,
.log-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.announcement-card.status-active { border-left-color: var(--success-color); }
.announcement-card.status-inactive { border-left-color: var(--text-secondary); }
.schedule-card.status-active { border-left-color: var(--info-color); }
.schedule-card.status-inactive { border-left-color: var(--text-secondary); }

/* ===== 發送記錄特殊樣式 - 橫向排列 ===== */
.log-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    min-height: auto;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.log-info {
    flex: 1;
    min-width: 0;
}

.log-title {
    color: var(--text-primary) !important;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-channel {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.log-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.log-details {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.log-details .detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 80px;
}

.log-details .detail-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 500;
    opacity: 0.8;
}

.log-details .detail-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.log-details .detail-item.error .detail-value {
    color: var(--danger-color);
    font-size: 10px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-id {
    font-family: monospace;
    font-size: 10px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 卡片頭部 ===== */
.announcement-header,
.channel-header,
.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
}

.announcement-info,
.channel-info,
.schedule-info {
    flex: 1;
    min-width: 0;
}

.announcement-title,
.channel-name,
.schedule-name {
    color: var(--text-primary) !important;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.announcement-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ===== 徽章樣式 ===== */
.category-badge,
.priority-badge,
.status-badge,
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-general { background: #f3f4f6; color: #374151; }
.category-event { background: #fef3c7; color: #92400e; }
.category-update { background: #dbeafe; color: #1e40af; }
.category-warning { background: #fee2e2; color: #dc2626; }
.category-maintenance { background: #f3e8ff; color: #7c3aed; }

.priority-low { background: #dbeafe; color: #1e40af; }
.priority-normal { background: #d1fae5; color: #065f46; }
.priority-high { background: #fef3c7; color: #92400e; }
.priority-urgent { background: #fee2e2; color: #dc2626; }

.status-active { background: #d1fae5; color: #065f46; }
.status-inactive { background: #fee2e2; color: #dc2626; }
.status-sent { background: #d1fae5; color: #065f46; }
.status-failed { background: #fee2e2; color: #dc2626; }
.status-pending { background: #fef3c7; color: #92400e; }

/* ===== 操作按鈕區域 ===== */
.announcement-actions,
.channel-actions,
.schedule-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* ===== 內容區域 ===== */
.announcement-content {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    max-height: 120px;
    overflow-y: auto;
    margin: 12px 0;
    line-height: 1.5;
    font-size: 14px;
    color: var(--text-primary);
}

/* ===== 統計區域 ===== */
.announcement-stats,
.channel-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
    background: transparent;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
    background: transparent;
}

.stat-label {
    font-size: 12px;
	color: var(--primary-dark);
    font-weight: 500;
    opacity: 1 !important;
}

.stat-value {
    font-size: 14px;
    color: var(--text-primary) !important;
    font-weight: 600;
}

/* ===== 頻道設定樣式 ===== */
.channel-settings,
.schedule-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.setting-item,
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-label,
.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.setting-value,
.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== 模態框樣式 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(3px);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    background: var(--primary-gradient);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-header .close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-header .close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-secondary);
}

/* ===== 測試頻道功能樣式 ===== */
.test-send-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(3px);
}

.test-send-modal.active {
    opacity: 1;
    visibility: visible;
}

.test-send-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.test-send-modal.active .test-send-content {
   transform: translateY(0);
}

.test-send-header {
   background: var(--primary-gradient);
   color: white;
   padding: 20px 24px;
   border-radius: 16px 16px 0 0;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.test-send-header h3 {
   margin: 0;
   font-size: 1.1rem;
   font-weight: 600;
}

.test-send-close {
   background: none;
   border: none;
   color: white;
   font-size: 24px;
   font-weight: bold;
   cursor: pointer;
   padding: 0;
   width: 28px;
   height: 28px;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 50%;
   transition: all 0.2s ease;
}

.test-send-close:hover {
   background: rgba(255, 255, 255, 0.2);
   transform: scale(1.1);
}

.test-send-body {
   padding: 24px;
}

.test-send-info {
   background: var(--bg-accent);
   padding: 16px;
   border-radius: 8px;
   margin-bottom: 20px;
   border-left: 4px solid var(--info-color);
}

.test-send-info p {
   margin: 0;
   color: var(--text-secondary);
   font-size: 14px;
   line-height: 1.5;
}

.channel-select-group {
   margin-bottom: 20px;
}

.channel-select-label {
   display: block;
   margin-bottom: 8px;
   font-weight: 600;
   color: var(--text-primary);
   font-size: 14px;
}

.channel-select {
   width: 100%;
   height: var(--control-height);
   padding: 0 16px;
   border: 2px solid var(--border-color);
   border-radius: 8px;
   font-size: 14px;
   background: white;
   color: var(--text-primary);
   transition: all 0.3s ease;
   cursor: pointer;
   background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
   background-repeat: no-repeat;
   background-position: right 12px center;
   background-size: 12px;
   padding-right: 36px;
   appearance: none;
}

.channel-select:focus {
   outline: none;
   border-color: var(--primary-color);
   box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.channel-select option {
   padding: 8px;
   font-size: 14px;
}

.test-send-actions {
   display: flex;
   justify-content: flex-end;
   gap: 12px;
   padding: 20px 24px;
   border-top: 1px solid var(--border-color);
   background: var(--bg-secondary);
}

.test-send-preview {
   background: var(--bg-secondary);
   padding: 16px;
   border-radius: 8px;
   margin-bottom: 20px;
   border-left: 3px solid var(--primary-color);
}

.test-send-preview h4 {
   margin: 0 0 8px 0;
   color: var(--text-primary);
   font-size: 14px;
   font-weight: 600;
}

.test-send-preview p {
   margin: 0;
   color: var(--text-secondary);
   font-size: 13px;
   line-height: 1.4;
}

/* ===== 表單樣式 ===== */
.form-group {
   display: flex;
   flex-direction: column;
   gap: 8px;
   margin-bottom: 16px;
   position: relative;
}

.form-group label {
   font-weight: 600;
   color: var(--text-primary);
   font-size: 14px;
}

.form-control {
   padding: 12px 16px;
   border: 2px solid var(--border-color);
   border-radius: var(--border-radius);
   font-size: 16px;
   transition: all 0.3s ease;
   background: white;
   color: var(--text-primary);
   min-height: 44px;
}

.form-control:focus {
   outline: none;
   border-color: var(--primary-color);
   box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
   color: var(--text-light);
}

.form-row {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 16px;
   margin-bottom: 16px;
}

.checkbox-group {
   display: flex;
   flex-direction: column;
   gap: 8px;
   margin: 16px 0;
}

.checkbox-label {
   display: flex;
   align-items: center;
   gap: 8px;
   cursor: pointer;
   user-select: none;
   font-weight: 500;
   color: var(--text-primary);
   transition: color 0.2s ease;
   padding: 8px;
   border-radius: 6px;
}

.checkbox-label:hover {
   background: rgba(102, 126, 234, 0.05);
   color: var(--primary-color);
}

.checkbox-label input[type="checkbox"] {
   width: 16px;
   height: 16px;
   margin: 0;
   cursor: pointer;
   accent-color: var(--primary-color);
}

/* ===== 頻道選擇器增強樣式 ===== */
.channel-selector {
   max-height: 300px;
   overflow-y: auto;
   border: 1px solid var(--border-color);
   border-radius: var(--border-radius);
   background: white;
   box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.channel-option {
   display: flex;
   align-items: center;
   justify-content: space-between;
   padding: 16px;
   border-bottom: 1px solid #f1f5f9;
   cursor: pointer;
   transition: all 0.2s ease;
   background: white;
}

.channel-option:hover {
   background: var(--bg-secondary);
   transform: translateX(2px);
}

.channel-option:last-child {
   border-bottom: none;
}

.channel-option input[type="checkbox"] {
   margin-right: 12px;
   width: 18px;
   height: 18px;
   accent-color: var(--primary-color);
   cursor: pointer;
}

.channel-option .channel-info {
   flex: 1;
   display: flex;
   flex-direction: column;
   gap: 4px;
}

.channel-option .channel-name {
   font-weight: 600;
   color: var(--text-primary);
   font-size: 16px;
   display: flex;
   align-items: center;
   gap: 8px;
   background: var(--bg-accent);
   padding: 8px 12px;
   border-radius: 8px;
   border: 1px solid var(--border-color);
   transition: all 0.2s ease;
}

.channel-option .channel-name::before {
   content: '#';
   color: var(--text-secondary);
   font-weight: normal;
}

.channel-option .guild-name {
   font-size: 12px;
   color: var(--text-secondary);
   padding-left: 16px;
}

/* ===== 排程選項樣式 ===== */
.schedule-option {
   margin: 16px 0;
   padding: 20px;
   background: var(--bg-secondary);
   border-radius: var(--border-radius);
   border: 1px solid var(--border-color);
}

.schedule-option h4 {
   margin: 0 0 12px 0;
   color: var(--text-primary);
   font-size: 16px;
   font-weight: 600;
}

/* ===== Embed 預覽樣式 ===== */
.preview-section {
   margin-top: 24px;
   padding-top: 24px;
   border-top: 1px solid var(--border-color);
}

.preview-section h4 {
   margin: 0 0 16px 0;
   color: var(--text-primary);
   font-size: 16px;
   font-weight: 600;
}

.embed-preview {
   max-width: 500px;
   background: #2f3136;
   border-radius: 8px;
   overflow: hidden;
   display: flex;
   margin: 16px 0;
}

.embed-color-bar {
   width: 4px;
   background: var(--primary-color);
   flex-shrink: 0;
}

.embed-content {
   padding: 16px;
   color: #dcddde;
   flex: 1;
}

.embed-title {
   font-weight: 600;
   color: #ffffff;
   margin-bottom: 8px;
   font-size: 16px;
}

.embed-description {
   color: #dcddde;
   line-height: 1.4;
   margin-bottom: 8px;
   white-space: pre-wrap;
}

.embed-thumbnail {
   max-width: 80px;
   max-height: 80px;
   border-radius: 4px;
   float: right;
   margin-left: 16px;
}

.embed-footer {
   font-size: 12px;
   color: #b9bbbe;
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-top: 8px;
}

/* ===== 載入狀態樣式 ===== */
.loading,
.loading-container {
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   padding: 48px 24px;
   color: var(--text-secondary);
   background: rgba(255, 255, 255, 0.95);
   border-radius: 16px;
   margin: 20px 0;
   box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
   width: 40px;
   height: 40px;
   border: 4px solid #f1f5f9;
   border-top: 4px solid var(--primary-color);
   border-radius: 50%;
   animation: spin 1s linear infinite;
   margin-bottom: 16px;
}

.loading-text {
   font-size: 16px;
   color: var(--text-secondary);
   font-weight: 500;
}

.loading-small {
   display: inline-flex;
   align-items: center;
   gap: 8px;
   padding: 8px 12px;
   background: rgba(255, 255, 255, 0.9);
   border-radius: 8px;
   font-size: 14px;
   color: var(--text-secondary);
}

.loading-small .loading-spinner {
   width: 16px;
   height: 16px;
   border-width: 2px;
   margin: 0;
}

/* ===== 空狀態樣式 ===== */
.empty-state {
   text-align: center;
   padding: 60px 20px;
   color: var(--text-secondary);
   background: rgba(255, 255, 255, 0.95);
   border-radius: 16px;
   margin: 20px 0;
   box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.empty-icon {
   font-size: 64px;
   margin-bottom: 16px;
   opacity: 0.6;
   color: var(--text-light);
}

.empty-title {
   font-size: 24px;
   font-weight: 600;
   color: var(--text-primary);
   margin: 0 0 8px 0;
}

.empty-description {
   font-size: 16px;
   margin: 0 0 24px 0;
   max-width: 400px;
   margin-left: auto;
   margin-right: auto;
   line-height: 1.6;
   color: var(--text-secondary);
}

.empty-actions {
   margin-top: 20px;
}

/* ===== 分頁樣式優化 ===== */
.pagination {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-top: 24px;
   padding: 16px 20px;
   flex-wrap: wrap;
   gap: 12px;
   background: rgba(255, 255, 255, 0.95);
   border-radius: 12px;
   box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
   border: 1px solid rgba(255, 255, 255, 0.3);
}

.pagination:empty {
   display: none;
}

.pagination-info {
   color: var(--text-secondary);
   font-size: 14px;
   font-weight: 500;
   white-space: nowrap;
}

.pagination-controls {
   display: flex;
   gap: 6px;
   flex-wrap: wrap;
   align-items: center;
}

.pagination-controls .btn {
   min-width: 36px;
   padding: 8px 12px;
   font-size: 13px;
   min-height: 36px;
   text-transform: none;
   letter-spacing: normal;
}

.pagination-controls .btn.active {
   background: var(--primary-color);
   color: white;
   font-weight: 600;
}

.pagination-controls .btn:not(.active) {
   background: white;
   color: var(--text-secondary);
   border: 1px solid var(--border-color);
}

.pagination-controls .btn:not(.active):hover {
   background: var(--bg-accent);
   color: var(--text-primary);
}

/* ===== 儀表板樣式 ===== */
.dashboard {
   display: grid;
   grid-template-columns: 1fr;
   gap: 20px;
}

.dashboard .card {
   margin-bottom: 0;
}

.stats-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
   gap: 20px;
   margin-bottom: 20px;
}

.stat-card {
   background: var(--primary-gradient);
   color: white;
   padding: 20px;
   border-radius: 16px;
   text-align: center;
   box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
   transition: transform 0.3s ease;
}

.stat-card:hover {
   transform: translateY(-3px);
}

.stat-number {
   font-size: 2.5rem;
   font-weight: 700;
   margin-bottom: 5px;
   transition: color 0.3s ease;
}

.stat-number.updating {
   color: var(--primary-dark);
}

.stat-label {
   font-size: 0.9rem;
   opacity: 0.9;
   font-weight: 500;
}

/* ===== 最近活動樣式 ===== */
.recent-activity {
   display: flex;
   flex-direction: column;
   gap: 12px;
}

.activity-item {
   display: flex;
   align-items: center;
   gap: 12px;
   padding: 12px;
   background: var(--bg-secondary);
   border-radius: var(--border-radius);
   transition: background 0.2s ease;
}

.activity-item:hover {
   background: #f1f5f9;
}

.activity-icon {
   width: 32px;
   height: 32px;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 14px;
   flex-shrink: 0;
   background: var(--primary-color);
   color: white;
}

.activity-content {
   flex: 1;
   min-width: 0;
}

.activity-title {
   font-weight: 600;
   color: var(--text-primary);
   font-size: 14px;
   margin-bottom: 2px;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

.activity-meta {
   font-size: 12px;
   color: var(--text-secondary);
}

.activity-status {
   flex-shrink: 0;
}

.no-activity {
   text-align: center;
   padding: 24px;
   color: var(--text-secondary);
   font-style: italic;
}

/* ===== 進度條樣式 ===== */
.progress-container {
   margin: 8px 0;
}

.progress-label {
   font-size: 12px;
   color: var(--text-secondary);
   margin-bottom: 4px;
}

.progress-bar {
   width: 100%;
   height: 8px;
   background: #f1f5f9;
   border-radius: 4px;
   overflow: hidden;
}

.progress-fill {
   height: 100%;
   background: var(--primary-gradient);
   transition: width 0.3s ease;
   position: relative;
}

.progress-fill::after {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
   animation: shimmer 2s infinite;
}

.progress-text {
   font-size: 12px;
   color: var(--text-secondary);
   margin-top: 4px;
   text-align: center;
}

/* ===== 通知系統樣式 ===== */
.notification {
   position: fixed;
   top: 20px;
   right: 20px;
   max-width: 400px;
   padding: 16px 20px;
   border-radius: var(--border-radius);
   box-shadow: var(--shadow-lg);
   z-index: 9999;
   transform: translateX(450px);
   transition: transform 0.3s ease;
   backdrop-filter: blur(10px);
   display: flex;
   align-items: center;
   gap: 12px;
}

.notification.show {
   transform: translateX(0);
}

.notification-success {
   background: rgba(16, 185, 129, 0.95);
   color: white;
   border-left: 4px solid #059669;
}

.notification-error {
   background: rgba(239, 68, 68, 0.95);
   color: white;
   border-left: 4px solid #dc2626;
}

.notification-warning {
   background: rgba(245, 158, 11, 0.95);
   color: white;
   border-left: 4px solid #d97706;
}

.notification-info {
   background: rgba(59, 130, 246, 0.95);
   color: white;
   border-left: 4px solid #2563eb;
}

.notification-icon {
   font-size: 20px;
   flex-shrink: 0;
}

.notification-content {
   flex: 1;
   font-weight: 500;
}

/* ===== 狀態指示器 ===== */
.status-indicator {
   display: inline-flex;
   align-items: center;
   gap: 4px;
   font-size: 12px;
   font-weight: 600;
}

/* ===== 離線提示 ===== */
.offline-notice {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   background: var(--danger-color);
   color: white;
   padding: 12px;
   text-align: center;
   z-index: 10000;
   font-weight: 600;
   box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.offline-content {
   display: flex;
   align-items: center;
   justify-content: center;
   gap: 8px;
}

.offline-icon {
   font-size: 16px;
}

.offline-text {
   font-size: 14px;
}

/* ===== 頁面標題樣式 ===== */
.header {
   text-align: center;
   margin-bottom: 40px;
   color: white;
}

.header h1 {
   font-size: 3rem;
   font-weight: 700;
   margin-bottom: 10px;
   text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
   font-size: 1.2rem;
   opacity: 0.9;
   font-weight: 300;
}

/* ===== 導航欄樣式 ===== */
.main-navbar {
   background: rgba(255, 255, 255, 0.95);
   backdrop-filter: blur(10px);
   padding: 12px 30px;
   border-radius: 15px;
   margin-bottom: 20px;
   display: none;
   justify-content: space-between;
   align-items: center;
   box-shadow: var(--shadow-sm);
   border: 1px solid rgba(255, 255, 255, 0.3);
   position: relative;
   overflow: hidden;
}

.main-navbar::before {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   height: 2px;
   background: var(--primary-gradient);
   background-size: 200% 100%;
   animation: shimmer 3s ease-in-out infinite;
}

.navbar-brand {
   display: flex;
   align-items: center;
   gap: 12px;
   flex-shrink: 0;
}

.user-avatar {
   width: 40px;
   height: 40px;
   border-radius: 50%;
   border: 2px solid var(--primary-color);
   object-fit: cover;
   transition: all 0.3s ease;
}

.user-avatar:hover {
   transform: scale(1.05);
   box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.user-details {
   display: flex;
   flex-direction: column;
}

.user-name {
   font-weight: 600;
   color: var(--text-primary);
   font-size: 1rem;
   white-space: nowrap;
}

.user-status {
   font-size: 12px;
   color: var(--success-color);
   font-weight: 500;
}

.navbar-nav {
   display: flex;
   gap: 12px;
   flex: 1;
   justify-content: center;
   max-width: 500px;
}

.nav-btn {
   padding: 10px 20px;
   background: var(--bg-accent);
   border: 2px solid var(--border-color);
   cursor: pointer;
   font-weight: 600;
   transition: all 0.3s ease;
   text-align: center;
   border-radius: 12px;
   color: #475569;
   font-size: 14px;
   min-height: 44px;
   display: flex;
   align-items: center;
   justify-content: center;
   white-space: nowrap;
   text-decoration: none;
   position: relative;
   overflow: hidden;
}

.nav-btn::before {
   content: '';
   position: absolute;
   bottom: 0;
   left: 50%;
   transform: translateX(-50%);
   width: 0;
   height: 3px;
   background: var(--primary-gradient);
   transition: width 0.3s ease;
}

.nav-btn:hover:not(.active) {
   background: var(--border-color);
   color: #334155;
   transform: translateY(-2px);
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-btn.active {
   background: var(--primary-gradient);
   color: white;
   border-color: var(--primary-color);
   box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
   transform: translateY(-1px);
}

.nav-btn.active::before {
   width: 80%;
}

.navbar-actions {
   display: flex;
   align-items: center;
   gap: 12px;
   flex-shrink: 0;
}

.logout-btn {
   background: var(--danger-color);
   color: white;
   border: none;
   padding: 8px 16px;
   border-radius: 10px;
   cursor: pointer;
   font-weight: 600;
   transition: all 0.3s ease;
   font-size: 14px;
   flex-shrink: 0;
   white-space: nowrap;
}

.logout-btn:hover {
   background: #dc2626;
   transform: translateY(-1px);
   box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ===== 動畫定義 ===== */
@keyframes fadeIn {
   from { opacity: 0; transform: translateY(20px); }
   to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
   to { transform: rotate(360deg); }
}

@keyframes shimmer {
   0%, 100% { background-position: 200% 0; }
   50% { background-position: -200% 0; }
}

@keyframes slideInDown {
   from {
       opacity: 0;
       transform: translateY(-30px);
   }
   to {
       opacity: 1;
       transform: translateY(0);
   }
}

@keyframes pulse {
   0%, 100% {
       opacity: 1;
   }
   50% {
       opacity: 0.5;
   }
}

@keyframes slideInUp {
   from {
       opacity: 0;
       transform: translateY(30px);
   }
   to {
       opacity: 1;
       transform: translateY(0);
   }
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
   :root {
       --control-height: 36px;
   }
   
   .container {
       padding: 15px;
   }
   
   .feature-tabs {
       flex-direction: column;
       gap: 4px;
       padding: 6px;
   }
   
   .tab-btn {
       min-width: auto;
       text-align: center;
       padding: 14px 16px;
   }
   
   .content-header {
       flex-direction: column;
       align-items: stretch;
       gap: 12px;
   }
   
   .header-actions {
       justify-content: flex-start;
       flex-direction: column;
       align-items: stretch;
       gap: 8px;
   }
   
   .search-controls {
       flex-direction: column;
       align-items: stretch;
       gap: 8px;
   }
   
   .search-controls input,
   .search-controls select {
       min-width: auto;
       width: 100%;
   }
   
   .form-row {
       grid-template-columns: 1fr;
   }
   
   .announcement-header,
   .channel-header,
   .schedule-header {
       flex-direction: column;
       align-items: stretch;
       gap: 12px;
   }
   
   .announcement-actions,
   .channel-actions,
   .schedule-actions {
       justify-content: flex-start;
       flex-wrap: wrap;
   }
   
   .channel-settings,
   .schedule-details {
       grid-template-columns: 1fr;
   }
   
   .announcement-stats,
   .channel-stats {
       flex-direction: column;
       gap: 12px;
   }
   
   .pagination {
       flex-direction: column;
       gap: 12px;
       text-align: center;
   }
   
   .quick-actions {
       grid-template-columns: 1fr;
   }
   
   .stats-grid {
       grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
       gap: 12px;
   }
   
   .notification {
       top: 10px;
       right: 10px;
       left: 10px;
       max-width: none;
       transform: translateY(-100px);
   }
   
   .notification.show {
       transform: translateY(0);
   }
   
   .modal-content {
       width: 95%;
       margin: 20px auto;
   }
   
   .modal-header {
       padding: 15px 20px;
   }
   
   .modal-body {
       padding: 20px;
   }
   
   .modal-footer {
       padding: 15px 20px;
       flex-direction: column;
       gap: 8px;
   }
   
   .main-navbar {
       padding: 12px 20px;
       flex-direction: column;
       gap: 15px;
       text-align: center;
   }
   .navbar-brand {
       order: 1;
   }
   
   .navbar-nav {
       order: 2;
       width: 100%;
       max-width: none;
       flex-direction: column;
       gap: 8px;
   }
   
   .navbar-actions {
       order: 3;
       justify-content: center;
   }
   
   .nav-btn {
       width: 100%;
       padding: 12px;
       font-size: 13px;
   }
   
   .log-card {
       flex-direction: column;
       align-items: stretch;
       gap: 12px;
       padding: 16px;
   }
   
   .log-header {
       flex-direction: column;
       align-items: stretch;
       gap: 8px;
   }
   
   .log-details {
       flex-direction: column;
       gap: 8px;
   }
   
   .log-details .detail-item {
       flex-direction: row;
       justify-content: space-between;
       align-items: center;
   }
}

@media (max-width: 480px) {
   :root {
       --control-height: 32px;
   }
   
   .announcement-card,
   .channel-card,
   .schedule-card,
   .log-card {
       padding: 12px;
       margin-bottom: 12px;
   }
   
   .announcement-meta {
       flex-direction: column;
       gap: 4px;
   }
   
   .pagination-controls {
       flex-wrap: wrap;
       justify-content: center;
   }
   
   .action-btn {
       flex-direction: column;
       text-align: center;
       gap: 8px;
       padding: 12px;
   }
   
   .action-btn .btn-icon {
       font-size: 24px;
   }
   
   .header h1 {
       font-size: 2rem;
   }
   
   .header p {
       font-size: 1rem;
   }
   
   .channel-option {
       padding: 12px;
   }
   
   .channel-option .channel-name {
       font-size: 14px;
   }
   
   .channel-option .guild-name {
       font-size: 11px;
   }
}

/* ===== 滾動條美化 ===== */
::-webkit-scrollbar {
   width: 8px;
   height: 8px;
}

::-webkit-scrollbar-track {
   background: #f1f5f9;
   border-radius: 4px;
}

::-webkit-scrollbar-thumb {
   background: linear-gradient(135deg, #667eea, #764ba2);
   border-radius: 4px;
   transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
   background: linear-gradient(135deg, #5a6fd8, #6b46a3);
}

/* Firefox 滾動條 */
* {
   scrollbar-width: thin;
   scrollbar-color: #667eea #f1f5f9;
}

/* ===== 文字選擇樣式 ===== */
::selection {
   background: rgba(102, 126, 234, 0.2);
   color: #1f2937;
}

::-moz-selection {
   background: rgba(102, 126, 234, 0.2);
   color: #1f2937;
}

/* ===== 工具類 ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }

.bg-primary { background: var(--primary-color) !important; }
.bg-secondary { background: var(--bg-secondary) !important; }
.bg-success { background: var(--success-color) !important; }
.bg-danger { background: var(--danger-color) !important; }
.bg-warning { background: var(--warning-color) !important; }
.bg-info { background: var(--info-color) !important; }

.border { border: 1px solid var(--border-color) !important; }
.border-0 { border: none !important; }
.rounded { border-radius: var(--border-radius) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* ===== 額外的搜尋控制樣式 ===== */
.search-controls {
   display: flex;
   align-items: center;
   gap: 12px;
   flex-wrap: wrap;
   background: transparent;
}

/* 日期輸入框特別樣式 */
input[type="date"] {
   height: var(--control-height);
   padding: 0 14px;
   border: 2px solid rgba(255, 255, 255, 0.3);
   border-radius: 8px;
   font-size: 14px;
   background: rgba(255, 255, 255, 0.95);
   color: var(--text-primary);
   transition: all 0.3s ease;
   min-width: 140px;
   box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
   cursor: pointer;
}

input[type="date"]:focus {
   outline: none;
   border-color: white;
   box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
   background: white;
}

input[type="date"]::-webkit-calendar-picker-indicator {
   cursor: pointer;
   filter: invert(0.5);
   transition: filter 0.2s ease;
}

input[type="date"]:hover::-webkit-calendar-picker-indicator {
   filter: invert(0.2);
}

/* ===== 額外的按鈕變體 ===== */
.btn-outline-primary {
   background: transparent;
   color: var(--primary-color);
   border: 2px solid var(--primary-color);
}

.btn-outline-primary:hover {
   background: var(--primary-color);
   color: white;
}

.btn-outline-secondary {
   background: transparent;
   color: var(--text-secondary);
   border: 2px solid var(--border-color);
}

.btn-outline-secondary:hover {
   background: var(--text-secondary);
   color: white;
}

/* ===== 表格增強樣式 ===== */
.data-table {
   width: 100%;
   border-collapse: collapse;
   background: white;
   border-radius: var(--border-radius);
   overflow: hidden;
   box-shadow: var(--shadow-sm);
   margin: 20px 0;
}

.data-table th,
.data-table td {
   padding: 12px 16px;
   text-align: left;
   border-bottom: 1px solid var(--border-color);
}

.data-table th {
   background: var(--bg-accent);
   font-weight: 600;
   color: var(--text-primary);
   font-size: 14px;
}

.data-table tbody tr:hover {
   background: var(--bg-secondary);
}

.data-table tbody tr:last-child td {
   border-bottom: none;
}

/* ===== 表單增強樣式 ===== */
.form-floating {
   position: relative;
}

.form-floating input,
.form-floating textarea {
   padding: 16px 12px 8px;
}

.form-floating label {
   position: absolute;
   top: 16px;
   left: 12px;
   font-size: 16px;
   color: var(--text-light);
   transition: all 0.2s ease;
   pointer-events: none;
}

.form-floating input:focus + label,
.form-floating input:not(:placeholder-shown) + label,
.form-floating textarea:focus + label,
.form-floating textarea:not(:placeholder-shown) + label {
   top: 4px;
   font-size: 12px;
   color: var(--primary-color);
}

/* ===== 卡片網格佈局 ===== */
.card-grid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
   gap: 20px;
   margin: 20px 0;
}

.card-grid .card {
   margin-bottom: 0;
   height: fit-content;
}

/* ===== 警告和錯誤樣式 ===== */
.alert {
   padding: 16px 20px;
   border-radius: var(--border-radius);
   margin: 16px 0;
   border-left: 4px solid;
   display: flex;
   align-items: center;
   gap: 12px;
}

.alert-success {
   background: #f0fdf4;
   border-color: var(--success-color);
   color: #166534;
}

.alert-warning {
   background: #fffbeb;
   border-color: var(--warning-color);
   color: #92400e;
}

.alert-danger {
   background: #fef2f2;
   border-color: var(--danger-color);
   color: #991b1b;
}

.alert-info {
   background: #eff6ff;
   border-color: var(--info-color);
   color: #1e40af;
}

.alert-icon {
   font-size: 20px;
   flex-shrink: 0;
}

/* ===== 手風琴/折疊面板 ===== */
.accordion {
   border: 1px solid var(--border-color);
   border-radius: var(--border-radius);
   overflow: hidden;
   margin: 16px 0;
}

.accordion-item {
   border-bottom: 1px solid var(--border-color);
}

.accordion-item:last-child {
   border-bottom: none;
}

.accordion-header {
   background: var(--bg-accent);
   padding: 16px 20px;
   cursor: pointer;
   display: flex;
   justify-content: space-between;
   align-items: center;
   transition: background 0.2s ease;
   user-select: none;
}

.accordion-header:hover {
   background: var(--border-color);
}

.accordion-header.active {
   background: var(--primary-color);
   color: white;
}

.accordion-title {
   font-weight: 600;
   margin: 0;
}

.accordion-icon {
   transition: transform 0.3s ease;
}

.accordion-header.active .accordion-icon {
   transform: rotate(180deg);
}

.accordion-content {
   padding: 20px;
   display: none;
   background: white;
}

.accordion-content.active {
   display: block;
   animation: slideInDown 0.3s ease;
}

/* ===== 步驟指示器 ===== */
.stepper {
   display: flex;
   align-items: center;
   justify-content: space-between;
   margin: 24px 0;
   position: relative;
}

.stepper::before {
   content: '';
   position: absolute;
   top: 50%;
   left: 0;
   right: 0;
   height: 2px;
   background: var(--border-color);
   z-index: 1;
}

.step {
   background: white;
   width: 40px;
   height: 40px;
   border-radius: 50%;
   border: 2px solid var(--border-color);
   display: flex;
   align-items: center;
   justify-content: center;
   font-weight: 600;
   z-index: 2;
   position: relative;
}

.step.completed {
   background: var(--success-color);
   border-color: var(--success-color);
   color: white;
}

.step.active {
   background: var(--primary-color);
   border-color: var(--primary-color);
   color: white;
}

/* ===== 標籤頁增強 ===== */
.nav-tabs {
   display: flex;
   border-bottom: 2px solid var(--border-color);
   margin-bottom: 20px;
}

.nav-tab {
   padding: 12px 20px;
   border: none;
   background: transparent;
   color: var(--text-secondary);
   cursor: pointer;
   font-weight: 500;
   border-bottom: 3px solid transparent;
   transition: all 0.3s ease;
}

.nav-tab:hover {
   color: var(--text-primary);
   background: var(--bg-accent);
}

.nav-tab.active {
   color: var(--primary-color);
   border-bottom-color: var(--primary-color);
   background: var(--bg-accent);
}

/* ===== 清理樣式 ===== */
.clearfix::after {
   content: "";
   display: table;
   clear: both;
}

.no-select {
   user-select: none;
   -webkit-user-select: none;
   -moz-user-select: none;
   -ms-user-select: none;
}

.pointer-events-none {
   pointer-events: none;
}

.pointer-events-auto {
   pointer-events: auto;
}

/* ===== 最終確保元素不縮放 ===== */
*, *::before, *::after {
   transform: scale(1) !important;
}

/* 允許必要的動畫變換 */
.loading-spinner,
.progress-fill::after,
[data-allow-animation="true"] {
   transform: unset !important;
}

/* ===== 額外的選擇框修復 ===== */
select {
   -webkit-appearance: none;
   -moz-appearance: none;
   appearance: none;
   background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
   background-repeat: no-repeat;
   background-position: right 12px center;
   background-size: 12px;
   padding-right: 36px;
}

select:focus {
   background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
}

/* ===== 確保所有控件在同一行對齊 ===== */
.header-actions,
.search-controls {
   align-items: center;
}

.header-actions > *,
.search-controls > * {
   flex-shrink: 0;
}

/* ===== 修復特定元素的高度 ===== */
.search-controls .checkbox-label {
   display: flex !important;
   align-items: center !important;
   justify-content: center !important;
}

/* ===== 結束 ===== */