/**
 * ==========================================
 * 檔案一鍵替換模組樣式
 * ==========================================
 * 
 * 檔案: assets/css/file_apply.css
 * 
 * 創建時間: 2024-12-21
 * 版本: 1.0.0
 */

/* ===== 應用按鈕樣式 ===== */
.apply-to-project-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.apply-to-project-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea97c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}

.apply-to-project-btn:active {
    transform: translateY(0);
}

.apply-to-project-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.apply-to-project-btn.applying {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%);
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.apply-to-project-btn.applied {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.3);
}

.apply-to-project-btn.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.apply-to-project-btn .btn-icon {
    font-size: 14px;
}

.apply-to-project-btn .btn-text {
    white-space: nowrap;
}

/* ===== 確認對話框樣式 ===== */
.file-apply-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.file-apply-modal.show {
    opacity: 1;
    visibility: visible;
}

.file-apply-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.file-apply-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.file-apply-modal.show .file-apply-modal-content {
    transform: translate(-50%, -50%) scale(1);
}

/* 對話框頭部 */
.file-apply-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.file-apply-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.file-apply-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.file-apply-modal-close:hover {
    opacity: 1;
}

/* 對話框內容 */
.file-apply-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 檔案資訊 */
.file-apply-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.file-apply-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.file-apply-info-item:last-child {
    border-bottom: none;
}

.file-apply-info-item .label {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.file-apply-info-item .value {
    color: #212529;
    word-break: break-all;
}

/* 差異統計 */
.diff-summary {
    display: flex;
    gap: 12px;
}

.diff-summary .added {
    color: #28a745;
    font-weight: 600;
}

.diff-summary .removed {
    color: #dc3545;
    font-weight: 600;
}

.diff-summary .changed {
    color: #ffc107;
    font-weight: 600;
}

/* 差異預覽 */
.file-apply-diff {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.diff-header {
    background: #e9ecef;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
}

.diff-content {
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
}

.diff-line {
    display: flex;
    padding: 4px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.diff-line:last-child {
    border-bottom: none;
}

.diff-line.diff-add {
    background: #d4edda;
}

.diff-line.diff-remove {
    background: #f8d7da;
}

.diff-line .line-num {
    min-width: 40px;
    color: #6c757d;
    text-align: right;
    padding-right: 12px;
    user-select: none;
}

.diff-line .line-type {
    min-width: 20px;
    font-weight: bold;
    color: #6c757d;
}

.diff-line.diff-add .line-type {
    color: #28a745;
}

.diff-line.diff-remove .line-type {
    color: #dc3545;
}

.diff-line .line-content {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-more {
    padding: 10px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    background: #f8f9fa;
}

.diff-empty {
    padding: 20px;
    text-align: center;
    color: #6c757d;
}

/* 警告訊息 */
.file-apply-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    color: #856404;
    font-size: 13px;
}

.file-apply-warning .warning-icon {
    font-size: 16px;
}

/* 對話框底部 */
.file-apply-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.file-apply-modal-footer button {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-apply-modal-footer .btn-cancel {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

.file-apply-modal-footer .btn-cancel:hover {
    background: #dee2e6;
}

.file-apply-modal-footer .btn-confirm {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.file-apply-modal-footer .btn-confirm:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea97c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* ===== 通知樣式 ===== */
.file-apply-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.file-apply-notification.show {
    transform: translateX(0);
}

.file-apply-notification.success {
    background: #28a745;
}

.file-apply-notification.error {
    background: #dc3545;
}

.file-apply-notification.info {
    background: #17a2b8;
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
    .file-apply-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .file-apply-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .apply-to-project-btn .btn-text {
        display: none;
    }
    
    .apply-to-project-btn {
        padding: 6px 10px;
    }
}

/* ===== 深色模式支援 ===== */
@media (prefers-color-scheme: dark) {
    .file-apply-modal-content {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    .file-apply-info {
        background: #2d2d2d;
    }
    
    .file-apply-info-item {
        border-bottom-color: #404040;
    }
    
    .file-apply-info-item .label {
        color: #b0b0b0;
    }
    
    .file-apply-info-item .value {
        color: #e0e0e0;
    }
    
    .file-apply-diff {
        border-color: #404040;
    }
    
    .diff-header {
        background: #2d2d2d;
        color: #b0b0b0;
    }
    
    .diff-line {
        border-bottom-color: #333;
    }
    
    .diff-line.diff-add {
        background: rgba(40, 167, 69, 0.2);
    }
    
    .diff-line.diff-remove {
        background: rgba(220, 53, 69, 0.2);
    }
    
    .file-apply-warning {
        background: rgba(255, 193, 7, 0.2);
        border-color: rgba(255, 193, 7, 0.3);
        color: #ffc107;
    }
    
    .file-apply-modal-footer {
        background: #2d2d2d;
        border-top-color: #404040;
    }
    
    .file-apply-modal-footer .btn-cancel {
        background: #404040;
        color: #e0e0e0;
        border-color: #555;
    }
}