/**
 * Action Plan Styling
 * Styles for action plan display, progress tracking, and related components
 */

/* ============================================================================
   Action Plan Container
   ============================================================================ */

.action-plan {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.no-plan {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* ============================================================================
   Plan Header
   ============================================================================ */

.plan-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

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

.plan-title h3 {
    margin: 0;
    font-size: 1.5em;
    color: #333;
}

.parent-request {
    background: #f8f9fa;
    padding: 12px 16px;
    border-left: 4px solid #4CAF50;
    border-radius: 4px;
    margin: 12px 0;
    font-size: 1.1em;
}

.parent-request strong {
    color: #555;
    margin-right: 8px;
}

.plan-meta {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    color: #666;
}

.plan-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft { background: #e0e0e0; color: #666; }
.status-awaiting { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-executing { background: #cce5ff; color: #004085; animation: pulse 2s infinite; }
.status-completed { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }
.status-failed { background: #f8d7da; color: #721c24; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================================================
   Child Tasks
   ============================================================================ */

.child-tasks {
    margin: 24px 0;
}

.child-tasks h4 {
    margin-bottom: 16px;
    color: #333;
    font-size: 1.2em;
}

.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.task-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Impact-based coloring */
.task-item.impact-safe {
    border-left: 4px solid #4CAF50;
}

.task-item.impact-medium {
    border-left: 4px solid #FF9800;
}

.task-item.impact-high {
    border-left: 4px solid #f44336;
}

.task-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.task-number {
    font-weight: bold;
    color: #666;
    min-width: 24px;
}

.task-status {
    font-size: 1.2em;
    min-width: 24px;
}

.task-description {
    flex: 1;
    font-size: 1.05em;
    color: #333;
    line-height: 1.5;
}

.task-details {
    margin-left: 56px;
}

.task-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #666;
}

.task-impact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 0.9em;
}

.impact-label {
    color: #666;
    font-weight: 500;
}

.impact-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.badge-safe { background: #d4edda; color: #155724; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-default { background: #e0e0e0; color: #666; }

.task-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    font-size: 0.9em;
}

.task-result {
    margin-top: 12px;
    margin-left: 56px;
    padding: 12px;
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
}

.task-result .result-header {
    color: #0066cc;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.task-result .result-content {
    color: #333;
    font-size: 0.95em;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ============================================================================
   Data Sources Section
   ============================================================================ */

.data-sources-section {
    margin: 24px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.data-sources-section h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 1.1em;
}

.data-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.data-source-badge {
    background: #ffffff;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9em;
    color: #495057;
}

/* ============================================================================
   Plan Actions (Buttons)
   ============================================================================ */

.plan-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-secondary:hover {
    background: #0b7dda;
}

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

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

/* ============================================================================
   Plan Completion
   ============================================================================ */

.plan-completion {
    margin-top: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.completion-summary {
    margin-bottom: 20px;
}

.completion-summary h4 {
    margin: 0 0 12px 0;
    color: #28a745;
    font-size: 1.3em;
}

.completion-summary pre {
    background: white;
    padding: 16px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    margin: 0;
}

.important-findings {
    background: #fff3cd;
    padding: 16px;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
}

.important-findings h4 {
    margin: 0 0 12px 0;
    color: #856404;
    font-size: 1.1em;
}

.important-findings ul {
    margin: 0;
    padding-left: 20px;
}

.important-findings li {
    margin-bottom: 8px;
    color: #856404;
}

/* ============================================================================
   Progress Tracker
   ============================================================================ */

.progress-tracker {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.progress-tracker-empty,
.progress-status {
    text-align: center;
    padding: 20px;
    color: #666;
}

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

.progress-header h4 {
    margin: 0;
    font-size: 1.2em;
    color: #333;
}

.progress-percentage {
    font-size: 1.5em;
    font-weight: bold;
    color: #4CAF50;
}

.progress-bar-container {
    width: 100%;
    height: 24px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-weight: bold;
    font-size: 0.85em;
}

.progress-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
}

.stat-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.stat-failed .stat-value {
    color: #f44336;
}

.current-task {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.current-task.completed {
    background: #d4edda;
    border-left-color: #28a745;
}

.current-task-label {
    font-weight: 600;
    color: #0d47a1;
    margin-bottom: 6px;
}

.current-task.completed .current-task-label {
    color: #155724;
}

.current-task-description {
    color: #333;
    line-height: 1.5;
}

.progress-actions {
    text-align: center;
    margin-top: 16px;
}

/* ============================================================================
   Gmail Progress Tracker (Completion States)
   ============================================================================ */

.gmail-progress-tracker {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 12px 0;
}

.gmail-progress-complete {
    border-color: #28a745;
    background: #f8fff9;
}

.gmail-progress-complete .progress-header h4 {
    color: #28a745;
}

.gmail-progress-complete .progress-percentage {
    color: #28a745;
}

.progress-bar-complete {
    background: linear-gradient(90deg, #28a745 0%, #34ce57 100%) !important;
}

.current-status {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 12px;
}

.gmail-progress-complete .current-status {
    background: #d4edda;
    border-left-color: #28a745;
}

.status-message {
    color: #333;
    line-height: 1.5;
}

.status-success {
    color: #155724;
    font-weight: 500;
}

.gmail-progress-tracker-empty {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .action-plan,
    .progress-tracker {
        padding: 16px;
    }

    .plan-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .progress-stats {
        flex-direction: column;
        gap: 12px;
    }

    .task-meta {
        flex-direction: column;
        gap: 8px;
    }
}
