/* ===================================
   Discord 訊息監控系統 - 佈局相關
   ================================ */

/* ===== 用戶資訊欄 ===== */
.user-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 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);
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.user-bar::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;
}

.user-info {
    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;
}

/* 標籤頁容器 */
.tab-container {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
    max-width: 400px;
}

.tab-button {
    padding: 8px 16px;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    border-radius: 10px;
    color: #475569;
    font-size: 13px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex: 1;
    min-width: 120px;
    position: relative;
}

.tab-button::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-button:hover:not(.active) {
    background: var(--border-color);
    color: #334155;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-button.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.tab-button.active::before {
    width: 80%;
}

.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);
}

/* ===== 頁面標題 ===== */
.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;
}

/* ===== 卡片組件 ===== */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.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;
}

/* 主要佈局網格 */
.dashboard {
    display: grid;
    grid-template-columns: 2fr 3fr; /* 搜尋區佔2份，統計區佔3份 */
    gap: 30px;
    margin-bottom: 30px;
}

/* 結果容器 */
.results-container {
    grid-column: 1 / -1;
}

/* ===== 統計區塊 ===== */
.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;
}

/* ===== 圖表容器 ===== */
.chart-container {
    position: relative;
    height: 200px;
    margin: 20px 0;
}

#dailyChart, #topUsersChart {
    max-height: 200px !important;
}

/* ===== 分頁 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 40px;
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-accent);
    transform: translateY(-1px);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination span {
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== 頻道資訊 ===== */
.channel-info {
    background: #ede9fe;
    color: #7c3aed;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.clickable-channel {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    user-select: none;
    background: #ede9fe;
    color: #7c3aed;
}

.clickable-channel:hover {
   background: #7c3aed !important;
   color: white !important;
   transform: translateY(-1px);
   box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* 論壇頻道特殊提示 */
.clickable-channel[onclick*="true"]:after {
   content: " (點擊切換至訊息)";
   font-size: 10px;
   color: var(--text-secondary);
   font-weight: normal;
}

/* ===== 主導航列樣式 ===== */
.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;
}

/* 導航按鈕區域 */
.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;
}

/* ===== 內容標籤頁 ===== */
.content-tabs {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.content-tabs .tab-container {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.content-tabs .tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    border-radius: 10px;
    color: #64748b;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    position: relative;
}

.content-tabs .tab-button:hover:not(.active) {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
    transform: translateY(-1px);
}

.content-tabs .tab-button.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
    .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;
    }
    
    .content-tabs .tab-container {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }
    
    .content-tabs .tab-button {
        width: 100%;
        padding: 14px;
    }
}

@media (max-width: 480px) {
    .main-navbar {
        padding: 10px 15px;
        margin-bottom: 15px;
    }
    
    .content-tabs {
        margin-bottom: 20px;
        padding: 0 10px;
    }
}