/* ===================================
   Discord 訊息監控系統 - 模態框
   ================================ */

/* ===== 基本模態框 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.modal[style*="display: block"] {
    opacity: 1 !important;
    visibility: visible !important;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

/* ===== 密碼模態框 ===== */
.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(3px);
}

.password-modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

.password-modal-header {
    background: var(--primary-gradient);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.password-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.password-modal-close {
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.password-modal-close:hover {
    transform: scale(1.1);
}

.password-modal-body {
    padding: 25px;
}

.password-info {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--info-color);
}

.password-level {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
}

.password-level.level-moderate {
    background: #fef3c7;
    color: #92400e;
}

.password-level.level-admin {
    background: #fee2e2;
    color: #dc2626;
}

.password-input-group {
    margin-bottom: 15px;
}

.password-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.password-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.password-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.password-hint {
    background: #eff6ff;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    color: #1e40af;
    border-left: 3px solid var(--info-color);
}

.password-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== 下載進度模態框 ===== */
.download-progress-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(5px);
}

.download-progress-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.download-progress-content h3 {
    margin-bottom: 25px;
    color: var(--text-primary);
    font-size: 1.4rem;
}

.progress-info {
    margin-bottom: 20px;
}

.progress-text {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--success-color), #059669);
    border-radius: 6px;
    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-detail {
    color: var(--text-secondary);
    font-size: 14px;
}

.progress-warning {
    background: #fef3c7;
    padding: 12px;
    border-radius: 8px;
    color: #92400e;
    font-size: 13px;
    border-left: 3px solid var(--warning-color);
}

/* ===== 圖片模態框 ===== */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: -10px;
    color: white;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
}

.image-modal-close:hover {
    color: var(--danger-color);
    transform: scale(1.1);
}

.image-modal-img {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}
/* 機器人分析按鈕 */
.btn-bot-analysis {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-bot-analysis:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

/* 機器人分析模態框 */
.bot-analysis-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.bot-analysis-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.analysis-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.analysis-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.analysis-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.analysis-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.analysis-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.analysis-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.user-details .user-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-details .user-handle {
    opacity: 0.8;
    font-size: 14px;
}

.user-details .analysis-period {
    opacity: 0.7;
    font-size: 12px;
    margin-top: 4px;
}

.analysis-body {
    padding: 24px;
}

/* 風險評估區域 */
.risk-assessment {
    text-align: center;
    padding: 24px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 24px;
}

.risk-score-container {
    margin-bottom: 16px;
}

.risk-score {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
}

.risk-label {
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.risk-meter {
    max-width: 300px;
    margin: 0 auto;
}

.risk-meter-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.risk-meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
    animation: fillAnimation 1.5s ease;
}

/* 行為統計網格 */
.behavior-stats h3 {
    margin-bottom: 16px;
    color: #374151;
    font-size: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #4f46e5;
    margin-bottom: 4px;
}

.stat-label-a {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}
.stat-label {
    font-size: 12px;
    color: #ffffff;
    font-weight: 500;
}
/* 可疑行為標記 */
.suspicious-flags h3 {
    margin-bottom: 16px;
    color: #dc2626;
}

.flags-list {
    space-y: 8px;
}

.flag-item {
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 8px;
}

.flag-item.severity-critical {
    background: #fef2f2;
    border-color: #dc2626;
}

.flag-item.severity-warning {
    background: #fffbeb;
    border-color: #d97706;
}

.flag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.flag-type {
    font-weight: 600;
    color: #374151;
}

.flag-score {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.flag-description {
    color: #6b7280;
    font-size: 14px;
}

.no-flags {
    text-align: center;
    padding: 32px;
    color: #16a34a;
    font-size: 18px;
    font-weight: 600;
}

/* 時間分布圖表 */
.time-chart-section h3 {
    margin-bottom: 16px;
    color: #374151;
}

.time-chart-container {
    display: flex;
    align-items: end;
    height: 120px;
    gap: 2px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.time-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: end;
    min-height: 20px;
    border-radius: 2px 2px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.time-bar:hover {
    transform: scaleY(1.1);
    filter: brightness(1.2);
}

.time-label {
    font-size: 10px;
    color: #6b7280;
    text-align: center;
    margin-top: 4px;
    transform: rotate(-45deg);
    transform-origin: center;
}

/* 重複內容區域 */
.duplicate-content-section h3 {
    margin-bottom: 16px;
    color: #374151;
}

.duplicate-list {
    max-height: 200px;
    overflow-y: auto;
}

.duplicate-item {
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin-bottom: 8px;
}

.duplicate-text {
    font-family: monospace;
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.5);
    padding: 8px;
    border-radius: 4px;
}

.duplicate-info {
    font-size: 12px;
    color: #dc2626;
    font-weight: 600;
}

/* 建議區域 */
.recommendations h3 {
    margin-bottom: 16px;
    color: #059669;
}

.recommendation-list {
    list-style: none;
    padding: 0;
}

.recommendation-item {
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    margin-bottom: 8px;
    color: #059669;
    position: relative;
    padding-left: 40px;
}

.recommendation-item::before {
    content: "💡";
    position: absolute;
    left: 12px;
    top: 12px;
}

/* 分析頁腳 */
.analysis-footer {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
}

/* 載入模態框 */
.loading-modal .bot-analysis-content {
    max-width: 400px;
    text-align: center;
}

.loading-content {
    padding: 48px 24px;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

.analysis-steps {
    margin-top: 24px;
}

.step {
    padding: 8px 0;
    color: #9ca3af;
    font-size: 14px;
    transition: color 0.3s ease;
}

.step.active {
    color: #4f46e5;
    font-weight: 600;
}

/* 動畫 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fillAnimation {
    from { width: 0; }
    to { width: var(--target-width, 100%); }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .bot-analysis-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .analysis-header {
        padding: 16px;
    }
    
    .analysis-body {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .risk-score {
        font-size: 36px;
    }
    
    .analysis-footer {
        flex-direction: column;
    }
}

.image-modal-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-lg);
}

.image-modal-filename {
    font-weight: 600;
    color: var(--text-primary);
}

.image-modal-download {
    font-size: 14px;
    padding: 8px 16px;
}