/* Scheduled Tasks Styles - Following TradeVoice Patterns */

.scheduled-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

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

.scheduled-header h2 {
    margin: 0;
    color: #333;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Stats Cards */
.scheduled-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.scheduled-stats .stat-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    min-width: 140px;
    flex: 1;
}

.scheduled-stats .stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.scheduled-stats .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

/* Timeline */
.schedule-timeline {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.schedule-timeline h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.timeline-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
}

.timeline-item {
    min-width: 120px;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
}

.timeline-item:hover {
    border-color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.timeline-item.running {
    border-color: #2196F3;
    background: #e3f2fd;
    animation: pulse 2s infinite;
}

.timeline-item.success {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.timeline-item.failed {
    border-color: #f44336;
    background: #ffebee;
}

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

.timeline-time {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.timeline-task {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.timeline-status {
    font-size: 18px;
}

/* Quick Actions */
.scheduled-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Task List Table */
.scheduled-tasks-list {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.tasks-table {
    width: 100%;
    border-collapse: collapse;
}

.tasks-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e0e0e0;
}

.tasks-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.tasks-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
}

.tasks-table tbody tr:hover {
    background: #f9fafb;
}

.tasks-table .empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
}

.task-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.task-status.running {
    background: #e3f2fd;
    color: #1976D2;
}

.task-status.success {
    background: #e8f5e9;
    color: #388E3C;
}

.task-status.failed {
    background: #ffebee;
    color: #D32F2F;
}

.task-status.pending {
    background: #f5f5f5;
    color: #666;
}

.task-actions {
    display: flex;
    gap: 5px;
}

.task-action-btn {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.task-action-btn:hover {
    background: #f9fafb;
    border-color: #4CAF50;
}

.task-action-btn.delete:hover {
    background: #ffebee;
    border-color: #f44336;
}

.task-action-btn:active {
    transform: scale(0.95);
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .scheduled-stats {
        flex-wrap: wrap;
    }

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

    .tasks-table {
        font-size: 12px;
    }

    .tasks-table th,
    .tasks-table td {
        padding: 8px;
    }
}


/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 900px;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.modal-content label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-content textarea {
    resize: vertical;
}

.cron-presets {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.cron-presets button {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.cron-presets button:hover {
    background: #e0e0e0;
}

.cron-builder-visual {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.cron-builder-visual select,
.cron-builder-visual input[type="time"],
.cron-builder-visual input[type="number"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.cron-builder-visual input[type="number"] {
    width: 60px;
}

#cronExpression {
    font-family: monospace;
    font-size: 13px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    justify-content: flex-end;
}

/* Template Library */
.template-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.template-category-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.template-category-btn:hover {
    color: #333;
}

.template-category-btn.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.template-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.template-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.template-card h4 {
    margin: 10px 0;
    color: #333;
}

.template-card p {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
}

.template-meta {
    display: flex;
    justify-content: space-around;
    margin: 15px 0;
    color: #888;
    font-size: 13px;
}

.template-card .btn-primary {
    width: 100%;
    margin-top: 10px;
}


/* Task Filters */
.task-filters {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-group input[type="text"] {
    width: 200px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.pagination button:hover:not(:disabled) {
    background: #f0f0f0;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination span {
    color: #666;
    font-size: 14px;
}


/* Visual Timeline */
.task-timeline-viz {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

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

.timeline-header h4 {
    margin: 0;
    color: #333;
}

.timeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.timeline-slot {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    background: #fafafa;
    min-height: 80px;
}

.timeline-slot.has-tasks {
    background: #f0f8ff;
    border-color: #4CAF50;
}

.timeline-time {
    font-weight: bold;
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.timeline-tasks {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.timeline-task {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.timeline-task:hover {
    background: #e8f5e9;
    border-color: #4CAF50;
    transform: translateY(-2px);
}

.task-icon {
    font-size: 14px;
}

.task-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-tasks {
    color: #ccc;
    font-size: 18px;
}


/* Daily Report Dashboard */
.daily-report-dashboard {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

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

.report-header h4 {
    margin: 0;
    color: #333;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.report-card {
    background: #f9fafb;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.report-card h5 {
    margin: 0 0 15px 0;
    color: #555;
    font-size: 16px;
}

.chart-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.legend-item {
    font-size: 14px;
    color: #666;
}

.legend-item.success {
    color: #4CAF50;
}

.legend-item.failed {
    color: #f44336;
}

.metric-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 4px;
}

.metric-label {
    color: #666;
    font-size: 14px;
}

.metric-value {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.task-frequency-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.frequency-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
}

.task-name {
    color: #333;
    font-size: 14px;
}

.task-count {
    color: #4CAF50;
    font-weight: bold;
    font-size: 14px;
}

/* Execution Details Popup Animation */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.task-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Workflow Actions */
.action-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 8px;
}

.action-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.step-number {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.action-details {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

.variable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 5px;
}

.badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

/* Toast notification animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
